4 * Functions which deal with the fetching and displaying of messages.
12 HashList *MsgHeaderHandler = NULL;
13 HashList *MsgEvaluators = NULL;
14 HashList *MimeRenderHandler = NULL;
15 int dbg_analyze_msg = 0;
17 #define SUBJ_COL_WIDTH_PCT 50 /**< Mailbox view column width */
18 #define SENDER_COL_WIDTH_PCT 30 /**< Mailbox view column width */
19 #define DATE_PLUS_BUTTONS_WIDTH_PCT 20 /**< Mailbox view column width */
21 void jsonMessageListHdr(void);
23 void display_enter(void);
25 /*----------------------------------------------------------------------------*/
28 typedef void (*MsgPartEvaluatorFunc)(message_summary *Sum, StrBuf *Buf);
30 typedef struct _MsgPartEvaluatorStruct {
31 MsgPartEvaluatorFunc f;
32 }MsgPartEvaluatorStruct;
35 /*----------------------------------------------------------------------------*/
38 int load_message(message_summary *Msg,
52 lprintf(1, "-------------------MSG4 %ld|%s--------------\n", Msg->msgnum, ChrPtr(Msg->PartNum));
53 if (Msg->PartNum != NULL)
54 serv_printf("MSG4 %ld|%s", Msg->msgnum, ChrPtr(Msg->PartNum));
56 serv_printf("MSG4 %ld", Msg->msgnum);
58 StrBuf_ServGetln(Buf);
59 if (GetServerStatus(Buf, NULL) != 1) {
61 StrBufAppendPrintf(*Error, "<strong>");
62 StrBufAppendPrintf(*Error, _("ERROR:"));
63 StrBufAppendPrintf(*Error, "</strong> %s<br />\n", &buf[4]);
68 /** begin everythingamundo table */
69 HdrToken = NewStrBuf();
70 while ((StrBuf_ServGetln(Buf)>=0) && !Done) {
71 if ( (StrLength(Buf)==3) &&
72 !strcmp(ChrPtr(Buf), "000"))
76 lprintf(1, _("unexpected end of message"));
77 if (Msg->MsgBody->Data == NULL)
78 Msg->MsgBody->Data = NewStrBuf();
79 Msg->MsgBody->ContentType = NewStrBufPlain(HKEY("text/html"));
80 StrBufAppendPrintf(Msg->MsgBody->Data, "<div><i>");
81 StrBufAppendPrintf(Msg->MsgBody->Data, _("unexpected end of message"));
82 StrBufAppendPrintf(Msg->MsgBody->Data, " (1)</i><br /><br />\n");
83 StrBufAppendPrintf(Msg->MsgBody->Data, "</div>\n");
88 case 0:/* Citadel Message Headers */
89 if (StrLength(Buf) == 0) {
93 StrBufExtract_token(HdrToken, Buf, 0, '=');
94 StrBufCutLeft(Buf, StrLength(HdrToken) + 1);
97 if (dbg_analyze_msg) lprintf(1, ":: [%s] = [%s]\n", ChrPtr(HdrToken), ChrPtr(Buf));
99 /* look up one of the examine_* functions to parse the content */
100 if (GetHash(MsgHeaderHandler, SKEY(HdrToken), &vHdr) &&
102 Hdr = (headereval*)vHdr;
103 Hdr->evaluator(Msg, Buf, FoundCharset);
104 if (Hdr->Type == 1) {
108 else LogError(Target,
110 "don't know how to handle message header[%s]\n",
114 case 1:/* Message Mime Header */
115 if (StrLength(Buf) == 0) {
117 if (Msg->MsgBody->ContentType == NULL)
118 /* end of header or no header? */
119 Msg->MsgBody->ContentType = NewStrBufPlain(HKEY("text/plain"));
120 /* usual end of mime header */
124 StrBufExtract_token(HdrToken, Buf, 0, ':');
125 if (StrLength(HdrToken) > 0) {
126 StrBufCutLeft(Buf, StrLength(HdrToken) + 1);
128 if (dbg_analyze_msg) lprintf(1, ":: [%s] = [%s]\n", ChrPtr(HdrToken), ChrPtr(Buf));
130 /* the examine*'s know how to do with mime headers too... */
131 if (GetHash(MsgHeaderHandler, SKEY(HdrToken), &vHdr) &&
133 Hdr = (headereval*)vHdr;
134 Hdr->evaluator(Msg, Buf, FoundCharset);
139 case 2: /* Message Body */
141 if (Msg->MsgBody->size_known > 0) {
142 StrBuf_ServGetBLOBBuffered(Msg->MsgBody->Data, Msg->MsgBody->length);
144 /*/ todo: check next line, if not 000, append following lines */
147 if (StrLength(Msg->MsgBody->Data) > 0)
148 StrBufAppendBufPlain(Msg->MsgBody->Data, "\n", 1, 0);
149 StrBufAppendBuf(Msg->MsgBody->Data, Buf, 0);
153 StrBufAppendBuf(Msg->MsgBody->Data, Buf, 0);
158 if (Msg->AllAttach == NULL)
159 Msg->AllAttach = NewHash(1,NULL);
160 /* now we put the body mimepart we read above into the mimelist */
161 Put(Msg->AllAttach, SKEY(Msg->MsgBody->PartNum), Msg->MsgBody, DestroyMime);
163 /* Generate a reply-to address */
164 if (StrLength(Msg->Rfca) > 0) {
165 if (Msg->reply_to == NULL)
166 Msg->reply_to = NewStrBuf();
167 if (StrLength(Msg->from) > 0) {
168 StrBufPrintf(Msg->reply_to, "%s <%s>", ChrPtr(Msg->from), ChrPtr(Msg->Rfca));
171 FlushStrBuf(Msg->reply_to);
172 StrBufAppendBuf(Msg->reply_to, Msg->Rfca, 0);
177 if ((StrLength(Msg->OtherNode)>0) &&
178 (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_nodename))) &&
179 (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_humannode)) ))
181 if (Msg->reply_to == NULL)
182 Msg->reply_to = NewStrBuf();
183 StrBufPrintf(Msg->reply_to,
186 ChrPtr(Msg->OtherNode));
189 if (Msg->reply_to == NULL)
190 Msg->reply_to = NewStrBuf();
191 FlushStrBuf(Msg->reply_to);
192 StrBufAppendBuf(Msg->reply_to, Msg->from, 0);
196 FreeStrBuf(&HdrToken);
203 * I wanna SEE that message!
205 * msgnum Message number to display
206 * printable_view Nonzero to display a printable view
207 * section Optional for encapsulated message/rfc822 submessage
209 int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, const StrBuf *PartNum)
212 StrBuf *FoundCharset;
215 message_summary *Msg = NULL;
219 WCTemplputParams SubTP;
220 StrBuf *Error = NULL;
223 FoundCharset = NewStrBuf();
224 Msg = (message_summary *)malloc(sizeof(message_summary));
225 memset(Msg, 0, sizeof(message_summary));
226 Msg->msgnum = msgnum;
227 Msg->PartNum = PartNum;
228 Msg->MsgBody = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
229 memset(Msg->MsgBody, 0, sizeof(wc_mime_attachment));
230 Msg->MsgBody->msgnum = msgnum;
232 if (!load_message(Msg, FoundCharset, &Error)) {
233 StrBufAppendBuf(Target, Error, 0);
237 /* strip the bare contenttype, so we ommit charset etc. */
238 StrBufExtract_token(Buf, Msg->MsgBody->ContentType, 0, ';');
240 /* look up the renderer, that will convert this mimeitem into the htmlized form */
241 if (GetHash(MimeRenderHandler, SKEY(Buf), &vHdr) &&
243 RenderMimeFuncStruct *Render;
244 Render = (RenderMimeFuncStruct*)vHdr;
245 Render->f(Msg->MsgBody, NULL, FoundCharset);
248 if (StrLength(Msg->reply_references)> 0) {
249 /* Trim down excessively long lists of thread references. We eliminate the
250 * second one in the list so that the thread root remains intact.
252 int rrtok = num_tokens(ChrPtr(Msg->reply_references), '|');
253 int rrlen = StrLength(Msg->reply_references);
254 if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) {
255 StrBufRemove_token(Msg->reply_references, 1, '|');
259 /* now check if we need to translate some mimeparts, and remove the duplicate */
260 it = GetNewHashPos(Msg->AllAttach, 0);
261 while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) &&
263 wc_mime_attachment *Mime = (wc_mime_attachment*) vMime;
264 evaluate_mime_part(Msg, Mime);
267 memset(&SubTP, 0, sizeof(WCTemplputParams));
268 SubTP.Filter.ContextType = CTX_MAILSUM;
270 DoTemplate(tmpl, tmpllen, Target, &SubTP);
272 DestroyMessageSummary(Msg);
273 FreeStrBuf(&FoundCharset);
284 * Unadorned HTML output of an individual message, suitable
285 * for placing in a hidden iframe, for printing, or whatever
287 * msgnum_as_string == Message number, as a string instead of as a long int
289 void embed_message(void) {
292 const StrBuf *Tmpl = sbstr("template");
294 msgnum = StrTol(WCC->UrlFragment2);
295 if (StrLength(Tmpl) > 0)
296 read_message(WCC->WBuf, SKEY(Tmpl), msgnum, NULL);
298 read_message(WCC->WBuf, HKEY("view_message"), msgnum, NULL);
303 * Printable view of a message
305 * msgnum_as_string == Message number, as a string instead of as a long int
307 void print_message(void) {
310 msgnum = StrTol(WC->UrlFragment2);
311 output_headers(0, 0, 0, 0, 0, 0);
313 hprintf("Content-type: text/html\r\n"
314 "Server: " PACKAGE_STRING "\r\n"
315 "Connection: close\r\n");
319 read_message(WC->WBuf, HKEY("view_message_print"), msgnum, NULL);
325 * Mobile browser view of message
327 * @param msg_num_as_string Message number as a string instead of as a long int
329 void mobile_message_view(void) {
331 msgnum = StrTol(WC->UrlFragment2);
332 output_headers(1, 0, 0, 0, 0, 1);
334 do_template("msgcontrols", NULL);
335 read_message(WC->WBuf, HKEY("view_message"), msgnum, NULL);
340 * \brief Display a message's headers
342 * \param msgnum_as_string Message number, as a string instead of as a long int
344 void display_headers(void) {
348 msgnum = StrTol(WC->UrlFragment2);
349 output_headers(0, 0, 0, 0, 0, 0);
351 hprintf("Content-type: text/plain\r\n"
353 "Connection: close\r\n",
357 serv_printf("MSG2 %ld|3", msgnum);
358 serv_getln(buf, sizeof buf);
360 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
361 wprintf("%s\n", buf);
369 message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSubject, long MsgNum)
372 MsgPartEvaluatorStruct *Eval;
373 message_summary *Msg;
382 serv_printf("MSG0 %ld|1", MsgNum); /* ask for headers only */
384 StrBuf_ServGetln(Buf);
385 if (GetServerStatus(Buf, NULL) == 1) {
390 Msg = (message_summary*)malloc(sizeof(message_summary));
391 memset(Msg, 0, sizeof(message_summary));
392 while (len = StrBuf_ServGetln(Buf),
394 strcmp(ChrPtr(Buf), "000")== 0)){
396 ebuf = strchr(ChrPtr(Buf), '=');
398 if (GetHash(MsgEvaluators, buf, nBuf, &vEval) && vEval != NULL) {
399 Eval = (MsgPartEvaluatorStruct*) vEval;
400 StrBufCutLeft(Buf, nBuf + 1);
403 else lprintf(1, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf));
413 * load message pointers from the server for a "read messages" operation
415 * servcmd: the citadel command to send to the citserver
416 * with_headers: also include some of the headers with the message numbers (more expensive)
418 int load_msg_ptrs(const char *servcmd, int with_headers)
420 StrBuf* FoundCharset = NULL;
422 message_summary *Msg;
429 const char *Ptr = NULL;
431 if (WCC->summ != NULL) {
432 DeleteHash(&WCC->summ);
434 WCC->summ = NewHash(1, Flathash);
439 StrBuf_ServGetln(Buf);
440 if (GetServerStatus(Buf, NULL) != 1) {
445 while (len = StrBuf_ServGetln(Buf),
447 strcmp(ChrPtr(Buf), "000")!= 0))
449 if (nummsgs < maxload) {
452 Msg = (message_summary*)malloc(sizeof(message_summary));
453 memset(Msg, 0, sizeof(message_summary));
455 Msg->msgnum = StrBufExtractNext_long(Buf, &Ptr, '|');
456 Msg->date = StrBufExtractNext_long(Buf, &Ptr, '|');
458 * as citserver probably gives us messages in forward date sorting
459 * nummsgs should be the same order as the message date.
461 if (Msg->date == 0) {
463 if (StrLength(Buf) < 32)
467 Msg->from = NewStrBufPlain(NULL, StrLength(Buf));
468 StrBufExtract_NextToken(Buf2, Buf, &Ptr, '|');
469 if (StrLength(Buf2) != 0) {
470 /** Handle senders with RFC2047 encoding */
471 StrBuf_RFC822_to_Utf8(Msg->from, Buf2, WCC->DefaultCharset, FoundCharset);
475 StrBufExtract_NextToken(Buf2, Buf, &Ptr, '|');
476 if ((StrLength(Buf2) !=0 ) &&
477 ( ((WCC->room_flags & QR_NETWORK)
478 || ((strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_nodename))
479 && (strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_fqdn))))))))
481 StrBufAppendBufPlain(Msg->from, HKEY(" @ "), 0);
482 StrBufAppendBuf(Msg->from, Buf2, 0);
486 StrBufExtract_token(Msg->inetaddr, Buf, 4, '|');
488 StrBufSkip_NTokenS(Buf, &Ptr, '|', 1);
489 Msg->subj = NewStrBufPlain(NULL, StrLength(Buf));
490 StrBufExtract_NextToken(Buf2, Buf, &Ptr, '|');
491 if (StrLength(Buf2) == 0)
492 StrBufAppendBufPlain(Msg->subj, _("(no subject)"), -1,0);
494 StrBuf_RFC822_to_Utf8(Msg->subj, Buf2, WCC->DefaultCharset, FoundCharset);
495 if ((StrLength(Msg->subj) > 75) &&
496 (StrBuf_Utf8StrLen(Msg->subj) > 75)) {
497 StrBuf_Utf8StrCut(Msg->subj, 72);
498 StrBufAppendBufPlain(Msg->subj, HKEY("..."), 0);
503 if ((StrLength(Msg->from) > 25) &&
504 (StrBuf_Utf8StrLen(Msg->from) > 25)) {
505 StrBuf_Utf8StrCut(Msg->from, 23);
506 StrBufAppendBufPlain(Msg->from, HKEY("..."), 0);
510 Put(WCC->summ, (const char *)&n, sizeof(n), Msg, DestroyMessageSummary);
520 inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
528 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
529 return (message_summary*) vMsg;
533 long DrawMessageDropdown(StrBuf *Selector, long maxmsgs, long startmsg, int nMessages)
546 WCTemplputParams SubTP;
548 memset(&SubTP, 0, sizeof(WCTemplputParams));
549 SubTP.Filter.ContextType = CTX_LONGVECTOR;
550 SubTP.Context = &vector;
551 TmpBuf = NewStrBuf();
552 At = GetNewHashPos(WCC->summ, nMessages);
553 nItems = GetCount(WCC->summ);
557 vector[1] = startmsg;
561 vector[3] = abs(nMessages);
562 lo = GetHashPosCounter(At);
564 if (lo + nMessages >= nItems) {
566 vector[3] = nItems - lo;
571 hi = lo + nMessages - 1;
574 if (lo + nMessages < -1) {
578 if ((lo % abs(nMessages)) != 0) {
579 int offset = (lo % abs(nMessages) *
580 (nMessages / abs(nMessages)));
582 vector[3] = abs(offset);
590 done = !GetNextHashPos(WCC->summ, At, &hklen, &key, &vMsg);
593 * Bump these because although we're thinking in zero base, the user
594 * is a drooling idiot and is thinking in one base.
600 dbg_print_longvector(vector);
601 DoTemplate(HKEY("select_messageindex"), TmpBuf, &SubTP);
602 StrBufAppendBuf(Selector, TmpBuf, 0);
606 if (maxmsgs == 9999999) {
613 dbg_print_longvector(vector);
614 DoTemplate(HKEY("select_messageindex_all"), TmpBuf, &SubTP);
615 StrBufAppendBuf(Selector, TmpBuf, 0);
621 void load_seen_flags(void)
623 message_summary *Msg;
631 OldMsg = NewStrBuf();
633 StrBuf_ServGetln(OldMsg);
634 if (GetServerStatus(OldMsg, NULL) == 2) {
635 StrBufCutLeft(OldMsg, 4);
641 at = GetNewHashPos(WCC->summ, 0);
642 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
643 /** Are you a new message, or an old message? */
644 Msg = (message_summary*) vMsg;
645 if (is_msg_in_mset(ChrPtr(OldMsg), Msg->msgnum)) {
656 extern readloop_struct rlid[];
659 * command loop for reading messages
661 * Set oper to "readnew" or "readold" or "readfwd" or "headers"
663 void readloop(long oper)
665 StrBuf *MessageDropdown = NULL;
666 StrBuf *BBViewToolBar = NULL;
668 message_summary *Msg;
672 int with_headers = 0;
676 long *displayed_msgs = NULL;
677 int num_displayed = 0;
678 int is_singlecard = 0;
681 int lowest_displayed = (-1);
682 int highest_displayed = 0;
683 addrbookent *addrbook = NULL;
690 int care_for_empty_list = 0;
693 int defaultsortorder = 0;
694 WCTemplputParams SubTP;
697 if (havebstr("is_summary") && (1 == (ibstr("is_summary"))))
698 WCC->wc_view = VIEW_MAILBOX;
701 output_headers(1, 1, 1, 0, 0, 0);
702 } else if (WCC->wc_view == VIEW_MAILBOX) {
703 jsonMessageListHdr();
706 switch (WCC->wc_view) {
708 sprintf(buf, "wiki?room=%s&page=home", ChrPtr(WCC->wc_roomname));
714 strcpy(cmd, "MSGS ALL");
716 parse_calendar_view_request(&calv);
719 strcpy(cmd, "MSGS ALL");
723 strcpy(cmd, "MSGS ALL");
725 wprintf("<div id=\"new_notes_here\"></div>\n");
727 case VIEW_ADDRESSBOOK:
728 is_singlecard = ibstr("is_singlecard");
729 if (is_singlecard != 1) {
730 if (oper == do_search) {
731 snprintf(cmd, sizeof(cmd), "MSGS SEARCH|%s", bstr("query"));
734 strcpy(cmd, "MSGS ALL");
745 defaultsortorder = 2;
748 care_for_empty_list = 0;
750 /* Generally using maxmsgs|startmsg is not required
751 in mailbox view, but we have a 'safemode' for clients
752 (*cough* Exploder) that simply can't handle too many */
753 if (havebstr("maxmsgs")) maxmsgs = ibstr("maxmsgs");
754 else maxmsgs = 9999999;
755 if (havebstr("startmsg")) startmsg = lbstr("startmsg");
756 snprintf(cmd, sizeof(cmd), "MSGS %s|%s||1",
757 (oper == do_search) ? "SEARCH" : "ALL",
758 (oper == do_search) ? bstr("query") : ""
764 defaultsortorder = 1;
767 care_for_empty_list = 1;
769 rlid[oper].cmd(cmd, sizeof(cmd));
770 SetAccessCommand(oper);
772 if (havebstr("maxmsgs"))
773 maxmsgs = ibstr("maxmsgs");
774 if (maxmsgs == 0) maxmsgs = DEFAULT_MAXMSGS;
776 if (havebstr("startmsg")) {
777 startmsg = lbstr("startmsg");
782 nummsgs = load_msg_ptrs(cmd, with_headers);
784 if (care_for_empty_list) {
785 wprintf("<div class=\"nomsgs\"><br><em>");
788 wprintf(_("No new messages."));
791 wprintf(_("No old messages."));
794 wprintf(_("No messages here."));
796 wprintf("</em><br></div>\n");
804 memset(&SubTP, 0, sizeof(WCTemplputParams));
805 SubTP.Filter.ContextType = CTX_NONE;
806 SubTP.Context = NULL;
807 SortIt = RetrieveSort(&SubTP, NULL, 0,
808 HKEY("date"), defaultsortorder);
810 SortByPayload(WCC->summ, SortIt);
811 if (WCC->wc_view == VIEW_BBS) {
812 if (lbstr("SortOrder") == 2) {
814 num_displayed = -DEFAULT_MAXMSGS;
818 num_displayed = DEFAULT_MAXMSGS;
822 if (startmsg < 0) startmsg = (bbs_reverse) ? nummsgs - 1 : 0;
824 if (load_seen) load_seen_flags();
827 * If we're to print s.th. above the message list...
829 switch (WCC->wc_view) {
831 BBViewToolBar = NewStrBuf();
832 MessageDropdown = NewStrBuf();
834 maxmsgs = DrawMessageDropdown(MessageDropdown, maxmsgs, startmsg, num_displayed);
835 if (num_displayed < 0) {
837 if (num_displayed != maxmsgs)
838 maxmsgs = abs(maxmsgs) + 1;
840 maxmsgs = abs(maxmsgs);
843 memset(&SubTP, 0, sizeof(WCTemplputParams));
844 SubTP.Filter.ContextType = CTX_STRBUF;
845 SubTP.Context = MessageDropdown;
846 DoTemplate(HKEY("msg_listselector_top"), BBViewToolBar, &SubTP);
847 StrBufAppendBuf(WCC->WBuf, BBViewToolBar, 0);
848 FlushStrBuf(BBViewToolBar);
851 WCC->startmsg = startmsg;
852 WCC->maxmsgs = maxmsgs;
853 WCC->num_displayed = 0;
855 /* Put some helpful data in vars for mailsummary_json */
856 svputlong("READLOOP:TOTALMSGS", nummsgs);
857 svputlong("READLOOP:STARTMSG", startmsg);
858 svputlong("WCVIEW", WCC->wc_view);
860 * iterate over each message. if we need to load an attachment, do it here.
862 if (WCC->wc_view == VIEW_MAILBOX) goto NO_MSG_LOOP;
864 * iterate over each message. if we need to load an attachment, do it here.
866 at = GetNewHashPos(WCC->summ, 0);
867 num_displayed = i = 0;
868 while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
869 Msg = (message_summary*) vMsg;
870 if ((Msg->msgnum >= startmsg) && (num_displayed <= maxmsgs)) {
871 switch (WCC->wc_view) {
874 case VIEW_CALBRIEF: /* load the mime attachments for special tasks... */
876 load_calendar_item(Msg, Msg->is_new, &calv);
879 display_task(Msg, Msg->is_new);
882 display_note(Msg, Msg->is_new);
884 case VIEW_ADDRESSBOOK:
886 fetch_ab_name(Msg, &ab_name);
890 addrbook = realloc(addrbook,
891 (sizeof(addrbookent) * num_ab) );
892 safestrncpy(addrbook[num_ab-1].ab_name, ab_name,
893 sizeof(addrbook[num_ab-1].ab_name));
894 addrbook[num_ab-1].ab_msgnum = Msg->msgnum;
897 case VIEW_BBS: /* Tag the mails we want to show in bbview... */
899 if (displayed_msgs == NULL) {
900 displayed_msgs = malloc(sizeof(long) *
901 (maxmsgs<nummsgs ? maxmsgs + 1 : nummsgs + 1));
903 if ((i >= startmsg) && (i < startmsg + maxmsgs)) {
904 displayed_msgs[num_displayed] = Msg->msgnum;
905 if (lowest_displayed < 0) lowest_displayed = a;
906 highest_displayed = a;
918 * Done iterating the message list. now tasks we want to do after.
920 switch (WCC->wc_view) {
922 DoTemplate(HKEY("mailsummary_json"),NULL, &SubTP);
925 if (displayed_msgs != NULL) {
926 /** if we do a split bbview in the future, begin messages div here */
928 for (a=0; a<num_displayed; ++a) {
929 read_message(WCC->WBuf, HKEY("view_message"), displayed_msgs[a], NULL);
932 /** if we do a split bbview in the future, end messages div here */
934 free(displayed_msgs);
935 displayed_msgs = NULL;
937 memset(&SubTP, 0, sizeof(WCTemplputParams));
938 SubTP.Filter.ContextType = CTX_STRBUF;
939 SubTP.Context = MessageDropdown;
940 DoTemplate(HKEY("msg_listselector_bottom"), BBViewToolBar, &SubTP);
941 StrBufAppendBuf(WCC->WBuf, BBViewToolBar, 0);
943 FreeStrBuf(&BBViewToolBar);
944 FreeStrBuf(&MessageDropdown);
949 switch (WCC->wc_view) {
954 render_calendar_view(&calv);
957 do_tasks_view(); /** Render the task list */
961 case VIEW_ADDRESSBOOK:
963 read_message(WC->WBuf, HKEY("view_message"), lbstr("startmsg"), NULL);
965 do_addrbook_view(addrbook, num_ab); /** Render the address book */
972 /** Note: wDumpContent() will output one additional </div> tag. */
973 if (WCC->wc_view != VIEW_MAILBOX) {
974 /* We ought to move this out into template */
981 if (WCC->summ != NULL) {
982 DeleteHash(&WCC->summ);
984 if (addrbook != NULL) free(addrbook);
985 FreeStrBuf(&BBViewToolBar);
990 * Back end for post_message()
991 * ... this is where the actual message gets transmitted to the server.
993 void post_mime_to_server(void) {
995 char top_boundary[SIZ];
996 char alt_boundary[SIZ];
997 int is_multipart = 0;
999 wc_mime_attachment *att;
1001 size_t encoded_length;
1002 size_t encoded_strlen;
1003 char *txtmail = NULL;
1005 sprintf(top_boundary, "Citadel--Multipart--%s--%04x--%04x",
1006 ChrPtr(WCC->serv_info->serv_fqdn),
1010 sprintf(alt_boundary, "Citadel--Multipart--%s--%04x--%04x",
1011 ChrPtr(WCC->serv_info->serv_fqdn),
1016 /* RFC2045 requires this, and some clients look for it... */
1017 serv_puts("MIME-Version: 1.0");
1018 serv_puts("X-Mailer: " PACKAGE_STRING);
1020 /* If there are attachments, we have to do multipart/mixed */
1021 if (GetCount(WCC->attachments) > 0) {
1026 /* Remember, serv_printf() appends an extra newline */
1027 serv_printf("Content-type: multipart/mixed; boundary=\"%s\"\n", top_boundary);
1028 serv_printf("This is a multipart message in MIME format.\n");
1029 serv_printf("--%s", top_boundary);
1032 /* Remember, serv_printf() appends an extra newline */
1033 serv_printf("Content-type: multipart/alternative; "
1034 "boundary=\"%s\"\n", alt_boundary);
1035 serv_printf("This is a multipart message in MIME format.\n");
1036 serv_printf("--%s", alt_boundary);
1038 serv_puts("Content-type: text/plain; charset=utf-8");
1039 serv_puts("Content-Transfer-Encoding: quoted-printable");
1041 txtmail = html_to_ascii(bstr("msgtext"), 0, 80, 0);
1042 text_to_server_qp(txtmail); /* Transmit message in quoted-printable encoding */
1045 serv_printf("--%s", alt_boundary);
1047 serv_puts("Content-type: text/html; charset=utf-8");
1048 serv_puts("Content-Transfer-Encoding: quoted-printable");
1050 serv_puts("<html><body>\r\n");
1051 text_to_server_qp(bstr("msgtext")); /* Transmit message in quoted-printable encoding */
1052 serv_puts("</body></html>\r\n");
1054 serv_printf("--%s--", alt_boundary);
1062 /* Add in the attachments */
1063 it = GetNewHashPos(WCC->attachments, 0);
1064 while (GetNextHashPos(WCC->attachments, it, &len, &Key, &vAtt)) {
1065 att = (wc_mime_attachment *)vAtt;
1066 encoded_length = ((att->length * 150) / 100);
1067 encoded = malloc(encoded_length);
1068 if (encoded == NULL) break;
1069 encoded_strlen = CtdlEncodeBase64(encoded, ChrPtr(att->Data), StrLength(att->Data), 1);
1071 serv_printf("--%s", top_boundary);
1072 serv_printf("Content-type: %s", ChrPtr(att->ContentType));
1073 serv_printf("Content-disposition: attachment; filename=\"%s\"", ChrPtr(att->FileName));
1074 serv_puts("Content-transfer-encoding: base64");
1076 serv_write(encoded, encoded_strlen);
1081 serv_printf("--%s--", top_boundary);
1090 * Post message (or don't post message)
1092 * Note regarding the "dont_post" variable:
1093 * A random value (actually, it's just a timestamp) is inserted as a hidden
1094 * field called "postseq" when the display_enter page is generated. This
1095 * value is checked when posting, using the static variable dont_post. If a
1096 * user attempts to post twice using the same dont_post value, the message is
1097 * discarded. This prevents the accidental double-saving of the same message
1098 * if the user happens to click the browser "back" button.
1100 void post_message(void)
1103 StrBuf *encoded_subject = NULL;
1104 static long dont_post = (-1L);
1105 wc_mime_attachment *att;
1106 int is_anonymous = 0;
1107 const StrBuf *display_name = NULL;
1108 wcsession *WCC = WC;
1110 if (havebstr("force_room")) {
1111 gotoroom(sbstr("force_room"));
1114 if (havebstr("display_name")) {
1115 display_name = sbstr("display_name");
1116 if (!strcmp(ChrPtr(display_name), "__ANONYMOUS__")) {
1117 display_name = NULL;
1122 if (WCC->upload_length > 0) {
1127 lprintf(9, "%s:%d: we are uploading %d bytes\n", __FILE__, __LINE__, WCC->upload_length);
1128 /** There's an attachment. Save it to this struct... */
1129 att = malloc(sizeof(wc_mime_attachment));
1130 memset(att, 0, sizeof(wc_mime_attachment ));
1131 att->length = WCC->upload_length;
1132 att->ContentType = NewStrBufPlain(WCC->upload_content_type, -1);
1133 att->FileName = NewStrBufPlain(WCC->upload_filename, -1);
1136 if (WCC->attachments == NULL)
1137 WCC->attachments = NewHash(1, NULL);
1138 /* And add it to the list. */
1139 n = snprintf(N, sizeof N, "%d", GetCount(WCC->attachments) + 1);
1140 Put(WCC->attachments, N, n, att, DestroyMime);
1143 * Mozilla sends a simple filename, which is what we want,
1144 * but Satan's Browser sends an entire pathname. Reduce
1145 * the path to just a filename if we need to.
1147 pch = strrchr(ChrPtr(att->FileName), '/');
1149 StrBufCutLeft(att->FileName, pch - ChrPtr(att->FileName) + 1);
1151 pch = strrchr(ChrPtr(att->FileName), '\\');
1153 StrBufCutLeft(att->FileName, pch - ChrPtr(att->FileName) + 1);
1157 * Transfer control of this memory from the upload struct
1158 * to the attachment struct.
1160 att->Data = NewStrBufPlain(WCC->upload, WCC->upload_length);
1162 WCC->upload_length = 0;
1168 if (havebstr("cancel_button")) {
1169 sprintf(WCC->ImportantMessage,
1170 _("Cancelled. Message was not posted."));
1171 } else if (havebstr("attach_button")) {
1174 } else if (lbstr("postseq") == dont_post) {
1175 sprintf(WCC->ImportantMessage,
1176 _("Automatically cancelled because you have already "
1177 "saved this message."));
1179 const char CMD[] = "ENT0 1|%s|%d|4|%s|%s||%s|%s|%s|%s|%s";
1180 const StrBuf *Recp = NULL;
1181 const StrBuf *Cc = NULL;
1182 const StrBuf *Bcc = NULL;
1183 const StrBuf *Wikipage = NULL;
1184 const StrBuf *my_email_addr = NULL;
1185 StrBuf *CmdBuf = NULL;
1186 StrBuf *references = NULL;
1188 if (havebstr("references"))
1190 const StrBuf *ref = sbstr("references");
1191 references = NewStrBufPlain(ChrPtr(ref), StrLength(ref));
1192 if (*ChrPtr(references) == '|') { /* remove leading '|' if present */
1193 StrBufCutLeft(references, 1);
1195 StrBufReplaceChars(references, '|', '!');
1197 if (havebstr("subject")) {
1200 * make enough room for the encoded string;
1201 * plus the QP header
1203 Subj = sbstr("subject");
1205 StrBufRFC2047encode(&encoded_subject, Subj);
1207 Recp = sbstr("recp");
1210 Wikipage = sbstr("wikipage");
1211 my_email_addr = sbstr("my_email_addr");
1213 CmdBuf = NewStrBufPlain(NULL,
1216 StrLength(encoded_subject) +
1219 StrLength(Wikipage) +
1220 StrLength(my_email_addr) +
1221 StrLength(references));
1223 StrBufPrintf(CmdBuf,
1227 ChrPtr(encoded_subject),
1228 ChrPtr(display_name),
1232 ChrPtr(my_email_addr),
1233 ChrPtr(references));
1234 FreeStrBuf(&references);
1236 lprintf(9, "%s\n", ChrPtr(CmdBuf));
1237 serv_puts(ChrPtr(CmdBuf));
1238 serv_getln(buf, sizeof buf);
1239 FreeStrBuf(&CmdBuf);
1240 FreeStrBuf(&encoded_subject);
1241 if (buf[0] == '4') {
1242 post_mime_to_server();
1243 if ( (havebstr("recp"))
1244 || (havebstr("cc" ))
1245 || (havebstr("bcc" ))
1247 sprintf(WCC->ImportantMessage, _("Message has been sent.\n"));
1250 sprintf(WC->ImportantMessage, _("Message has been posted.\n"));
1252 dont_post = lbstr("postseq");
1254 lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, buf);
1255 sprintf(WC->ImportantMessage, "%s", &buf[4]);
1261 DeleteHash(&WCC->attachments);
1264 * We may have been supplied with instructions regarding the location
1265 * to which we must return after posting. If found, go there.
1267 if (havebstr("return_to")) {
1268 http_redirect(bstr("return_to"));
1271 * If we were editing a page in a wiki room, go to that page now.
1273 else if (havebstr("wikipage")) {
1274 snprintf(buf, sizeof buf, "wiki?page=%s", bstr("wikipage"));
1278 * Otherwise, just go to the "read messages" loop.
1289 * \brief display the message entry screen
1291 void display_enter(void)
1295 const StrBuf *display_name = NULL;
1296 int recipient_required = 0;
1297 int subject_required = 0;
1298 int recipient_bad = 0;
1299 int is_anonymous = 0;
1300 wcsession *WCC = WC;
1304 if (havebstr("force_room")) {
1305 gotoroom(sbstr("force_room"));
1308 display_name = sbstr("display_name");
1309 if (!strcmp(ChrPtr(display_name), "__ANONYMOUS__")) {
1310 display_name = NULL;
1314 /** First test to see whether this is a room that requires recipients to be entered */
1315 serv_puts("ENT0 0");
1316 serv_getln(buf, sizeof buf);
1318 if (!strncmp(buf, "570", 3)) { /** 570 means that we need a recipient here */
1319 recipient_required = 1;
1321 else if (buf[0] != '2') { /** Any other error means that we cannot continue */
1322 sprintf(WCC->ImportantMessage, "%s", &buf[4]);
1327 /* Is the server strongly recommending that the user enter a message subject? */
1328 if ((buf[3] != '\0') && (buf[4] != '\0')) {
1329 subject_required = extract_int(&buf[4], 1);
1333 * Are we perhaps in an address book view? If so, then an "enter
1334 * message" command really means "add new entry."
1336 if (WCC->wc_default_view == VIEW_ADDRESSBOOK) {
1337 do_edit_vcard(-1, "", NULL, NULL, "", ChrPtr(WCC->wc_roomname));
1342 * Are we perhaps in a calendar room? If so, then an "enter
1343 * message" command really means "add new calendar item."
1345 if (WCC->wc_default_view == VIEW_CALENDAR) {
1346 display_edit_event();
1351 * Are we perhaps in a tasks view? If so, then an "enter
1352 * message" command really means "add new task."
1354 if (WCC->wc_default_view == VIEW_TASKS) {
1355 display_edit_task();
1360 * Otherwise proceed normally.
1361 * Do a custom room banner with no navbar...
1364 if (recipient_required) {
1365 const StrBuf *Recp = NULL;
1366 const StrBuf *Cc = NULL;
1367 const StrBuf *Bcc = NULL;
1368 const StrBuf *Wikipage = NULL;
1369 StrBuf *CmdBuf = NULL;
1370 const char CMD[] = "ENT0 0|%s|%d|0||%s||%s|%s|%s";
1372 Recp = sbstr("recp");
1375 Wikipage = sbstr("wikipage");
1377 CmdBuf = NewStrBufPlain(NULL,
1380 StrLength(display_name) +
1383 StrLength(Wikipage));
1385 StrBufPrintf(CmdBuf,
1389 ChrPtr(display_name),
1393 serv_puts(ChrPtr(CmdBuf));
1394 serv_getln(buf, sizeof buf);
1395 FreeStrBuf(&CmdBuf);
1397 if (!strncmp(buf, "570", 3)) { /** 570 means we have an invalid recipient listed */
1398 if (havebstr("recp") &&
1404 else if (buf[0] != '2') { /** Any other error means that we cannot continue */
1405 wprintf("<em>%s</em><br />\n", &buf[4]);/*TODO -> important message */
1409 svputlong("RCPTREQUIRED", recipient_required);
1410 svputlong("SUBJREQUIRED", recipient_required || subject_required);
1413 output_headers(1, 0, 0, 0, 1, 0);
1414 DoTemplate(HKEY("edit_message"), NULL, &NoCtx);
1421 * \brief delete a message
1423 void delete_msg(void)
1428 msgid = lbstr("msgid");
1430 if (WC->wc_is_trash) { /** Delete from Trash is a real delete */
1431 serv_printf("DELE %ld", msgid);
1433 else { /** Otherwise move it to Trash */
1434 serv_printf("MOVE %ld|_TRASH_|0", msgid);
1437 serv_getln(buf, sizeof buf);
1438 sprintf(WC->ImportantMessage, "%s", &buf[4]);
1445 * \brief move a message to another folder
1452 msgid = lbstr("msgid");
1454 if (havebstr("move_button")) {
1455 sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room"));
1457 serv_getln(buf, sizeof buf);
1458 sprintf(WC->ImportantMessage, "%s", &buf[4]);
1460 sprintf(WC->ImportantMessage, (_("The message was not moved.")));
1471 * Confirm move of a message
1473 void confirm_move_msg(void)
1479 msgid = lbstr("msgid");
1482 output_headers(1, 1, 2, 0, 0, 0);
1483 wprintf("<div id=\"banner\">\n");
1485 wprintf(_("Confirm move of message"));
1487 wprintf("</div>\n");
1489 wprintf("<div id=\"content\" class=\"service\">\n");
1491 wprintf("<CENTER>");
1493 wprintf(_("Move this message to:"));
1494 wprintf("<br />\n");
1496 wprintf("<form METHOD=\"POST\" action=\"move_msg\">\n");
1497 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1498 wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n", bstr("msgid"));
1500 wprintf("<SELECT NAME=\"target_room\" SIZE=5>\n");
1502 serv_getln(buf, sizeof buf);
1503 if (buf[0] == '1') {
1504 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1505 extract_token(targ, buf, 0, '|', sizeof targ);
1506 wprintf("<OPTION>");
1511 wprintf("</SELECT>\n");
1512 wprintf("<br />\n");
1514 wprintf("<INPUT TYPE=\"submit\" NAME=\"move_button\" VALUE=\"%s\">", _("Move"));
1516 wprintf("<INPUT TYPE=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1517 wprintf("</form></CENTER>\n");
1519 wprintf("</CENTER>\n");
1525 * Generic function to output an arbitrary MIME attachment from
1526 * message being composed
1528 * partnum The MIME part to be output
1529 * filename Fake filename to give
1530 * force_download Nonzero to force set the Content-Type: header to "application/octet-stream"
1532 void postpart(StrBuf *partnum, StrBuf *filename, int force_download)
1535 StrBuf *content_type;
1536 wc_mime_attachment *part;
1538 if (GetHash(WC->attachments, SKEY(partnum), &vPart) &&
1540 part = (wc_mime_attachment*) vPart;
1541 if (force_download) {
1542 content_type = NewStrBufPlain(HKEY("application/octet-stream"));
1545 content_type = NewStrBufDup(part->ContentType);
1547 StrBufAppendBuf(WC->WBuf, part->Data, 0);
1548 http_transmit_thing(ChrPtr(content_type), 0);
1550 hprintf("HTTP/1.1 404 %s\n", ChrPtr(partnum));
1551 output_headers(0, 0, 0, 0, 0, 0);
1552 hprintf("Content-Type: text/plain\r\n");
1553 wprintf(_("An error occurred while retrieving this part: %s/%s\n"),
1554 ChrPtr(partnum), ChrPtr(filename));
1557 FreeStrBuf(&content_type);
1562 * Generic function to output an arbitrary MIME part from an arbitrary
1563 * message number on the server.
1565 * msgnum Number of the item on the citadel server
1566 * partnum The MIME part to be output
1567 * force_download Nonzero to force set the Content-Type: header to "application/octet-stream"
1569 void mimepart(int force_download)
1571 wcsession *WCC = WC;
1574 StrBuf *ContentType = NewStrBufPlain(HKEY("application/octet-stream"));
1578 serv_printf("OPNA %s|%s", ChrPtr(WCC->UrlFragment2), ChrPtr(WCC->UrlFragment3));
1579 StrBuf_ServGetln(Buf);
1580 if (GetServerStatus(Buf, NULL) == 2) {
1581 StrBufCutLeft(Buf, 4);
1582 bytes = StrBufExtract_long(Buf, 0, '|');
1583 if (!force_download) {
1584 StrBufExtract_token(ContentType, Buf, 3, '|');
1587 read_server_binary(WCC->WBuf, bytes, Buf);
1589 StrBuf_ServGetln(Buf);
1590 CT = ChrPtr(ContentType);
1592 if (!force_download) {
1593 if (!strcasecmp(ChrPtr(ContentType), "application/octet-stream")) {
1594 CT = GuessMimeByFilename(SKEY(WCC->UrlFragment4));
1596 if (!strcasecmp(ChrPtr(ContentType), "application/octet-stream")) {
1597 CT = GuessMimeType(SKEY(WCC->WBuf));
1600 http_transmit_thing(CT, 0);
1602 StrBufCutLeft(Buf, 4);
1603 hprintf("HTTP/1.1 404 %s\n", ChrPtr(Buf));
1604 output_headers(0, 0, 0, 0, 0, 0);
1605 hprintf("Content-Type: text/plain\r\n");
1606 wprintf(_("An error occurred while retrieving this part: %s\n"),
1610 FreeStrBuf(&ContentType);
1616 * Read any MIME part of a message, from the server, into memory.
1618 StrBuf *load_mimepart(long msgnum, char *partnum)
1624 serv_printf("DLAT %ld|%s", msgnum, partnum);
1625 StrBuf_ServGetln(Buf);
1626 if (GetServerStatus(Buf, NULL) == 6) {
1627 StrBufCutLeft(Buf, 4);
1628 bytes = StrBufExtract_long(Buf, 0, '|');
1630 StrBuf_ServGetBLOBBuffered(Buf, bytes);
1640 * Read any MIME part of a message, from the server, into memory.
1642 void MimeLoadData(wc_mime_attachment *Mime)
1646 /* TODO: is there a chance the contenttype is different to the one we know? */
1647 serv_printf("DLAT %ld|%s", Mime->msgnum, ChrPtr(Mime->PartNum));
1649 StrBuf_ServGetln(Buf);
1650 if (GetServerStatus(Buf, NULL) == 6) {
1651 bytes = extract_long(&(ChrPtr(Buf)[4]), 0);
1653 if (Mime->Data == NULL)
1654 Mime->Data = NewStrBufPlain(NULL, bytes);
1655 StrBuf_ServGetBLOBBuffered(Mime->Data, bytes);
1658 FlushStrBuf(Mime->Data);
1659 /* TODO XImportant message */
1667 void view_mimepart(void) {
1671 void download_mimepart(void) {
1675 void view_postpart(void) {
1676 postpart(WC->UrlFragment2,
1681 void download_postpart(void) {
1682 postpart(WC->UrlFragment2,
1687 void h_readnew(void) { readloop(readnew);}
1688 void h_readold(void) { readloop(readold);}
1689 void h_readfwd(void) { readloop(readfwd);}
1690 void h_headers(void) { readloop(headers);}
1691 void h_do_search(void) { readloop(do_search);}
1693 void jsonMessageListHdr(void)
1695 /* TODO: make a generic function */
1696 hprintf("HTTP/1.1 200 OK\r\n");
1697 hprintf("Content-type: application/json; charset=utf-8\r\n");
1698 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
1699 hprintf("Connection: close\r\n");
1700 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
1703 /* Spit out the new summary view. This is basically a static page, so clients can cache the layout, all the dirty work is javascript :) */
1704 void new_summary_view(void) {
1706 DoTemplate(HKEY("msg_listview"),NULL,&NoCtx);
1707 DoTemplate(HKEY("trailing"),NULL,&NoCtx);
1710 /** Output message list in JSON-format */
1711 void jsonMessageList(void) {
1712 const StrBuf *room = sbstr("room");
1713 long oper = (havebstr("query")) ? do_search : readnew;
1724 RegisterPreference("use_sig",
1725 _("Attach signature to email messages?"),
1728 RegisterPreference("signature", _("Use this signature:"), PRF_QP_STRING, NULL);
1729 RegisterPreference("default_header_charset",
1730 _("Default character set for email headers:"),
1733 RegisterPreference("defaultfrom", _("Preferred email address"), PRF_STRING, NULL);
1734 RegisterPreference("defaultname",
1735 _("Preferred display name for email messages"),
1738 RegisterPreference("defaulthandle",
1739 _("Preferred display name for bulletin board posts"),
1742 RegisterPreference("mailbox",_("Mailbox view mode"), PRF_STRING, NULL);
1744 WebcitAddUrlHandler(HKEY("readnew"), h_readnew, NEED_URL);
1745 WebcitAddUrlHandler(HKEY("readold"), h_readold, NEED_URL);
1746 WebcitAddUrlHandler(HKEY("readfwd"), h_readfwd, NEED_URL);
1747 WebcitAddUrlHandler(HKEY("headers"), h_headers, NEED_URL);
1748 WebcitAddUrlHandler(HKEY("do_search"), h_do_search, 0);
1749 WebcitAddUrlHandler(HKEY("display_enter"), display_enter, 0);
1750 WebcitAddUrlHandler(HKEY("post"), post_message, 0);
1751 WebcitAddUrlHandler(HKEY("move_msg"), move_msg, 0);
1752 WebcitAddUrlHandler(HKEY("delete_msg"), delete_msg, 0);
1753 WebcitAddUrlHandler(HKEY("confirm_move_msg"), confirm_move_msg, 0);
1754 WebcitAddUrlHandler(HKEY("msg"), embed_message, NEED_URL|AJAX);
1755 WebcitAddUrlHandler(HKEY("printmsg"), print_message, NEED_URL);
1756 WebcitAddUrlHandler(HKEY("mobilemsg"), mobile_message_view, NEED_URL);
1757 WebcitAddUrlHandler(HKEY("msgheaders"), display_headers, NEED_URL);
1759 WebcitAddUrlHandler(HKEY("mimepart"), view_mimepart, NEED_URL);
1760 WebcitAddUrlHandler(HKEY("mimepart_download"), download_mimepart, NEED_URL);
1761 WebcitAddUrlHandler(HKEY("postpart"), view_postpart, NEED_URL);
1762 WebcitAddUrlHandler(HKEY("postpart_download"), download_postpart, NEED_URL);
1765 WebcitAddUrlHandler(HKEY("roommsgs"), jsonMessageList,0);
1770 SessionDetachModule_MSG
1773 DeleteHash(&sess->summ);