]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
Added message-id to the list of fields CtdlOutputMsg() can potentially return to...
[citadel.git] / citadel / msgbase.c
index e81d14623cb314b9c44c6ebffb5fd88cbecc5539..4c1bd70ed2bdb2fedc8c1579e5c3a0f313909798 100644 (file)
@@ -1153,8 +1153,12 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body)
                        }
                        field_header = *mptr++;
                }
+               if (mptr >= upper_bound) {
+                       break;
+               }
                which = field_header;
                len = strlen(mptr);
+
                CM_SetField(ret, which, mptr, len);
 
                mptr += len + 1;        /* advance to next field */
@@ -1517,14 +1521,15 @@ int check_cached_msglist(long msgnum) {
  * 
  */
 int CtdlOutputMsg(long msg_num,                /* message number (local) to fetch */
-                 int mode,             /* how would you like that message? */
-                 int headers_only,     /* eschew the message body? */
-                 int do_proto,         /* do Citadel protocol responses? */
-                 int crlf,             /* Use CRLF newlines instead of LF? */
-                 char *section,        /* NULL or a message/rfc822 section */
-                 int flags,            /* various flags; see msgbase.h */
-                 char **Author,
-                 char **Address
+               int mode,               /* how would you like that message? */
+               int headers_only,       /* eschew the message body? */
+               int do_proto,           /* do Citadel protocol responses? */
+               int crlf,               /* Use CRLF newlines instead of LF? */
+               char *section,          /* NULL or a message/rfc822 section */
+               int flags,              /* various flags; see msgbase.h */
+               char **Author,
+               char **Address,
+               char **MessageID
 ) {
        struct CitContext *CCC = CC;
        struct CtdlMessage *TheMessage = NULL;
@@ -1612,6 +1617,11 @@ int CtdlOutputMsg(long msg_num,          /* message number (local) to fetch */
                        long len;
                        CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
                }
+               if ((MessageID != NULL) && (*MessageID == NULL))
+               {       
+                       long len;
+                       CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+               }
                CM_Free(TheMessage);
                TheMessage = NULL;
 
@@ -1651,6 +1661,11 @@ int CtdlOutputMsg(long msg_num,          /* message number (local) to fetch */
                long len;
                CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
        }
+       if ((MessageID != NULL) && (*MessageID == NULL))
+       {       
+               long len;
+               CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+       }
 
        CM_Free(TheMessage);
 
@@ -2765,7 +2780,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        MSG_syslog(LOG_INFO, "Final selection: %s (%s)\n", actual_rm, room);
        if (strcasecmp(actual_rm, CCC->room.QRname)) {
                /* CtdlGetRoom(&CCC->room, actual_rm); */
-               CtdlUserGoto(actual_rm, 0, 1, NULL, NULL);
+               CtdlUserGoto(actual_rm, 0, 1, NULL, NULL, NULL, NULL);
        }
 
        /*
@@ -2912,7 +2927,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        /* Go back to the room we started from */
        MSG_syslog(LOG_DEBUG, "Returning to original room %s\n", hold_rm);
        if (strcasecmp(hold_rm, CCC->room.QRname))
-               CtdlUserGoto(hold_rm, 0, 1, NULL, NULL);
+               CtdlUserGoto(hold_rm, 0, 1, NULL, NULL, NULL, NULL);
 
        /*
         * Any addresses to harvest for someone's address book?