Lloyd Zusman <[EMAIL PROTECTED]> writes:
> Sam Varshavchik <[EMAIL PROTECTED]> writes:
>
>> [ ... ]
>>
>> It looks to me like your patch reinvents the wheel.
>>
>> The id field in question has already been computed and placed in
>> basemsgid field. Parsing the filename is completely and totally
>> unnecessary. Try reducing your patch to two or three lines of code.
>
> Thanks for the tip.
>
> It turns out that `basemsgid' doesn't contain the inode part of the
> queue id; that's contained in `ctlinodenum', which needs to be converted
> into a hex string. Therefore, it took more than 2-3 lines. But not
> much more.
>
> So how about this patch?
... and here's a somewhat shorter (and faster) version, which
eliminates a superfluous string copy.
*** courier/submit.C.orig Mon Dec 15 20:51:29 2003
--- courier/submit.C Tue Apr 6 19:52:55 2004
***************
*** 1096,1101 ****
--- 1096,1105 ----
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/submit.h.orig Mon Sep 22 19:43:24 2003
--- courier/submit.h Tue Apr 6 19:40:55 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/submit2.C.orig Mon Sep 22 19:44:30 2003
--- courier/submit2.C Tue Apr 6 21:04:55 2004
***************
*** 434,439 ****
--- 434,452 ----
) ;
}
+ char *SubmitFile::QueueID()
+ {
+ static char result[sizeof(ino_t)*2+sizeof(time_t)*4+3];
+
+ libmail_strh_ino_t(ctlinodenum, result);
+
+ strcat(
+ strcat(result, ".")
+ , basemsgid) ;
+
+ return (result);
+ }
+
char *SubmitFile::namefile(const char *pfix, unsigned n)
{
char buf[MAXLONGSIZE], *p;
--
Lloyd Zusman
[EMAIL PROTECTED]