]> code.citadel.org Git - citadel.git/commitdiff
* Changes to message base and networker to support Internet-style message
authorArt Cancro <ajc@citadel.org>
Fri, 10 Mar 2000 21:40:06 +0000 (21:40 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 10 Mar 2000 21:40:06 +0000 (21:40 +0000)
  ID's instead of the conventional Citadel style.

citadel/ChangeLog
citadel/citadel.h
citadel/internet_addressing.c
citadel/msgbase.c
citadel/msgbase.h
citadel/netproc.c
citadel/network/mail.sysinfo
citadel/serv_smtp.c
citadel/serv_vcard.c

index 158d33f41f0a1d6463ec5a62313befffacc5f66b..ee7185ab04081f1dceb93a0b4655c10ac1d51565 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 1.481  2000/03/10 21:40:04  ajc
+* Changes to message base and networker to support Internet-style message
+  ID's instead of the conventional Citadel style.
+
 Revision 1.480  2000/03/08 03:36:37  ajc
 * Shut off hostname resolution when dealing with Unix domain sockets
 * Cleaned up the 'citmail' MDA tool
@@ -1707,3 +1711,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index a4d264ae88ddb1a28b28ef37deca224412458bf3..575a5ebcd5aefc6e8a7226090491d7ad6f16d92c 100644 (file)
@@ -180,14 +180,7 @@ struct quickroom {
 
 /****************************************************************************/
 
-struct recentmsg {
-       char RMnodename[10];
-       long RMnum;                     /* Number or time of message        */
-       };
-
-
-/****************************************************************************
- *
+/*
  * Floor record.  The floor number is implicit in its location in the file.
  */
 struct floor {
@@ -246,28 +239,4 @@ struct floor {
 #define SPOOLMIME      "application/x-citadel-delivery-list"
 #define        INTERNETCFG     "application/x-citadel-internet-config"
 
-/*
- * This structure is used to hold all of the fields of a message
- * during conversion, processing, or whatever.
- */
-struct minfo {
-       char A[512];
-       char B[512];
-       char C[512];
-       char D[512];
-       char E[512];
-       char G[512];
-       char H[512];
-       long I;
-       char N[512];
-       char O[512];
-       char P[512];
-       char R[512];
-       char S[512];
-       long T;
-       char U[512];
-       char Z[512];
-       char nexthop[512];
-       };
-
 #define TRACE  lprintf(9, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
index 91648a86e41627ff86205d13f2e74f285f301fe6..32114261d823ee99dc02d45fd5bc675ebf01ee8d 100644 (file)
@@ -458,6 +458,38 @@ int convert_field(struct CtdlMessage *msg, int beg, int end) {
                processed = 1;
        }
 
+       else if (!strcasecmp(key, "Message-ID")) {
+               if (msg->cm_fields['I'] != NULL) {
+                       lprintf(5, "duplicate message id\n");
+               }
+
+               if (msg->cm_fields['I'] == NULL) {
+                       msg->cm_fields['I'] = strdoop(value);
+
+                       /* Strip angle brackets */
+                       if ((haschar(msg->cm_fields['I'], '<') == 1)
+                          && (haschar(msg->cm_fields['I'], '>') == 1)) {
+                               while ((strlen(msg->cm_fields['I']) > 0)
+                                     && (msg->cm_fields['I'][0] != '<')) {
+                                       strcpy(&msg->cm_fields['I'][0],
+                                               &msg->cm_fields['I'][1]);
+                               }
+                               strcpy(&msg->cm_fields['I'][0],
+                                       &msg->cm_fields['I'][1]);
+                               for (i = 0; i<strlen(msg->cm_fields['I']); ++i)
+                                       if (msg->cm_fields['I'][i] == '>')
+                                               msg->cm_fields['I'][i] = 0;
+                       }
+               }
+
+               if (msg->cm_fields['I'] != NULL) {
+                       TRACE;
+                       lprintf(9, "Converted message id <%s>\n",
+                               msg->cm_fields['I'] );
+               }
+               processed = 1;
+       }
+
        /* Clean up and move on. */
        phree(key);     /* Don't free 'value', it's actually the same buffer */
        return(processed);
@@ -490,6 +522,7 @@ struct CtdlMessage *convert_internet_message(char *rfc822) {
 
        while (!done) {
 
+               TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
                /* Locate beginning and end of field, keeping in mind that
                 * some fields might be multiline
                 */
@@ -523,6 +556,7 @@ struct CtdlMessage *convert_internet_message(char *rfc822) {
        }
 
        /* Follow-up sanity checks... */
+       TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
 
        /* If there's no timestamp on this message, set it to now. */
        if (msg->cm_fields['T'] == NULL) {
@@ -530,6 +564,7 @@ struct CtdlMessage *convert_internet_message(char *rfc822) {
                msg->cm_fields['T'] = strdoop(buf);
        }
 
+       TRACE; lprintf(9, "I field is %s\n", msg->cm_fields['I']);
        lprintf(9, "RFC822 length remaining after conversion = %d\n",
                strlen(rfc822));
        return msg;
index c5213d12b7ea9757e3365afc0b160ae61a87fdb5..88d1484dfb1dcd682b114ba0ed4b049d591ae04c 100644 (file)
@@ -963,7 +963,14 @@ int CtdlOutputMsg(long msg_num,            /* message number (local) to fetch */
                if (!strcasecmp(snode, NODENAME)) {
                        strcpy(snode, FQDN);
                }
-               cprintf("Message-ID: <%s@%s>%s", mid, snode, nl);
+
+               /* Construct a fun message id */
+               cprintf("Message-ID: <%s", mid);
+               if (strchr(mid, '@')==NULL) {
+                       cprintf("@%s", snode);
+               }
+               cprintf(">%s", nl);
+
                PerformUserHooks(luser, (-1L), EVT_OUTPUTMSG);
 
                if (strlen(fuser) > 0) {
@@ -1304,19 +1311,19 @@ int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int flags) {
  *
  */
 long send_message(struct CtdlMessage *msg,     /* pointer to buffer */
-               int generate_id,                /* generate 'I' field? */
                FILE *save_a_copy)              /* save a copy to disk? */
 {
        long newmsgid;
        long retval;
-       char msgidbuf[32];
+       char msgidbuf[256];
         struct ser_ret smr;
 
        /* Get a new message number */
        newmsgid = get_new_message_number();
-       sprintf(msgidbuf, "%ld", newmsgid);
+       sprintf(msgidbuf, "%ld@%s", newmsgid, config.c_fqdn);
 
-       if (generate_id) {
+       /* Generate an ID if we don't have one already */
+       if (msg->cm_fields['I']==NULL) {
                msg->cm_fields['I'] = strdoop(msgidbuf);
        }
        
@@ -1479,8 +1486,7 @@ int ReplicationChecks(struct CtdlMessage *msg) {
 long CtdlSaveMsg(struct CtdlMessage *msg,      /* message to save */
                char *rec,                      /* Recipient (mail) */
                char *force,                    /* force a particular room? */
-               int supplied_mailtype,          /* local or remote type */
-               int generate_id)                /* 1 = generate 'I' field */
+               int supplied_mailtype)          /* local or remote type */
 {
        char aaa[100];
        char hold_rm[ROOMNAMELEN];
@@ -1639,7 +1645,7 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */
 
        /* Save it to disk */
        lprintf(9, "Saving to disk\n");
-       newmsgid = send_message(msg, generate_id, network_fp);
+       newmsgid = send_message(msg, network_fp);
        if (network_fp != NULL) {
                fclose(network_fp);
                system("exec nohup ./netproc -i >/dev/null 2>&1 &");
@@ -1729,7 +1735,7 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */
                imsg->cm_format_type = FMT_RFC822;
                imsg->cm_fields['A'] = strdoop("Citadel");
                imsg->cm_fields['M'] = instr;
-               CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+               CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
                CtdlFreeMessage(imsg);
        }
 
@@ -1757,7 +1763,7 @@ void quickie_message(char *from, char *to, char *room, char *text)
                msg->cm_fields['R'] = strdoop(to);
        msg->cm_fields['M'] = strdoop(text);
 
-       CtdlSaveMsg(msg, "", room, MES_LOCAL, 1);
+       CtdlSaveMsg(msg, "", room, MES_LOCAL);
        CtdlFreeMessage(msg);
        syslog(LOG_NOTICE, text);
 }
@@ -2055,7 +2061,7 @@ SKFALL:   b = MES_NORMAL;
                        CC->quickroom.QRname, b, e, format_type, "");
 
        if (msg != NULL)
-               CtdlSaveMsg(msg, buf, (mtsflag ? AIDEROOM : ""), e, 1);
+               CtdlSaveMsg(msg, buf, (mtsflag ? AIDEROOM : ""), e);
                CtdlFreeMessage(msg);
        CC->fake_postname[0] = '\0';
        return;
@@ -2160,7 +2166,7 @@ void cmd_ent3(char *entargs)
        }
 
        msg->cm_flags = CM_SKIP_HOOKS;
-       if (valid_msg) CtdlSaveMsg(msg, recp, "", e, 0);
+       if (valid_msg) CtdlSaveMsg(msg, recp, "", e);
        CtdlFreeMessage(msg);
        phree(tempbuf);
 }
@@ -2501,7 +2507,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
                        CtdlDeleteMessages(roomname, 0L, content_type));
        }
        /* Now write the data */
-       CtdlSaveMsg(msg, "", roomname, MES_LOCAL, 1);
+       CtdlSaveMsg(msg, "", roomname, MES_LOCAL);
        CtdlFreeMessage(msg);
 }
 
index 466e188036a702ca90144e70aa6789432d25887c..5db18749a2d34eff08482923c00b33105a096a3a 100644 (file)
@@ -55,9 +55,9 @@ void cmd_msg2 (char *cmdbuf);
 void cmd_msg3 (char *cmdbuf);
 void cmd_msg4 (char *cmdbuf);
 void cmd_opna (char *cmdbuf);
-long send_message (struct CtdlMessage *, int, FILE *);
+long send_message (struct CtdlMessage *, FILE *);
 void loadtroom (void);
-long CtdlSaveMsg(struct CtdlMessage *, char *, char *, int, int);
+long CtdlSaveMsg(struct CtdlMessage *, char *, char *, int);
 void quickie_message (char *, char *, char *, char *);
 struct CtdlMessage *make_message (struct usersupp *, char *,
                   char *, int, int, int, char *);
index 48ea0c01ae7670a231de3b72b7ec238bb2e136c0..d6ace99fd0451f9476a020635fdc517c72fbe804 100644 (file)
@@ -83,6 +83,33 @@ struct syslist {
 };
 
 
+
+/*
+ * This structure is used to hold all of the fields of a message
+ * during conversion, processing, or whatever.
+ */
+struct minfo {
+       char A[512];
+       char B[512];
+       char C[512];
+       char D[512];
+       char E[512];
+       char G[512];
+       char H[512];
+       char I[512];
+       char N[512];
+       char O[512];
+       char P[512];
+       char R[512];
+       char S[512];
+       long T;
+       char U[512];
+       char Z[512];
+       char nexthop[512];
+       };
+
+
+
 void attach_to_server(int argc, char **argv);
 void serv_read(char *buf, int bytes);
 void serv_write(char *buf, int nbytes);
@@ -539,7 +566,7 @@ BONFGM:     b = getc(fp);
        if (b == 'T')
                buffer->T = atol(bbb);
        if (b == 'I')
-               buffer->I = atol(bbb);
+               strcpy(buffer->I, bbb);
        if (b == 'H')
                strcpy(buffer->H, bbb);
        if (b == 'B')
@@ -554,14 +581,6 @@ BONFGM:    b = getc(fp);
 
 END:
 
-       /* NOTE: we used to use the following two lines of code to assign
-        * the timestamp as a message-ID if there was no message-ID already
-        * in the message.  We don't do this anymore because it screws up
-        * the loopzapper.
-        *
-       if (buffer->I == 0L)
-               buffer->I = buffer->T;
-        */
 }
 
 
@@ -726,7 +745,12 @@ void bounce(struct minfo *bminfo)
 void strmsgid(char *buf, struct minfo *msginfo) {
        int i;
 
-       sprintf(buf, "%ld@%s", msginfo->I, msginfo->N);
+       strcpy(buf, msginfo->I);
+       if (strchr(buf, '@') == NULL) {
+               strcat(buf, "@");
+               strcat(buf, msginfo->N);
+       }
+
        for (i=0; i<strlen(buf); ++i) {
                if (isspace(buf[i])) {
                        strcpy(&buf[i], &buf[i+1]);
@@ -749,7 +773,7 @@ int already_received(GDBM_FILE ut, struct minfo *msginfo) {
        int retval = 0;
 
        /* We can't check for dups on a zero msgid, so just pass them through */
-       if ((msginfo->I)==0L) {
+       if (strlen(msginfo->I)==0) {
                return 0;
        }
 
@@ -825,7 +849,6 @@ void inprocess(void)
 {
        FILE *fp, *message, *testfp, *ls, *duplist;
        static struct minfo minfo;
-       struct recentmsg recentmsg;
        char tname[128], aaa[1024], iname[256], sfilename[256], pfilename[256];
        int a, b;
        int FieldID;
@@ -931,9 +954,6 @@ NXMSG:      /* Seek to the beginning of the next message */
 
                        /* process the individual mesage */
                        msgfind(tname, &minfo);
-                       strncpy(recentmsg.RMnodename, minfo.N, 9);
-                       recentmsg.RMnodename[9] = 0;
-                       recentmsg.RMnum = minfo.I;
                        syslog(LOG_NOTICE, "#%ld fm <%s> in <%s> @ <%s>",
                               minfo.I, minfo.A, minfo.O, minfo.N);
                        if (strlen(minfo.R) > 0) {
@@ -991,7 +1011,7 @@ NXMSG:     /* Seek to the beginning of the next message */
                        /* Check the use table; reject message if it's been here before */
                        if (already_received(use_table, &minfo)) {
                                syslog(LOG_NOTICE, "rejected duplicate message");
-                               fprintf(duplist, "#%ld fm <%s> in <%s> @ <%s>\n",
+                               fprintf(duplist, "#<%s> fm <%s> in <%s> @ <%s>\n",
                                        minfo.I, minfo.A, minfo.O, minfo.N);
                        }
 
index 2e0172179d20376dc17a3c67f43bfb79e42d2751..07aa686c7305c8fdebf0ebe3a69a25b233355324 100644 (file)
@@ -24,14 +24,14 @@ use uncnsrd
 phonenum US6093461224
 gdom NJ
 humannode JACS
-lastcontact 952138912 Fri Mar  3 22:01:52 2000
+lastcontact 952634224 Thu Mar  9 15:37:04 2000
 
 dogpound2
 use uncnsrd
 phonenum netproc[4026]: Adding non-neighbor system <sbn> to map
 gdom or system <sbn> to map
 humannode Dog Pound BBS II
-lastcontact 952349824 Mon Mar  6 08:37:04 2000
+lastcontact 952724225 Fri Mar 10 16:37:05 2000
 
 sbn
 use uncnsrd
@@ -66,7 +66,7 @@ use uncnsrd
 phonenum US (609) 953 8159
 gdom NJ
 humannode The Amiga Zone
-lastcontact 952138913 Fri Mar  3 22:01:53 2000
+lastcontact 952720625 Fri Mar 10 15:37:05 2000
 
 cbbs
 use uncnsrd
@@ -101,13 +101,13 @@ use uncnsrd
 phonenum netproc[4026]: Adding non-neighbor system <tesseract> to map
 gdom or system <tesseract> to map
 humannode PixelBBS
-lastcontact 952573025 Wed Mar  8 22:37:05 2000
+lastcontact 952706223 Fri Mar 10 11:37:03 2000
 
 tesseract
 bin Mail
 phonenum US 800 555 1212
 humannode Tesseract Project
-lastcontact 952573026 Wed Mar  8 22:37:06 2000
+lastcontact 952724226 Fri Mar 10 16:37:06 2000
 
 tux
 bin Mail
@@ -122,24 +122,24 @@ uncnsrd
 bin Mail
 phonenum US 914 244 3252
 humannode Uncensored
-lastcontact 952565824 Wed Mar  8 20:37:04 2000
+lastcontact 952720625 Fri Mar 10 15:37:05 2000
 
 internet
 uum %s
 humannode Internet Gateway
-lastcontact 952573026 Wed Mar  8 22:37:06 2000
+lastcontact 952724225 Fri Mar 10 16:37:05 2000
 
 bccs
 use uncnsrd
 phonenum netproc[7145]: Adding non-neighbor system <internet> to map
 gdom or system <internet> to map
 humannode BCCS
-lastcontact 952569423 Wed Mar  8 21:37:03 2000
+lastcontact 952648629 Thu Mar  9 19:37:09 2000
 
 ctestsys
 use uncnsrd
 phonenum US 612 470 9635
 gdom MN
 humannode C-86 Test System
-lastcontact 952375033 Mon Mar  6 15:37:13 2000
+lastcontact 952673825 Fri Mar 10 02:37:05 2000
 
index 99504c5842276e3a5866bad4ad115bf4b0d33627..e75ec50e34e7bc69a3cacd2a5d1b5a9282062eb3 100644 (file)
@@ -513,8 +513,7 @@ int smtp_message_delivery(struct CtdlMessage *msg) {
        msgid = CtdlSaveMsg(msg,
                "",
                SMTP_SPOOLOUT_ROOM,
-               MES_LOCAL,
-               1);
+               MES_LOCAL);
        ++successful_saves;
 
        instr = mallok(1024);
@@ -576,7 +575,7 @@ int smtp_message_delivery(struct CtdlMessage *msg) {
                imsg->cm_anon_type = MES_NORMAL;
                imsg->cm_format_type = FMT_RFC822;
                imsg->cm_fields['M'] = instr;
-               CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+               CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
                CtdlFreeMessage(imsg);
        }
 
@@ -1161,14 +1160,14 @@ void smtp_do_bounce(char *instr) {
                else {
                        bounce_msgid = CtdlSaveMsg(bmsg,
                                bounceto,
-                               "", mes_type, 1);
+                               "", mes_type);
                }
 
                /* Otherwise, go to the Aide> room */
                lprintf(9, "bounce to room?\n");
                if (bounce_msgid < 0L) bounce_msgid = CtdlSaveMsg(bmsg,
                        "", AIDEROOM,
-                       MES_LOCAL, 1);
+                       MES_LOCAL);
        }
 
        CtdlFreeMessage(bmsg);
@@ -1377,7 +1376,7 @@ void smtp_do_procmsg(long msgnum) {
                        "Content-type: %s\n\n%s\nattempted|%ld\n",
                        SPOOLMIME, instr, time(NULL) );
                phree(instr);
-               CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
+               CtdlSaveMsg(msg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL);
                CtdlFreeMessage(msg);
        }
 
@@ -1405,7 +1404,7 @@ void smtp_do_queue(void) {
        /* 
         * Go ahead and run the queue
         */
-       lprintf(5, "SMTP: processing outbound queue\n");
+       lprintf(7, "SMTP: processing outbound queue\n");
 
        if (getroom(&CC->quickroom, SMTP_SPOOLOUT_ROOM) != 0) {
                lprintf(3, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
@@ -1413,7 +1412,7 @@ void smtp_do_queue(void) {
        }
        CtdlForEachMessage(MSGS_ALL, 0L, SPOOLMIME, NULL, smtp_do_procmsg);
 
-       lprintf(5, "SMTP: queue run completed\n");
+       lprintf(7, "SMTP: queue run completed\n");
        doing_queue = 0;
 }
 
index 5ecffedf0a6f28013d06a5bf393cdde5387953b1..707cdb7b0df3259d034ce3a583b6ded949a6a816 100644 (file)
@@ -411,7 +411,7 @@ void vcard_purge(char *username, long usernum) {
 
        msg->cm_fields['S'] = strdoop("CANCEL");
 
-        CtdlSaveMsg(msg, "", ADDRESS_BOOK_ROOM, MES_LOCAL, 1);
+        CtdlSaveMsg(msg, "", ADDRESS_BOOK_ROOM, MES_LOCAL);
         CtdlFreeMessage(msg);
 
        /* Start a netproc run in the background, so the "purge" message