5 int json_GetParamsGetServerCall(SharedMessageStatus * Stat,
6 void **ViewSpecific, long oper, char *cmd, long len, char *filter, long flen) {
7 Stat->defaultsortorder = 2;
10 /* Generally using maxmsgs|startmsg is not required
11 in mailbox view, but we have a 'safemode' for clients
12 (*cough* Exploder) that simply can't handle too many */
13 if (havebstr("maxmsgs"))
14 Stat->maxmsgs = ibstr("maxmsgs");
16 Stat->maxmsgs = 9999999;
17 if (havebstr("startmsg"))
18 Stat->startmsg = lbstr("startmsg");
19 snprintf(cmd, len, "MSGS %s|%s||1", (oper == do_search) ? "SEARCH" : "ALL", (oper == do_search) ? bstr("query") : "");
23 int json_MessageListHdr(SharedMessageStatus * Stat, void **ViewSpecific) {
24 /* TODO: make a generic function */
25 hprintf("HTTP/1.1 200 OK\r\n");
26 hprintf("Content-type: application/json; charset=utf-8\r\n");
27 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
28 hprintf("Connection: close\r\n");
29 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
34 int json_RenderView_or_Tail(SharedMessageStatus * Stat, void **ViewSpecific, long oper) {
35 DoTemplate(HKEY("mailsummary_json"), NULL, NULL);
40 int json_Cleanup(void **ViewSpecific) {
41 /* Note: wDumpContent() will output one additional </div> tag. */
42 /* We ought to move this out into template */
48 void InitModule_JSONRENDERER(void) {
49 RegisterReadLoopHandlerset(VIEW_JSON_LIST, json_GetParamsGetServerCall, json_MessageListHdr, NULL, /* TODO: is this right? */
50 ParseMessageListHeaders_Detail, NULL, json_RenderView_or_Tail, json_Cleanup, NULL);