From: Wilfried Göesgens Date: Mon, 12 Jan 2009 20:14:46 +0000 (+0000) Subject: + add =() subtemplates for params X-Git-Tag: v7.86~1619 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=fe897801fd90cd5a8b7cbda3461694fda6506a11 + add =() subtemplates for params * fix some warnings and non-C90 cleanness. --- diff --git a/webcit/messages.c b/webcit/messages.c index 652083d5a..413f9d668 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -18,16 +18,9 @@ int analyze_msg = 0; #define SENDER_COL_WIDTH_PCT 30 /**< Mailbox view column width */ #define DATE_PLUS_BUTTONS_WIDTH_PCT 20 /**< Mailbox view column width */ - +void jsonMessageListHdr(void); void display_enter(void); -int longcmp_r(const void *s1, const void *s2); -int summcmp_subj(const void *s1, const void *s2); -int summcmp_rsubj(const void *s1, const void *s2); -int summcmp_sender(const void *s1, const void *s2); -int summcmp_rsender(const void *s1, const void *s2); -int summcmp_date(const void *s1, const void *s2); -int summcmp_rdate(const void *s1, const void *s2); /*----------------------------------------------------------------------------*/ @@ -928,11 +921,11 @@ DONE: } /** Note: wDumpContent() will output one additional tag. */ if (WCC->wc_view != VIEW_MAILBOX) { - // We ought to move this out into template - wprintf("\n"); /** end of 'content' div */ - wDumpContent(1); + /* We ought to move this out into template */ + wprintf("\n"); /** end of 'content' div */ + wDumpContent(1); } else { - end_burst(); + end_burst(); } WCC->startmsg = 0; WCC->maxmsgs = 0; @@ -1640,8 +1633,9 @@ void h_readfwd(void) { readloop(readfwd);} void h_headers(void) { readloop(headers);} void h_do_search(void) { readloop(do_search);} -void jsonMessageListHdr(void) { - // TODO: make a generic function +void jsonMessageListHdr(void) +{ + /* TODO: make a generic function */ hprintf("HTTP/1.1 200 OK\r\n"); hprintf("Content-type: application/json; charset=utf-8\r\n"); hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software)); @@ -1649,7 +1643,7 @@ void jsonMessageListHdr(void) { hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n"); begin_burst(); } -// Spit out the new summary view. This is basically a static page, so clients can cache the layout, all the dirty work is javascript :) +/* Spit out the new summary view. This is basically a static page, so clients can cache the layout, all the dirty work is javascript :) */ void new_summary_view(void) { output_headers(1,1,1,0,0,1); begin_burst(); @@ -1659,7 +1653,7 @@ void new_summary_view(void) { } /** Output message list in JSON-format */ void jsonMessageList(void) { - StrBuf *room = sbstr("room"); + const StrBuf *room = sbstr("room"); WC->is_ajax = 1; smart_goto(room); WC->is_ajax = 0; @@ -1709,7 +1703,7 @@ InitModule_MSG WebcitAddUrlHandler(HKEY("postpart"), view_postpart, NEED_URL); WebcitAddUrlHandler(HKEY("postpart_download"), download_postpart, NEED_URL); - // json + /* json */ WebcitAddUrlHandler(HKEY("roommsgs"), jsonMessageList,0); WebcitAddUrlHandler(HKEY("mimepart"), view_mimepart, NEED_URL); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index f6d31e90f..22eace1db 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -403,32 +403,33 @@ void tmplput_MAIL_SUMM_ALLRCPT(StrBuf *Target, WCTemplputParams *TP) HashList *iterate_get_mailsumm_All(StrBuf *Target, WCTemplputParams *TP) { - return WC->summ; + return WC->summ; } int Conditional_ROOM_DISPLAY_MSG(StrBuf *Target, WCTemplputParams *TP) { - //message_summary *Msg = (message_summary *) CTX; - wcsubst *subst; - wcsession *WCC = WC; - GetHash(WCC->vars, HKEY("ITERATE:N"), (void *)&subst); - long num_inset = subst->lvalue; - if ((num_inset >= WC->startmsg) && (WCC->num_displayed <= WCC->maxmsgs)) { - WCC->num_displayed = WCC->num_displayed+1; - return 1; // Pass GO, collect $200 - } - return 0; + long num_inset; + wcsubst *subst; + wcsession *WCC = WC; + + GetHash(WCC->vars, HKEY("ITERATE:N"), (void *)&subst); + num_inset = subst->lvalue; + if ((num_inset >= WC->startmsg) && (WCC->num_displayed <= WCC->maxmsgs)) { + WCC->num_displayed = WCC->num_displayed+1; + return 1; /* Pass GO, collect $200 */ + } + return 0; } int Conditional_MAIL_SUMM_LASTMSG(StrBuf *Target, WCTemplputParams *TP) { - wcsubst *nsubst, *n_dsubst; - long is_last_n; + wcsubst *nsubst; + long is_last_n; - GetHash(WC->vars, HKEY("ITERATE:LASTN"), (void *)&nsubst); - is_last_n = nsubst->lvalue; - - //GetHash(WC->vars, HKEY("ITERATE:N"), (void *)&n_dsubst); - //num_inset = n_dsubst->lvalue; - - // Is the num_displayed higher than maxmsgs? OR last in iterator - return ((WC->num_displayed > WC->maxmsgs) || (is_last_n == 1)); + GetHash(WC->vars, HKEY("ITERATE:LASTN"), (void *)&nsubst); + is_last_n = nsubst->lvalue; +/* + //GetHash(WC->vars, HKEY("ITERATE:N"), (void *)&n_dsubst); + //num_inset = n_dsubst->lvalue; + */ + /* Is the num_displayed higher than maxmsgs? OR last in iterator */ + return ((WC->num_displayed > WC->maxmsgs) || (is_last_n == 1)); } void examine_time(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) { diff --git a/webcit/roomops.c b/webcit/roomops.c index e7a8441b9..5a7e8347a 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -12,17 +12,17 @@ char *viewdefs[9]; /**< the different kinds of available views */ /** See GetFloorListHash and GetRoomListHash for info on these. Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys. */ const char FLOOR_PARAM_NAMES[(FLOOR_PARAM_LEN + 1)][15] = {"ID", - "NAME", - "ROOMS"}; + "NAME", + "ROOMS"}; const char ROOM_PARAM_NAMES[(ROOM_PARAM_LEN + 1)][20] = {"NAME", - "FLAG", - "FLOOR", - "LISTORDER", - "ACL", - "CURVIEW", - "DEFVIEW", - "LASTCHANGE"}; -// Because avoiding strlen at run time is a Good Thing(TM) + "FLAG", + "FLOOR", + "LISTORDER", + "ACL", + "CURVIEW", + "DEFVIEW", + "LASTCHANGE"}; +/* Because avoiding strlen at run time is a Good Thing(TM) */ const int FLOOR_PARAM_NAMELEN[(FLOOR_PARAM_LEN +1)] = {2, 4, 5}; const int ROOM_PARAM_NAMELEN[(ROOM_PARAM_LEN +1)] = {4, 4, 5, 9, 3, 7, 7, 8}; @@ -49,22 +49,22 @@ void initialize_viewdefs(void) { int is_view_allowed_as_default(int which_view) { switch(which_view) { - case VIEW_BBS: return(1); - case VIEW_MAILBOX: return(1); - case VIEW_ADDRESSBOOK: return(1); - case VIEW_CALENDAR: return(1); - case VIEW_TASKS: return(1); - case VIEW_NOTES: return(1); + case VIEW_BBS: return(1); + case VIEW_MAILBOX: return(1); + case VIEW_ADDRESSBOOK: return(1); + case VIEW_CALENDAR: return(1); + case VIEW_TASKS: return(1); + case VIEW_NOTES: return(1); #ifdef TECH_PREVIEW - case VIEW_WIKI: return(1); + case VIEW_WIKI: return(1); #else /* TECH_PREVIEW */ - case VIEW_WIKI: return(0); /* because it isn't finished yet */ + case VIEW_WIKI: return(0); /* because it isn't finished yet */ #endif /* TECH_PREVIEW */ - case VIEW_CALBRIEF: return(0); - case VIEW_JOURNAL: return(0); - default: return(0); /* should never get here */ + case VIEW_CALBRIEF: return(0); + case VIEW_JOURNAL: return(0); + default: return(0); /* should never get here */ } } @@ -318,15 +318,15 @@ void readinfo(StrBuf *Target, WCTemplputParams *TP) strcpy(&briefinfo[50], "..."); wprintf("
"); + "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" " + ">"); escputs(briefinfo); wprintf("
"); wprintf("\"%s\"", _("Close window") - ); + ); escputs(fullinfo); wprintf("
"); } @@ -362,37 +362,37 @@ void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP) wprintf("\"\"" - ); + ); } else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) { wprintf("\"\"" - ); + ); } else if (WC->wc_view == VIEW_TASKS) { wprintf("\"\"" - ); + ); } else if (WC->wc_view == VIEW_NOTES) { wprintf("\"\"" - ); + ); } else if (WC->wc_view == VIEW_MAILBOX) { wprintf("\"\"" - ); + ); } else { wprintf("\"\"" - ); + ); } } @@ -428,7 +428,7 @@ void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP) || ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */ || ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */ /** || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */ - ) { + ) { wprintf("