* Abuse the MIME 'filename' key by using it as a memo field in which we store a base6...
authorArt Cancro <ajc@citadel.org>
Tue, 20 Oct 2009 21:46:11 +0000 (21:46 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 20 Oct 2009 21:46:11 +0000 (21:46 +0000)
citadel/modules/wiki/serv_wiki.c

index c41fb12d073cfb993c005939ea883dd329847e3c..9a8b7caab7b50a2506e0eeed8ac6ac676ecf5765 100644 (file)
@@ -247,21 +247,29 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) {
        if (!IsEmptyStr(boundary)) {
                snprintf(prefixed_boundary, sizeof prefixed_boundary, "--%s", boundary);
                history_msg->cm_fields['M'] = realloc(history_msg->cm_fields['M'],
-                       strlen(history_msg->cm_fields['M']) + strlen(diffbuf) + 512
+                       strlen(history_msg->cm_fields['M']) + strlen(diffbuf) + 1024
                );
                ptr = bmstrcasestr(history_msg->cm_fields['M'], prefixed_boundary);
                if (ptr != NULL) {
                        char *the_rest_of_it = strdup(ptr);
+                       char memo[512];
+                       char encoded_memo[768];
+                       snprintf(memo, sizeof memo, "%s|%s|%ld", 
+                               CCC->user.fullname,
+                               CCC->cs_inet_email,
+                               time(NULL)
+                       );
+                       CtdlEncodeBase64(encoded_memo, memo, strlen(memo), 0);
                        sprintf(ptr, "--%s\n"
                                        "Content-type: text/plain\n"
-                                       "From: %s <%s>\n"
+                                       "Content-Disposition: inline; filename=\"%s\"\n"
+                                       "Content-Transfer-Encoding: 8bit\n"
                                        "\n"
                                        "%s\n"
                                        "%s"
                                        ,
                                boundary,
-                               CCC->user.fullname,
-                               CCC->cs_inet_email,
+                               encoded_memo,
                                diffbuf,
                                the_rest_of_it
                        );