StrBuf *FoundCharset,
StrBuf **Error)
{
- wcsession *WCC = WC;
StrBuf *Buf;
StrBuf *HdrToken;
headereval *Hdr;
StrBufExtract_token(HdrToken, Buf, 0, '=');
StrBufCutLeft(Buf, StrLength(HdrToken) + 1);
-#ifdef TECH_PREVIEW
- if (dbg_analyze_msg) lprintf(1, ":: [%s] = [%s]\n", ChrPtr(HdrToken), ChrPtr(Buf));
-#endif
/* look up one of the examine_* functions to parse the content */
if (GetHash(MsgHeaderHandler, SKEY(HdrToken), &vHdr) &&
(vHdr != NULL)) {
StrBufExtract_token(HdrToken, Buf, 0, ':');
if (StrLength(HdrToken) > 0) {
StrBufCutLeft(Buf, StrLength(HdrToken) + 1);
-#ifdef TECH_PREVIEW
- if (dbg_analyze_msg) lprintf(1, ":: [%s] = [%s]\n", ChrPtr(HdrToken), ChrPtr(Buf));
-#endif
/* the examine*'s know how to do with mime headers too... */
if (GetHash(MsgHeaderHandler, SKEY(HdrToken), &vHdr) &&
(vHdr != NULL)) {
/* now we put the body mimepart we read above into the mimelist */
Put(Msg->AllAttach, SKEY(Msg->MsgBody->PartNum), Msg->MsgBody, DestroyMime);
- /* Generate a reply-to address */
- if (StrLength(Msg->Rfca) > 0) {
- if (Msg->reply_to == NULL)
- Msg->reply_to = NewStrBuf();
- if (StrLength(Msg->from) > 0) {
- StrBufPrintf(Msg->reply_to, "%s <%s>", ChrPtr(Msg->from), ChrPtr(Msg->Rfca));
- }
- else {
- FlushStrBuf(Msg->reply_to);
- StrBufAppendBuf(Msg->reply_to, Msg->Rfca, 0);
- }
- }
- else
- {
- if ((StrLength(Msg->OtherNode)>0) &&
- (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_nodename))) &&
- (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_humannode)) ))
- {
- if (Msg->reply_to == NULL)
- Msg->reply_to = NewStrBuf();
- StrBufPrintf(Msg->reply_to,
- "%s @ %s",
- ChrPtr(Msg->from),
- ChrPtr(Msg->OtherNode));
- }
- else {
- if (Msg->reply_to == NULL)
- Msg->reply_to = NewStrBuf();
- FlushStrBuf(Msg->reply_to);
- StrBufAppendBuf(Msg->reply_to, Msg->from, 0);
- }
- }
FreeStrBuf(&Buf);
FreeStrBuf(&HdrToken);
return 1;
Msg = (message_summary*)malloc(sizeof(message_summary));
memset(Msg, 0, sizeof(message_summary));
while (len = StrBuf_ServGetln(Buf),
+ (len >= 0) &&
((len != 3) ||
- strcmp(ChrPtr(Buf), "000")== 0)){
+ strcmp(ChrPtr(Buf), "000")))
+ {
buf = ChrPtr(Buf);
ebuf = strchr(ChrPtr(Buf), '=');
nBuf = ebuf - buf;
StrBufCutLeft(Buf, nBuf + 1);
Eval->f(Msg, Buf);
}
- else lprintf(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
+ else syslog(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
}
return Msg;
}
return (Stat->nummsgs);
}
Buf2 = NewStrBuf();
- while (len = StrBuf_ServGetln(Buf), ((len != 3) || strcmp(ChrPtr(Buf), "000")!= 0))
+ while (len = StrBuf_ServGetln(Buf),
+ ((len >= 0) &&
+ ((len != 3) ||
+ strcmp(ChrPtr(Buf), "000")!= 0)))
{
if (Stat->nummsgs < Stat->maxload) {
skipit = 0;
text_to_server_qp(txtmail); /* Transmit message in quoted-printable encoding */
free(txtmail);
- serv_printf("--%s", alt_boundary);
+ serv_printf("\n--%s", alt_boundary);
}
serv_puts("Content-type: text/html; charset=utf-8");
if (GetServerStatus(Buf, NULL) != 2) {
/* You probably don't even have a dumb Drafts folder */
StrBufCutLeft(Buf, 4);
- lprintf(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
+ syslog(9, "%s:%d: server save to drafts error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
StrBufAppendBufPlain(WCC->ImportantMsg, _("Saved to Drafts failed: "), -1, 0);
StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
display_enter();
}
else
{
- lprintf(9, "%s\n", ChrPtr(CmdBuf));
+ syslog(9, "%s\n", ChrPtr(CmdBuf));
serv_puts(ChrPtr(CmdBuf));
FreeStrBuf(&CmdBuf);
} else {
StrBufCutLeft(Buf, 4);
- lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
+ syslog(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
StrBufAppendBuf(WCC->ImportantMsg, Buf, 0);
if (save_to_drafts) gotoroom(WCC->CurRoom.name);
display_enter();
void *v;
wc_mime_attachment *att;
- lprintf(9, "upload_attachment()\n");
+ syslog(9, "upload_attachment()\n");
wc_printf("upload_attachment()<br>\n");
if (WCC->upload_length <= 0) {
- lprintf(9, "ERROR no attachment was uploaded\n");
+ syslog(9, "ERROR no attachment was uploaded\n");
wc_printf("ERROR no attachment was uploaded<br>\n");
return;
}
- lprintf(9, "Client is uploading %d bytes\n", WCC->upload_length);
+ syslog(9, "Client is uploading %d bytes\n", WCC->upload_length);
wc_printf("Client is uploading %d bytes<br>\n", WCC->upload_length);
att = malloc(sizeof(wc_mime_attachment));
memset(att, 0, sizeof(wc_mime_attachment ));
return;
}
+
+ /*
+ * If the "replying_to" variable is set, it refers to a message
+ * number from which we must extract some header fields...
+ */
+ long replying_to = lbstr("replying_to");
+ if (replying_to > 0) {
+ char wefw[1024] = "";
+ char msgn[1024] = "";
+ serv_printf("MSG0 %ld|1", replying_to);
+ serv_getln(buf, sizeof buf);
+ if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
+
+ if ( (!strncasecmp(buf, "subj=", 5)) && (strlen(buf) > 5) ) {
+ StrBuf *subj = NewStrBuf();
+ if (strncasecmp(&buf[5], "Re:", 3)) {
+ StrBufAppendBufPlain(subj, HKEY("Re: "), 0);
+ }
+ StrBufAppendBufPlain(subj, &buf[5], -1, 0);
+ PutBstr(HKEY("subject"), subj);
+ }
+
+ else if (!strncasecmp(buf, "wefw=", 5)) {
+ safestrncpy(wefw, &buf[5], sizeof wefw);
+
+ /* Trim down excessively long lists of thread references. We eliminate the
+ * second one in the list so that the thread root remains intact.
+ */
+ int rrtok = num_tokens(wefw, '|');
+ int rrlen = strlen(wefw);
+ if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) {
+ remove_token(wefw, 1, '|');
+ }
+ }
+
+ else if (!strncasecmp(buf, "msgn=", 5)) {
+ safestrncpy(msgn, &buf[5], sizeof msgn);
+ }
+
+ }
+
+ if (strlen(wefw) + strlen(msgn) > 0) {
+ StrBuf *refs = NewStrBuf();
+ if (!IsEmptyStr(wefw)) {
+ StrBufAppendBufPlain(refs, wefw, -1, 0);
+ }
+ if ( (!IsEmptyStr(wefw)) && (!IsEmptyStr(msgn)) ) {
+ StrBufAppendBufPlain(refs, HKEY("|"), 0);
+ }
+ if (!IsEmptyStr(msgn)) {
+ StrBufAppendBufPlain(refs, msgn, -1, 0);
+ }
+ PutBstr(HKEY("references"), refs);
+ }
+ }
+
/*
* Otherwise proceed normally.
* Do a custom room banner with no navbar...