NSYN: fix the NSYN command
[citadel.git] / citadel / modules / network / serv_netmail.c
index dac000efc8527477b2cc6b0185f1ccd2c75f70b3..5713ea82ac00b1ee2f8feba851daa780a88a7ea9 100644 (file)
@@ -320,26 +320,8 @@ void network_process_list(SpoolControl *sc, struct CtdlMessage *omsg, long *dele
 
        msg = CtdlDuplicateMessage(omsg);
 
-       if (msg->cm_fields['K'] != NULL)
-               free(msg->cm_fields['K']);
-       if (msg->cm_fields['V'] == NULL){
-               /* local message, no enVelope */
-               StrBuf *Buf;
-               Buf = NewStrBuf();
-               StrBufAppendBufPlain(Buf,
-                                    msg->cm_fields['O']
-                                    , -1, 0);
-               StrBufAppendBufPlain(Buf, HKEY("@"), 0);
-               StrBufAppendBufPlain(Buf, config.c_fqdn, -1, 0);
-
-               msg->cm_fields['K'] = SmashStrBuf(&Buf);
-       }
-       else {
-               msg->cm_fields['K'] =
-                       strdup (msg->cm_fields['V']);
-       }
 
-       CtdlMsgSetCM_Fields(msg, 'F', SKEY(sc->Users[roommailalias]));
+       CtdlMsgSetCM_Fields(msg, 'K', SKEY(sc->Users[roommailalias]));
 
        /* if there is no other recipient, Set the recipient
         * of the list message to the email address of the
@@ -544,7 +526,7 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long
                        }
                        
                        QN_syslog(LOG_INFO,
-                                 "%sSending to %s\n",
+                                 " %sSending to %s\n",
                                  (send)?"":"Not ",
                                  ChrPtr(Recipient));
                }
@@ -618,6 +600,7 @@ void network_process_ignetpush(SpoolControl *sc, struct CtdlMessage *omsg, long
 void network_spool_msg(long msgnum,
                       void *userdata)
 {
+       struct CitContext *CCC = CC;
        struct CtdlMessage *msg = NULL;
        long delete_after_send = 0;     /* Set to 1 to delete after spooling */
        SpoolControl *sc;
@@ -626,6 +609,13 @@ void network_spool_msg(long msgnum,
 
        msg = CtdlFetchMessage(msgnum, 1);
 
+       if (msg == NULL)
+       {
+               QN_syslog(LOG_ERR,
+                         "failed to load Message <%ld> from disk\n",
+                         msgnum);
+               return;
+       }
        network_process_list(sc, msg, &delete_after_send);
        network_process_digest(sc, msg, &delete_after_send);
        network_process_participate(sc, msg, &delete_after_send);