I'm working on a web interface to procmail - some users wanted it, and it
seemed easier to do than it is - to allow users to build server-side
filters instead of picking one of my canned ones.
Looking at the filters in Thunderbird to get ideas for the layout,
I notice that there is a "mark message as flagged/important/work etc."
option. I'm using dmail from procmail, and I note there is the single
option -s "mark message as seen".
I made a -F <flag> option which seems to work OK, so
I should be able to have procmail entries like
:0
# flag as important
*
|dmail -F \$Label1 +INBOX
and maybe I can have fun colouring all my TRIUMF mail as blue (work) etc.
(Pine may have messed up some whitespace..)
--- dmail.c.orig 2006-11-27 23:51:21.000000000 -0800
+++ dmail.c 2006-11-27 23:57:40.000000000 -0800
@@ -47,7 +47,7 @@
int trycreate = NIL; /* flag saying gotta create before appending */
int critical = NIL; /* flag saying in critical code */
char *sender = NIL; /* message origin */
-
+char *setflag = NIL; /* message flag to set */
/* Function prototypes */
@@ -147,6 +147,10 @@
case 's': /* deliver as seen */
flagseen = T;
break;
+ case 'F':
+ if (argc--) setflag = cpystr (*++argv);
+ else _exit (fail ("missing argument to -F",EX_USAGE));
+ break;
case 'f':
case 'r': /* flag giving return path */
if (argc--) sender = cpystr (*++argv);
@@ -376,11 +380,17 @@
((sbuf.st_mode & S_IFMT) == S_IFDIR) ? "directory" : "file",path);
mm_dlog (tmp);
/* do the append now! */
- if (!mail_append_full (prt,mailbox,flagseen ? "\\Seen" : NIL,NIL,st)) {
- sprintf (tmp,"message delivery failed to %.80s",path);
- return fail (tmp,EX_CANTCREAT);
- }
- /* note success */
+ if (setflag) {
+ if (!mail_append_full (prt,mailbox,setflag,NIL,st)) {
+ sprintf (tmp,"message delivery failed to %.80s",path);
+ return fail (tmp,EX_CANTCREAT);
+ }
+ } else {
+ if (!mail_append_full (prt,mailbox,flagseen ? "\\Seen" : NIL,NIL,st)) {
+ sprintf (tmp,"message delivery failed to %.80s",path);
+ return fail (tmp,EX_CANTCREAT);
+ }
+ } /* note success */
sprintf (tmp,"delivered to %.80s",path);
mm_log (tmp,NIL);
/* make sure nothing evil this way comes
*/
--
Andrew Daviel, TRIUMF, Canada
Tel. +1 (604) 222-7376 (Pacific Time)
[EMAIL PROTECTED]
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw