hans@taeva.UUCP (Hans von Kleist-Retzow) (10/24/88)
We are building a mailfilter which allows to distribute the incoming mail into different folder. Now I have the problem that I want to get informed in which folder new mail has arrived. So I need an extension to folders (e.g. an option 'new') which shows only the folders which contain mails which I haven't seen up to now. To get this date I must expand scan and show so that it marks a mail if it is read. etc. There has to be done a little bit more. Has anyone done things like that? It would be nice if I don't need to do all. Thanks Hans -- Hans von Kleist-Retzow, Dipl.-Inform., TA Triumph-Adler AG Hundingstr. 11b, D-8500 Nuernberg, West-Germany Tel: +49 911 322 6355 E-Mail: hans@taeva.uucp or uucp: ...!mcvax!unido!taeva!hans
mayer@hplabsz.HPL.HP.COM (Niels Mayer) (10/26/88)
In article <348@taeva.UUCP> hans@taeva.UUCP (Hans von Kleist-Retzow) writes: > >We are building a mailfilter which allows to distribute the >incoming mail into different folder. Now I have the problem >that I want to get informed in which folder new mail has arrived. >So I need an extension to folders (e.g. an option 'new') which >shows only the folders which contain mails which I haven't seen up >to now. To get this date I must expand scan and show so that it marks a mail >if it is read. etc. There has to be done a little bit more. I'm assuming you'vo got "| /usr/local/lib/mh/slocal" in your ~/.forward file and are using 'rcvstore' program to incorporate messages into the chosen folders as specified by the file ~/.maildelivery used by 'slocal'. I'm also assuming that you've set "Unseen-Sequence: unseen" in your ~/.mh_profile. Given the above, new messages that are automatically incorporated by 'rcvstore' get added to the unseen sequence of the paricular folder. (Viewing a message with 'show' will remove it from the unseen sequence). You can then use various techniques to figure out the existance of the unseen sequence in the folders: 1) look for "unseen: <msg>... " in <folder>/.mh_sequences; or 2) use mhpath. For example, I just whipped up the following using csh interactively: hplnpm[21] ~> foreach i (`folders -recurse -fast`) ? mhpath +$i unseen >& /dev/null ? if ($status == 0) echo Unseen messages in folder $i ? end The results I got were: Unseen messages in folder inbox Unseen messages in folder music/research Unseen messages in folder nm-list Unseen messages in folder subgenius Happy hacking, Niels Mayer.
mayer@hplabsz.HPL.HP.COM (Niels Mayer) (11/01/88)
Here's a /bin/sh script version of my previous solution, just incase you're interersted: # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Niels P. Mayer <mayer@hplnpm> on Mon Oct 31 17:41:42 1988 # # This archive contains: # unseen-all # LANG=""; export LANG echo x - unseen-all cat >unseen-all <<'@EOF' #!/bin/sh for i in `/usr/local/bin/mh/folders -fast -recurse` do nummsgs=`/usr/local/bin/mh/mhpath +$i unseen 2>/dev/null | wc -l` if [ $nummsgs != 0 ] then echo Folder +$i has $nummsgs unseen messages. fi done @EOF chmod 755 unseen-all exit 0 ---------- If you know the names of the folders in which messages might be automatically incorporated by mhhook or some other filter program, you can get rid of the overhead of executing `/usr/local/bin/mh/folders -fast -recurse` in the above script with a list of the folder names. -- Niels.