Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 12 Sep 2013 20:59:03 +0000 (22:59 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 12 Sep 2013 20:59:03 +0000 (22:59 +0200)
Conflicts:
citadel/modules/network/serv_network.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/smtp/smtp_util.c

1  2 
citadel/modules/network/serv_netspool.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/smtp/smtp_util.c

@@@ -290,6 -290,6 +290,8 @@@ int rss_format_item(AsyncIO *IO, networ
                return 0;
        }
  
++      memset(&SaveMsg->Msg, 0, sizeof (struct CtdlMessage));
++
        if (SaveMsg->author_or_creator != NULL) {
  
                char *From;
@@@ -842,13 -856,27 +859,19 @@@ void smtp_data(long offset, long flags
                        return;
                }
  
-               CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
 -              if (msg->cm_fields['A'] != NULL) free(msg->cm_fields['A']);
 -              if (msg->cm_fields['N'] != NULL) free(msg->cm_fields['N']);
 -              if (msg->cm_fields['H'] != NULL) free(msg->cm_fields['H']);
 -              if (msg->cm_fields['O'] != NULL) free(msg->cm_fields['O']);
 -              msg->cm_fields['N'] = strdup(config.c_nodename);
 -              msg->cm_fields['H'] = strdup(config.c_humannode);
 -              msg->cm_fields['O'] = strdup(MAILROOM);
 -
 -              msg->cm_fields['A'] =
 -                      ((sSMTP->preferred_sender_name != NULL)
 -                      ? strdup(ChrPtr(sSMTP->preferred_sender_name)) 
 -                      : strdup(CCC->user.fullname)
 -              );
 +              CM_SetField(msg, eNodeName, config.c_nodename, strlen(config.c_nodename));
 +              CM_SetField(msg, eHumanNode, config.c_humannode, strlen(config.c_humannode));
 +              CM_SetField(msg, eOriginalRoom, HKEY(MAILROOM));
++              if (sSMTP->preferred_sender_name != NULL)
++                      CM_SetFieldSB(msg, eAuthor, sSMTP->preferred_sender_name);
++              else 
++                      CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
  
                if (!validemail) {
-                       CM_SetField(msg, erFc822Addr, CCC->cs_inet_email, strlen(CCC->cs_inet_email));
 -                      if (msg->cm_fields['F'] != NULL) free(msg->cm_fields['F']);
 -                      msg->cm_fields['F'] = 
 -                              ((sSMTP->preferred_sender_email != NULL)
 -                              ? strdup(ChrPtr(sSMTP->preferred_sender_email)) 
 -                              : strdup(CCC->cs_inet_email)
 -                      );
++                      if((sSMTP->preferred_sender_email != NULL)
++                              CM_SetFieldSB(msg, erFc822Addr, sSMTP->preferred_sender_email)) 
++                      else
++                              CM_SetField(msg, erFc822Addr, CCC->cs_inet_email, strlen(CCC->cs_inet_email));
                }
        }
  
@@@ -286,7 -286,9 +286,8 @@@ void smtp_do_bounce(char *instr, StrBu
        StrBufAppendBufPlain(BounceMB, HKEY("--"), 0);
        StrBufAppendBuf(BounceMB, boundary, 0);
        StrBufAppendBufPlain(BounceMB, HKEY("--\r\n"), 0);
 -      if (bmsg->cm_fields['M'] != NULL)
 -              free(bmsg->cm_fields['M']);
 -      bmsg->cm_fields['M'] = SmashStrBuf(&BounceMB);
 +      CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB);
++
        /* Deliver the bounce if there's anything worth mentioning */
        syslog(LOG_DEBUG, "num_bounces = %d\n", num_bounces);
        if (num_bounces > 0) {