]> code.citadel.org Git - citadel.git/blobdiff - webcit/paging.c
Trust the compiler to do short-circuit evaluation.
[citadel.git] / webcit / paging.c
index 502f9c069a1ff1a28a58de88e98b271d291a4717..acfcdd97c57d4b76c6730e26cfb2d092e74d219b 100644 (file)
@@ -35,6 +35,7 @@ void display_page(void)
 
        wprintf("<FORM METHOD=\"POST\" action=\"page_user\">\n");
        wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
+       wprintf("<input type=\"hidden\" name=\"template\" value=\"who\">\n");
 
        wprintf("<TABLE border=0 width=100%%><TR><TD>\n");
 
@@ -93,7 +94,7 @@ void page_user(void)
                }
        }
 
-       who();
+       url_do_template();
 }
 
 
@@ -128,7 +129,7 @@ void do_chat(void)
         * output by begin_ajax_response() happen to be the ones we need.)
         */
        begin_ajax_response();
-       do_template("chatframeset");
+       do_template("chatframeset", NULL);
        end_ajax_response();
        return;
 }
@@ -141,6 +142,7 @@ void do_chat(void)
  */
 void page_popup(void)
 {
+       int len;
        char buf[SIZ];
 
        /** JavaScript function to alert the user that popups are probably blocked */
@@ -157,8 +159,8 @@ void page_popup(void)
 
        /** First, do the check as part of our page load. */
        serv_puts("NOOP");
-       serv_getln(buf, sizeof buf);
-       if (buf[3] == '*') {
+       len = serv_getln(buf, sizeof buf);
+       if ((len >= 3) && (buf[3] == '*')) {
                if ((time(NULL) - WC->last_pager_check) > 60) {
                        wprintf("<script type=\"text/javascript\">"
                                " var oWin = window.open('static/instant_messenger.html', "
@@ -302,7 +304,7 @@ void chat_recv(void) {
                pf.fd = WC->chat_sock;
                pf.events = POLLIN;
                pf.revents = 0;
-               if (poll(&pf, 1, 1) > 0) if (pf.revents & POLLIN) {
+               if ((poll(&pf, 1, 1) > 0) && (pf.revents & POLLIN)) {
                        ++got_data;
 
                        /** Temporarily swap the serv and chat sockets during chat talk */