

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
6 messages in net.sourceforge.lists.courier-users[courier-users] Queue ID patch reminder| From | Sent On | Attachments |
|---|---|---|
| Sam Varshavchik | Apr 5, 2004 5:49 pm | |
| Lloyd Zusman | Apr 6, 2004 5:46 am | .patch |
| Sam Varshavchik | Apr 6, 2004 3:40 pm | |
| Lloyd Zusman | Apr 6, 2004 4:59 pm | .patch |
| Lloyd Zusman | Apr 6, 2004 6:15 pm | .patch |
| Alessandro Vesely | Apr 7, 2004 1:02 am | .patch |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [courier-users] Queue ID patch reminder | Actions... |
|---|---|---|
| From: | Lloyd Zusman (lj...@asfast.com) | |
| Date: | Apr 6, 2004 5:46:42 am | |
| List: | net.sourceforge.lists.courier-users | |
| Attachments: | ||
Sam,
A couple months ago, you asked to be reminded around now about a patch I created for Courier. It adds an "id" field to the initial "Received:" header that Courier inserts into incoming messages. This field is Courier's queue ID for the message. Its use is consistent with RFC's, and there is a precedent for the use of such an "id" field in other mailers.
For example of the results of this patch, see the 4th line of the following header:
Received: from localhost (localhost [127.0.0.1]) (uid 0) by asfast.net with local; Fri, 26 Mar 2004 16:19:05 -0500 id 003396F9.40649E49.000129D8
The reason I created this patch is so a global filter can use this ID as a key to store state information for an incoming message. This will allow a subsequent local filter to retrieve this state information and then either modify or delete the message based on this saved state.
Therefore, the simple addition of this ID allows for a global filter to control the modification or deletion of a message without a major redesign/rewrite of Courier.
I will supply an example for this state management code soon.
I have made a slight change to the original patch that I submitted a couple months ago. The current version puts the "id" field at the end of the "Received:" header.
This patch is attached.
Thank you.
*** courier/submit.h.orig Mon Sep 22 19:43:24 2003 --- courier/submit.h Mon Mar 15 19:17:15 2004 *************** *** 117,122 **** --- 117,123 ---- SubmitFile(); ~SubmitFile();
+ char* QueueID(); void SendingModule(const char *p) {sending_module=p;} void Sender(const char *, const char *, const char *, char); int ChkRecipient(const char *); *** courier/submit.C.orig Mon Dec 15 20:51:29 2003 --- courier/submit.C Wed Mar 24 13:40:51 2004 *************** *** 1096,1101 **** --- 1096,1106 ---- line += mf->module->name; line += "; "; line += rfc822_mkdate(submit_time); + + // Add unique id here. + line += "\n id "; + line += my_rcptinfo.submitfile.QueueID(); + line += "\n";
for (p=line; *p; p++) *** courier/submit2.C.orig Mon Sep 22 19:44:30 2003 --- courier/submit2.C Mon Mar 15 19:17:15 2004 *************** *** 434,439 **** --- 434,500 ---- ) ; }
+ char *SubmitFile::QueueID() + { + struct stat stat_buf; + char ino_buf[sizeof(ino_t)*2+1]; + char time_buf[sizeof(time_t)*2+1]; + char pid_buf[sizeof(time_t)*2+1]; + static char result[sizeof(ino_buf)+sizeof(time_buf)+sizeof(pid_buf)]; + + char* f = strdup(name1stctlfile()); + if (f == NULL) + { + clog_msg_errno(); + } + int rc = stat(f, &stat_buf); + if (rc != 0) + { + free(f); + clog_msg_errno(); + } + // This code assumes that the result of name1stcltfile() is + // of the form SOMETHING/tttttt.ppppp.hhhhhh, where + // SOMETHING is arbitrary (as far as this routine is concerned), + // where tttttt is the modification time of the control file, + // where pppppp is the pid of the process which created + // the control file, and where hhhhhh can contain zero or + // more dots. + char* cp = f; + char* slash = f; + for (; *cp != '\0'; cp++) { + if (*cp == '/') + { + slash = cp; + } + } + cp = slash + 1; + char* dot = cp; + for (; *dot != '.'; dot++) { /* do nothing */ } + *dot++ = '\0'; + time_t tm = (time_t) atoi(cp); + cp = dot; + for (; *dot != '.'; dot++) { /* do nothing */ } + *dot++ = '\0'; + int pid = atoi(cp); + free(f); + libmail_strh_ino_t(stat_buf.st_ino, ino_buf); + libmail_strh_time_t(tm, time_buf); + libmail_strh_pid_t(pid, pid_buf); + + strcat( + strcat( + strcat( + strcat( + strcpy(result, ino_buf) + , ".") + , time_buf) + , ".") + , pid_buf) ; + + return (result); + } + char *SubmitFile::namefile(const char *pfix, unsigned n) { char buf[MAXLONGSIZE], *p;
-- Lloyd Zusman lj...@asfast.com








.patch