[pmmail-list] Folder numbers, configuration dump

J Seder pmmail-list@blueprintsoftwareworks.com
Sat, 11 May 2002 18:54:39 +0000


I created a Rexx program which dumps all the PMMail configuration I
could find...  It's a little dodgy on the ACCT.INI files which are
structured data, and I didn't know how to interpret some other
fields...  Anyway, the program is attached and perhaps someone else
will find it useful.

I think this highlights why my filters which try to move messages to
Trash put them into Drafts - many of my folders (including Trash and
Drafts) seem to be number 1000.  Therefore, moving messages to folder
1000 (as specified in the filter) has unpredictable results.

How are the folder numbers assigned?  Is there a bug somewhere which
changes the folder number to 1000?  Why do you use filter numbers?  Can
I edit FOLDER.INI to fix this?

Thanks.





/* List the contents of all PMMail account configurations.
   Jonathan Seder, May 2002 */
trace normal
call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
rc = SysFileTree("*.ACT",acct,"SDO")
do i=1 to acct.0
   say ''
   say '-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-'
   say ''
   say 'ACCOUNT:'  acct.i
   say ''
   'cd' acct.i
   call dumpacct acct.i
   call dumpfilt
   call listfolders
   'cd ..'
   end
return


/* Dump the contents of the ACCT.INI file */
dumpacct:  procedure
arg path
fname = path || '\acct.ini'
do forever
   if lines(fname)=0 then leave
   b = linein(fname)
   b = translate(b, '  ', '0100'X)
   blen = length(b)
   ipos = 1
   do ix=1 to 70
      token = strip(substr(b,ipos,16))
      value = strip(substr(b,ipos+16,256))
      if value\='' then say '     ' left(token,20) '=' left(value,40)
      ipos = ipos + 384
      if ipos>=blen then leave
      end
   end
err = stream(path,'C','CLOSE')
return


/* List the contents of all FOLDER.INI files */
listfolders: procedure
rc = SysFileTree("folder.ini",folders,"SFO")
say 'Folders for this account ('folders.0')'
do i=1 to folders.0
   b = linein(folders.i)
   err = stream(folders.i,'C','CLOSE')
   parse var b name 'DE'X num 'DE'X i1 'DE'X colorder ,
      'DE'X i2 'DE'X i3 'DE'X i4 'DE'X i5 'DE'X rest
   say '  Folder'right(num,6,' ') '"'name'"' folders.i
   if i1=0 then ascdec = 'sort-ascending'
   else ascdec = 'sort-descending'
   status='empty'
   say '    column-order='colorder 'indicate-any='i2
'indicate-unread='i3 'unread='i4 'any='i5
   if rest\='' then say 'rest='rest    /* In case we didn't parse
everything */
   end
return


/* Dump the PMMail filters in the current directory */
dumpfilt:  procedure
ffile = 'filters.lst'
b = linein(ffile)
say 'Filter header record=' b
do forever       /* Load up the user id table */
   if lines(ffile)=0 then leave
   b = linein(ffile)
   /* say b */
   parse var b name 'DE'X i1 'DE'X i2 'DE'X i3 'DE'X i4 'DE'X b1 'DE'X
b2 'DE'X b3 'DE'X b4 'DE'X ,
      condition 'DE'X x1 'DE'X x2 'DE'X x3 'DE'X x4 'DE'X x5 'DE'X x6
'DE'X rest
   say 'Filter ' name
   say '     enabled='i1 'complex='i2 'i3='i3 'type='printType(i4)
   if i2=1 then do
      say '    Complex-condition:' left(condition,50)'...'
      end
   else do
      say '    search' b1 'for'   b2
      if b3\='E1'x then say ' ' DumpBool(i3) 'search' b3 'for' b4
      end
   if left(x1,2)\='0;' then say '   1)' DumpAction(x1)
   if left(x2,2)\='0;' then say '   2)' DumpAction(x2)
   if left(x3,2)\='0;' then say '   3)' DumpAction(x3)
   if left(x4,2)\='0;' then say '   4)' DumpAction(x4)
   if left(x5,2)\='0;' then say '   5)' DumpAction(x5)
   if left(x6,2)\='0;' then say '   6)' DumpAction(x6)
   if rest\='' then say 'rest='      rest          /* In case we didn't
parse everything */
   end
err = stream(ffile,'C','CLOSE')
return

DumpBool: procedure
arg b1
if b1=0 then return 'No connective'
if b1=1 then return 'And'
if b1=2 then return 'Or'
if b1=3 then return 'Unless'
return ''


printType: procedure
arg it
type = ''
if bitand(it,1) \=0 then type = type 'Incoming'
if bitand(it,2) \=0 then type = type 'Outgoing (pre)'
if bitand(it,4) \=0 then type = type 'Outgoing(post)'
if bitand(it,8) \=0 then type = type 'Manual'
return type

printDele: procedure
arg it
type = ''
if it=0 then return 'Local'
if it=1 then return 'Remote'
if it=2 then return 'Local-and-Remote'
return ''

printPriority: procedure
arg it
type = ''
if it=0 then return 'Low'
if it=1 then return 'Normal'
if it=2 then return 'High'
return ''

printStatus: procedure
arg is
srch = ''
if is=0 then return 'Unread'
if is=1 then return 'Read'
if is=2 then return 'Replied/Forwarded'
return ''

printSearch: procedure
arg is
srch = ''
if is=1 then return 'Whole-message'
if is=2 then return 'Header'
if is=3 then return 'Body'
if is=4 then return 'Attachment-names'
if is=5 then return 'To'
if is=6 then return 'From'
if is=7 then return 'CC'
if is=8 then return 'Subject'
return ''

DumpAction: procedure
arg action
parse var action i1';'i2';'i3
act = ''
if i1= 1 then return 'Set-status='PrintStatus(i2)
if i1= 2 then return 'Set-priority='PrintPriority(i2)
if i1= 3 then return 'Set-subject' i2 i3
if i1= 4 then return 'Play-sound' i2 i3
if i1= 5 then return 'Open-message' i2 i3
if i1= 6 then return 'Print-message' i2 i3
if i1= 7 then return 'Inform-user' i2 i3
if i1= 8 then return 'User-hook-(foreground)' i3
if i1= 9 then return 'User-hook-(background)' i3
if i1=10 then return 'Send-canned-reply' i2 i3
if i1=11 then return 'Forward-message' i2 i3
if i1=12 then return 'Bounce-message' i2 i3
if i1=13 then return 'Move-message-to-folder' i2
if i1=14 then return 'Copy-message' i2 i3
if i1=15 then return 'Delete-message-('PrintDele(i2)')'
if i1=16 then return 'Stop-filtering'
if i1=17 then return 'Add-to-address-book' i2 i3
if i1=18 then return 'Add-to-group' i2 i3
if i1=19 then return 'Distribute-to-address-book' i2 i3
if i1=20 then return 'Distribute-to-group' i2 i3
if i1=21 then return 'Remove-to-address-book' i2 i3
if i1=22 then return 'Remove-to-group' i2 i3
if i1=23 then return 'Save-attachments-to-directory' i2 i3
return 'unknown action' i1 i2 i3

- pmmail-list - The PMMail Dicussion List ---------------------------
To POST to the list, send your message to:
pmmail-list@blueprintsoftwareworks.com

To UNSUBSCRIBE, send a message to mdaemon@bmtmicro.com with the first 
line of the message body being...
UNSUBSCRIBE pmmail-list@blueprintsoftwareworks.com
---------------------------------------------------------------------