From 38283b2e20d9d5791c844eb23d24d44e0cd3a481 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 20 Oct 2009 21:46:11 +0000 Subject: [PATCH] * Abuse the MIME 'filename' key by using it as a memo field in which we store a base64-encoded set of metadata for each wiki edit. --- citadel/modules/wiki/serv_wiki.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index c41fb12d0..9a8b7caab 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -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 ); -- 2.30.2