projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3b5fe37
)
* Changed my mind about the on-disk format for wiki history. DELETE ANY WIKI ROOMS...
author
Art Cancro
<ajc@citadel.org>
Fri, 16 Oct 2009 20:58:22 +0000
(20:58 +0000)
committer
Art Cancro
<ajc@citadel.org>
Fri, 16 Oct 2009 20:58:22 +0000
(20:58 +0000)
citadel/modules/wiki/serv_wiki.c
patch
|
blob
|
history
diff --git
a/citadel/modules/wiki/serv_wiki.c
b/citadel/modules/wiki/serv_wiki.c
index 65c3a0968731c9fac9ba3693db54f462a532d660..2cab57586d9bcf5c99517b7fd410056557a33d65 100644
(file)
--- a/
citadel/modules/wiki/serv_wiki.c
+++ b/
citadel/modules/wiki/serv_wiki.c
@@
-77,7
+77,7
@@
int wiki_upload_beforesave(struct CtdlMessage *msg) {
int rv;
char history_page[1024];
char boundary[256];
int rv;
char history_page[1024];
char boundary[256];
- char
endary[260
];
+ char
prefixed_boundary[258
];
char buf[1024];
int nbytes = 0;
char *diffbuf = NULL;
char buf[1024];
int nbytes = 0;
char *diffbuf = NULL;
@@
-152,8
+152,8
@@
int wiki_upload_beforesave(struct CtdlMessage *msg) {
diffbuf = NULL;
snprintf(diff_cmd, sizeof diff_cmd,
"diff -u %s %s",
diffbuf = NULL;
snprintf(diff_cmd, sizeof diff_cmd,
"diff -u %s %s",
-
((old_msg != NULL) ? diff_old_filename : "/dev/null")
,
- diff_new_filename
+
diff_new_filename
,
+ ((old_msg != NULL) ? diff_old_filename : "/dev/null")
);
fp = popen(diff_cmd, "r");
if (fp != NULL) {
);
fp = popen(diff_cmd, "r");
if (fp != NULL) {
@@
-243,26
+243,30
@@
int wiki_upload_beforesave(struct CtdlMessage *msg) {
}
} while ( (IsEmptyStr(boundary)) && (*ptr != 0) );
}
} while ( (IsEmptyStr(boundary)) && (*ptr != 0) );
+ /* Now look for the first boundary. That is where we need to insert our fun.
+ */
if (!IsEmptyStr(boundary)) {
if (!IsEmptyStr(boundary)) {
- snprintf(
endary, sizeof endary, "--%s--
", 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
);
history_msg->cm_fields['M'] = realloc(history_msg->cm_fields['M'],
strlen(history_msg->cm_fields['M']) + strlen(diffbuf) + 512
);
- ptr = bmstrcasestr(history_msg->cm_fields['M'],
e
ndary);
+ ptr = bmstrcasestr(history_msg->cm_fields['M'],
prefixed_bou
ndary);
if (ptr != NULL) {
if (ptr != NULL) {
+ char *the_rest_of_it = strdup(ptr);
sprintf(ptr, "--%s\n"
"Content-type: text/plain\n"
"From: %s <%s>\n"
"\n"
"%s\n"
sprintf(ptr, "--%s\n"
"Content-type: text/plain\n"
"From: %s <%s>\n"
"\n"
"%s\n"
- "
--%s--\n
"
+ "
%s
"
,
boundary,
CCC->user.fullname,
CCC->cs_inet_email,
diffbuf,
,
boundary,
CCC->user.fullname,
CCC->cs_inet_email,
diffbuf,
- boundary
+ the_rest_of_it
);
);
+ free(the_rest_of_it);
}
history_msg->cm_fields['T'] = realloc(history_msg->cm_fields['T'], 32);
}
history_msg->cm_fields['T'] = realloc(history_msg->cm_fields['T'], 32);