1This is a patch to deliver to make zephyr notifications more verbose.
2Naturally it requires zephyr.  It sends zephyrs to everyone on the acl.
3
4Please note that if you're at a large site (like us) your zephyr servers
5will have problems with this patch due to the constant zephyrgrams going
6out.
7
8I have lost the name of the author for this patch; my apologies to this
9person.
10
11*** deliver.c.orig      Wed Jun 11 12:43:44 1997
12--- deliver.c   Wed Jun 11 15:08:41 1997
13***************
14*** 597,603 ****
15            else if (notifyptr &&
16                     (!strncasecmp(buf, "from:", 5) ||
17                      !strncasecmp(buf, "subject:", 8) ||
18!                     !strncasecmp(buf, "to:", 3))) {
19                if (!*notifyptr) *notifyptr = xstrdup(buf);
20                else {
21                    *notifyptr =
22--- 597,604 ----
23            else if (notifyptr &&
24                     (!strncasecmp(buf, "from:", 5) ||
25                      !strncasecmp(buf, "subject:", 8) ||
26!                     !strncasecmp(buf, "to:", 3) ||
27!                     !strncasecmp(buf, "cc:", 3))) {
28                if (!*notifyptr) *notifyptr = xstrdup(buf);
29                else {
30                    *notifyptr =
31***************
32*** 682,687 ****
33--- 683,689 ----
34  {
35      int r;
36      struct mailbox mailbox;
37+     char *mbxacl=(char *)0;
38      char namebuf[MAX_MAILBOX_PATH];
39      char notifybuf[MAX_MAILBOX_PATH];
40      char *submailbox = 0;
41***************
42*** 740,755 ****
43        prot_rewind(msg);
44        r = append_fromstream(&mailbox, msg, size, time(0), flag, nflags,
45                              user);
46        mailbox_close(&mailbox);
47      }
48
49      if (!r && user) {
50!       strcpy(notifybuf, "INBOX");
51!       if (submailbox) {
52!           strcat(notifybuf, ".");
53!           strcat(notifybuf, submailbox);
54        }
55!       notify(user, notifybuf, notifyheader ? notifyheader : "");
56      }
57
58      if (!r && dupelim && id) markdelivered(id, user ? namebuf : mailboxname);
59--- 742,776 ----
60        prot_rewind(msg);
61        r = append_fromstream(&mailbox, msg, size, time(0), flag, nflags,
62                              user);
63+       mbxacl=strdup(mailbox.acl);
64        mailbox_close(&mailbox);
65      }
66
67      if (!r && user) {
68!       struct auth_state *auth_anyone;
69!       char *anyone="anyone";
70!       char *pseudouser;
71!       int amr;
72!
73!       anyone=auth_canonifyid(anyone);
74!       auth_anyone=auth_newstate(anyone,(char*)0);
75!
76!       amr=acl_myrights(auth_anyone,mbxacl);
77!       if (amr & ACL_READ) {
78!           strcpy(notifybuf, user);
79!           pseudouser=strdup("");
80!       } else {
81!           strcpy(notifybuf, "INBOX");
82!           if (submailbox) {
83!               strcat(notifybuf, ".");
84!               strcat(notifybuf, submailbox);
85!           }
86!           pseudouser=strdup(user);
87        }
88!       notify(pseudouser, notifybuf, notifyheader ? notifyheader : "");
89!       auth_freestate(auth_anyone);
90!       free(pseudouser);
91!       free(mbxacl);
92      }
93
94      if (!r && dupelim && id) markdelivered(id, user ? namebuf : mailboxname);
95