typedef void (*MsgPartEvaluatorFunc)(message_summary *Sum, StrBuf *Buf);
+typedef struct _MsgPartEvaluatorStruct {
+ MsgPartEvaluatorFunc f;
+}MsgPartEvaluatorStruct;
/*----------------------------------------------------------------------------*/
int state=0;
long len;
const char *Key;
+ WCTemplputParams SubTP;
Buf = NewStrBuf();
lprintf(1, "----------%s---------MSG4 %ld|%s--------------\n", tmpl, msgnum, ChrPtr(PartNum));
if (Msg->MsgBody->size_known > 0) {
StrBuf_ServGetBLOB(Msg->MsgBody->Data, Msg->MsgBody->length);
state ++;
- /// todo: check next line, if not 000, append following lines
+ /*/ todo: check next line, if not 000, append following lines */
}
else if (1){
if (StrLength(Msg->MsgBody->Data) > 0)
/* look up the renderer, that will convert this mimeitem into the htmlized form */
if (GetHash(MimeRenderHandler, SKEY(Buf), &vHdr) &&
(vHdr != NULL)) {
- RenderMimeFunc Render;
- Render = (RenderMimeFunc)vHdr;
- Render(Msg->MsgBody, NULL, FoundCharset);
+ RenderMimeFuncStruct *Render;
+ Render = (RenderMimeFuncStruct*)vHdr;
+ Render->f(Msg->MsgBody, NULL, FoundCharset);
}
if (StrLength(Msg->reply_references)> 0) {
else
{
if ((StrLength(Msg->OtherNode)>0) &&
- (strcasecmp(ChrPtr(Msg->OtherNode), serv_info.serv_nodename)) &&
- (strcasecmp(ChrPtr(Msg->OtherNode), serv_info.serv_humannode)) )
+ (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(serv_info.serv_nodename))) &&
+ (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(serv_info.serv_humannode)) ))
{
if (Msg->reply_to == NULL)
Msg->reply_to = NewStrBuf();
evaluate_mime_part(Msg, Mime);
}
DeleteHashPos(&it);
-
- DoTemplate(tmpl, tmpllen, Target, Msg, CTX_MAILSUM);
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_MAILSUM;
+ SubTP.Context = Msg;
+ DoTemplate(tmpl, tmpllen, Target, &SubTP);
DestroyMessageSummary(Msg);
FreeStrBuf(&FoundCharset);
message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSubject, long MsgNum)
{
void *vEval;
- MsgPartEvaluatorFunc Eval;
+ MsgPartEvaluatorStruct *Eval;
message_summary *Msg;
StrBuf *Buf;
const char *buf;
ebuf = strchr(ChrPtr(Buf), '=');
nBuf = ebuf - buf;
if (GetHash(MsgEvaluators, buf, nBuf, &vEval) && vEval != NULL) {
- Eval = (MsgPartEvaluatorFunc) vEval;
+ Eval = (MsgPartEvaluatorStruct*) vEval;
StrBufCutLeft(Buf, nBuf + 1);
- Eval(Msg, Buf);
+ Eval->f(Msg, Buf);
}
else lprintf(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
}
FreeStrBuf(&Buf);
return (nummsgs);
}
-// TODO if (with_headers) { //// TODO: Have Attachments?
Buf2 = NewStrBuf();
while (len = StrBuf_ServGetln(Buf),
((len != 3) ||
StrBufExtract_token(Buf2, Buf, 3, '|');
if ((StrLength(Buf2) !=0 ) &&
( ((WCC->room_flags & QR_NETWORK)
- || ((strcasecmp(ChrPtr(Buf2), serv_info.serv_nodename)
- && (strcasecmp(ChrPtr(Buf2), serv_info.serv_fqdn)))))))
+ || ((strcasecmp(ChrPtr(Buf2), ChrPtr(serv_info.serv_nodename))
+ && (strcasecmp(ChrPtr(Buf2), ChrPtr(serv_info.serv_fqdn))))))))
{
StrBufAppendBufPlain(Msg->from, HKEY(" @ "), 0);
StrBufAppendBuf(Msg->from, Buf2, 0);
int nItems;
HashPos *At;
long vector[16];
+ WCTemplputParams SubTP;
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_LONGVECTOR;
+ SubTP.Context = &vector;
TmpBuf = NewStrBuf();
At = GetNewHashPos(WCC->summ, nMessages);
nItems = GetCount(WCC->summ);
vector[6] = lo;
FlushStrBuf(TmpBuf);
dbg_print_longvector(vector);
- DoTemplate(HKEY("select_messageindex"), TmpBuf, &vector, CTX_LONGVECTOR);
+ DoTemplate(HKEY("select_messageindex"), TmpBuf, &SubTP);
StrBufAppendBuf(Selector, TmpBuf, 0);
}
vector[6] = 0;
vector[1] = lbstr("maxmsgs") == 9999999;
vector[2] = 0;
dbg_print_longvector(vector);
- DoTemplate(HKEY("select_messageindex_all"), TmpBuf, &vector, CTX_LONGVECTOR);
+ DoTemplate(HKEY("select_messageindex_all"), TmpBuf, &SubTP);
StrBufAppendBuf(Selector, TmpBuf, 0);
FreeStrBuf(&TmpBuf);
DeleteHashPos(&At);
message_summary *Msg;
const char *HashKey;
long HKLen;
- StrBuf *OldMsg = NewStrBuf();;
- wcsession *WCC = WC;
HashPos *at;
void *vMsg;
+ StrBuf *OldMsg;
+ wcsession *WCC = WC;
+ OldMsg = NewStrBuf();
serv_puts("GTSN");
StrBuf_ServGetln(OldMsg);
- if (ChrPtr(OldMsg)[0] == '2') {
+ if (GetServerStatus(OldMsg, NULL) == 2) {
StrBufCutLeft(OldMsg, 4);
}
else {
int load_seen = 0;
int sortit = 0;
int defaultsortorder = 0;
+ WCTemplputParams SubTP;
if (havebstr("is_summary") && (1 == (ibstr("is_summary"))))
WCC->wc_view = VIEW_MAILBOX;
switch (WCC->wc_view) {
case VIEW_WIKI:
- sprintf(buf, "wiki?room=%s&page=home", WCC->wc_roomname);
+ sprintf(buf, "wiki?room=%s&page=home", ChrPtr(WCC->wc_roomname));
http_redirect(buf);
return;
case VIEW_CALBRIEF:
if (sortit) {
CompareFunc SortIt;
- SortIt = RetrieveSort(CTX_MAILSUM, NULL,
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_NONE;
+ SubTP.Context = NULL;
+ SortIt = RetrieveSort(&SubTP, NULL,
HKEY("date"), defaultsortorder);
if (SortIt != NULL)
SortByPayload(WCC->summ, SortIt);
maxmsgs = abs(maxmsgs);
}
- DoTemplate(HKEY("msg_listselector_top"), BBViewToolBar, MessageDropdown, CTX_STRBUF);
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_STRBUF;
+ SubTP.Context = MessageDropdown;
+ DoTemplate(HKEY("msg_listselector_top"), BBViewToolBar, &SubTP);
StrBufAppendBuf(WCC->WBuf, BBViewToolBar, 0);
FlushStrBuf(BBViewToolBar);
break;
addrbook[num_ab-1].ab_msgnum = Msg->msgnum;
break;
case VIEW_MAILBOX: /* here we just need the abstract, so render it now. */
- DoTemplate(HKEY("section_mailsummary"), NULL, Msg, CTX_MAILSUM);
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_MAILSUM;
+ SubTP.Context = Msg;
+ DoTemplate(HKEY("section_mailsummary"), NULL, &SubTP);
num_displayed++;
break;
free(displayed_msgs);
displayed_msgs = NULL;
}
- DoTemplate(HKEY("msg_listselector_bottom"), BBViewToolBar, MessageDropdown, CTX_STRBUF);
+ memset(&SubTP, 0, sizeof(WCTemplputParams));
+ SubTP.ContextType = CTX_STRBUF;
+ SubTP.Context = MessageDropdown;
+ DoTemplate(HKEY("msg_listselector_bottom"), BBViewToolBar, &SubTP);
StrBufAppendBuf(WCC->WBuf, BBViewToolBar, 0);
FreeStrBuf(&BBViewToolBar);
char *txtmail = NULL;
sprintf(top_boundary, "Citadel--Multipart--%s--%04x--%04x",
- serv_info.serv_fqdn,
+ ChrPtr(serv_info.serv_fqdn),
getpid(),
++seq
);
sprintf(alt_boundary, "Citadel--Multipart--%s--%04x--%04x",
- serv_info.serv_fqdn,
+ ChrPtr(serv_info.serv_fqdn),
getpid(),
++seq
);
wcsession *WCC = WC;
if (havebstr("force_room")) {
- gotoroom(bstr("force_room"));
+ gotoroom(sbstr("force_room"));
}
if (havebstr("display_name")) {
const StrBuf *Bcc = NULL;
const StrBuf *Wikipage = NULL;
const StrBuf *my_email_addr = NULL;
- StrBuf *CmdBuf = NULL;;
+ StrBuf *CmdBuf = NULL;
StrBuf *references = NULL;
if (havebstr("references"))
now = time(NULL);
if (havebstr("force_room")) {
- gotoroom(bstr("force_room"));
+ gotoroom(sbstr("force_room"));
}
display_name = sbstr("display_name");
* message" command really means "add new entry."
*/
if (WCC->wc_default_view == VIEW_ADDRESSBOOK) {
- do_edit_vcard(-1, "", "", WCC->wc_roomname);
+ do_edit_vcard(-1, "", "", ChrPtr(WCC->wc_roomname));
return;
}
const StrBuf *Cc = NULL;
const StrBuf *Bcc = NULL;
const StrBuf *Wikipage = NULL;
- StrBuf *CmdBuf = NULL;;
+ StrBuf *CmdBuf = NULL;
const char CMD[] = "ENT0 0|%s|%d|0||%s||%s|%s|%s";
Recp = sbstr("recp");
}
}
else if (buf[0] != '2') { /** Any other error means that we cannot continue */
- wprintf("<em>%s</em><br />\n", &buf[4]);/// -> important message
+ wprintf("<em>%s</em><br />\n", &buf[4]);/*TODO -> important message */
return;
}
}
begin_burst();
output_headers(1, 0, 0, 0, 1, 0);
- DoTemplate(HKEY("edit_message"), NULL, NULL, CTX_NONE);
+ DoTemplate(HKEY("edit_message"), NULL, &NoCtx);
end_burst();
return;
{
char buf[SIZ];
off_t bytes;
-//// TODO: is there a chance the contenttype is different to the one we know?
+/* TODO: is there a chance the contenttype is different to the one we know? */
+ lprintf(9, "< DLAT %ld|%s\n", Mime->msgnum, ChrPtr(Mime->PartNum)); // FIXME temporary, remove
serv_printf("DLAT %ld|%s", Mime->msgnum, ChrPtr(Mime->PartNum));
serv_getln(buf, sizeof buf);
+ lprintf(9, "> %s\n", buf); // FIXME temporary, remove
if (buf[0] == '6') {
bytes = extract_long(&buf[4], 0);
}
else {
FlushStrBuf(Mime->Data);
- /// TODO XImportant message
+ /* TODO XImportant message */
}
}
InitModule_MSG
(void)
{
+ RegisterPreference(HKEY("use_sig"),
+ _("Attach signature to email messages?"),
+ PRF_YESNO,
+ NULL);
+ RegisterPreference(HKEY("signature"), _("Use this signature:"), PRF_QP_STRING, NULL);
+ RegisterPreference(HKEY("default_header_charset"),
+ _("Default character set for email headers:"),
+ PRF_STRING,
+ NULL);
+ RegisterPreference(HKEY("defaultfrom"), _("Preferred email address"), PRF_STRING, NULL);
+ RegisterPreference(HKEY("defaultname"),
+ _("Preferred display name for email messages"),
+ PRF_STRING,
+ NULL);
+ RegisterPreference(HKEY("defaulthandle"),
+ _("Preferred display name for bulletin board posts"),
+ PRF_STRING,
+ NULL);
+ RegisterPreference(HKEY("mailbox"),_("Mailbox view mode"), PRF_STRING, NULL);
+
WebcitAddUrlHandler(HKEY("readnew"), h_readnew, NEED_URL);
WebcitAddUrlHandler(HKEY("readold"), h_readold, NEED_URL);
WebcitAddUrlHandler(HKEY("readfwd"), h_readfwd, NEED_URL);