* fix_scrollbar_bug is now a class instead of an id. Fixes validator warnings.
[citadel.git] / webcit / paging.c
index a72dba26bcff1e5346f1126d9188acdd33703426..ddc2fbbeaf1087422b7dbb255e2d15ce4f9bba01 100644 (file)
@@ -25,7 +25,7 @@ void display_page(void)
                 "</div>\n<div id=\"content\">\n"
         );
                                                                                                                              
-        wprintf("<div id=\"fix_scrollbar_bug\">"
+        wprintf("<div class=\"fix_scrollbar_bug\">"
                "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
 
        wprintf(_("Send an instant message to: "));
@@ -156,17 +156,35 @@ void page_popup(void)
 {
        char buf[SIZ];
 
+       /* First, do the check as part of our page load. */
        serv_puts("NOOP");
        serv_getln(buf, sizeof buf);
        if (buf[3] == '*') {
                if ((time(NULL) - WC->last_pager_check) > 60) {
                        wprintf("<script type=\"text/javascript\">"
                                " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
-                               " 'width=600,height=400');"
+                               " 'width=700,height=400');"
                                "</script>"
                        );      
                }
        }
+
+       /* Then schedule it to happen again a minute from now if the user is idle. */
+       wprintf("<script type=\"text/javascript\">      \n"
+               " function HandleSslp(sslg_xmlresponse) {       \n"
+               "  sslg_response = sslg_xmlresponse.responseText.substr(0, 1);  \n"
+               "  if (sslg_response == 'Y') {  \n"
+               "   window.open('static/instant_messenger.html', 'CTDL_MESSENGER',      \n"
+               "    'width=700,height=400');   \n"
+               "   }   \n"
+               " }     \n"
+               " function CheckPager() {       \n"
+               "  new Ajax.Request('sslg', { method: 'get', parameters: Math.random(), \n"
+               "   onSuccess: HandleSslp } );  \n"
+               " }     \n"
+               " new PeriodicalExecuter(CheckPager, 30);       \n"
+               "</script>      \n"
+       );
 }
 
 
@@ -355,7 +373,7 @@ void chat_recv(void) {
                                if (strcasecmp(cl_user, WC->last_chat_user)) {
                                        wprintf("<B>");
        
-                                       if (!strcasecmp(cl_user, WC->wc_username)) {
+                                       if (!strcasecmp(cl_user, WC->wc_fullname)) {
                                                wprintf("<FONT COLOR=&quot;#FF0000&quot;>");
                                        }
                                        else {