]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / msgbase.c
index c3e946e45ca8a5c005b86d60668e9d8fa43a7c37..a125d01e36d9bed841a1732550c5c529c2a037b3 100644 (file)
@@ -116,6 +116,15 @@ char *msgkeys[] = {
        NULL    /* Z */
 };
 
+void CtdlMsgSetCM_Fields(struct CtdlMessage *Msg, const char which, const char *buf, long length)
+{
+       if (Msg->cm_fields[which] != NULL)
+               free (Msg->cm_fields[which]);
+       Msg->cm_fields[which] = malloc(length + 1);
+       memcpy(Msg->cm_fields[which], buf, length);
+       Msg->cm_fields[which][length] = '\0';
+}
+
 /*
  * This function is self explanatory.
  * (What can I say, I'm in a weird mood today...)
@@ -1335,7 +1344,7 @@ struct CtdlMessage * CtdlDuplicateMessage(struct CtdlMessage *OrgMsg)
        if (NewMsg == NULL)
                return NULL;
 
-       memcpy(NewMsg, OrgMsg, sizeof(struct CtdlMessage *));
+       memcpy(NewMsg, OrgMsg, sizeof(struct CtdlMessage));
 
        memset(&NewMsg->cm_fields, 0, sizeof(char*) * 256);