return 1;
}
+void CtdlFreeMessageContents(struct CtdlMessage *msg)
+{
+ int i;
+ for (i = 0; i < 256; ++i)
+ if (msg->cm_fields[i] != NULL) {
+ free(msg->cm_fields[i]);
+ }
+
+ msg->cm_magic = 0; /* just in case */
+}
/*
* 'Destructor' for struct CtdlMessage
*/
void CtdlFreeMessage(struct CtdlMessage *msg)
{
- int i;
-
if (is_valid_message(msg) == 0)
{
if (msg != NULL) free (msg);
return;
}
-
- for (i = 0; i < 256; ++i)
- if (msg->cm_fields[i] != NULL) {
- free(msg->cm_fields[i]);
- }
-
- msg->cm_magic = 0; /* just in case */
+ CtdlFreeMessageContents(msg);
free(msg);
}
ptr = html_to_ascii(content, length, 80, 0);
wlen = strlen(ptr);
client_write(ptr, wlen);
- if (ptr[wlen-1] != '\n') {
+ if ((wlen > 0) && (ptr[wlen-1] != '\n')) {
cprintf("\n");
}
free(ptr);
}
else {
syslog(LOG_DEBUG, "No user <%s>\n", recipient);
- CtdlSaveMsgPointerInRoom(config.c_aideroom,
- newmsgid, 0, msg);
+ CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
}
}
/* Perform "after save" hooks */
syslog(LOG_DEBUG, "Performing after-save hooks\n");
+ if (msg->cm_fields['3'] != NULL) free(msg->cm_fields['3']);
+ msg->cm_fields['3'] = malloc(20);
+ snprintf(msg->cm_fields['3'], 20, "%ld", newmsgid);
PerformMessageHooks(msg, EVT_AFTERSAVE);
+ free(msg->cm_fields['3']);
+ msg->cm_fields['3'] = NULL;
/* For IGnet mail, we have to save a new copy into the spooler for
* each recipient, with the R and D fields set to the recipient and
{
if (StrLength(CCC->StatusMessage)>0)
{
- StrBufAppendBufPlain(CCC->StatusMessage, HKEY("\n"), 0);
+ StrBufAppendBufPlain(CCC->StatusMessage, HKEY("\n000\n"), 0);
cputbuf(CCC->StatusMessage);
}
else
- client_write(HKEY("\n"));
+ client_write(HKEY("\n000\n"));
}
if (do_confirm) {