New way to display incoming instant messages. Not finished.
authorArt Cancro <ajc@citadel.org>
Mon, 2 Jan 2006 18:41:35 +0000 (18:41 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 2 Jan 2006 18:41:35 +0000 (18:41 +0000)
webcit/ChangeLog
webcit/configure.in
webcit/mainmenu.c
webcit/messages.c
webcit/paging.c
webcit/static/wclib.js
webcit/static/webcit.css
webcit/webcit.c
webcit/webcit.h

index 7c9cd80b6f7656f9b74833588f94c244c555f199..aa91ac559216fc5b0e78fe0b040a379b87dbd448 100644 (file)
@@ -1,5 +1,8 @@
 $Id$
 
+Mon Jan  2 13:36:56 EST 2006 ajc
+* New way to display incoming instant messages.  Not finished.
+
 Thu Dec 22 12:07:38 EST 2005 ajc
 * Added missing HTTP headers to do_chat()
 
index b7ec53f1840f898303030082d3fe515f2cbdedc3..701754ef3a558f23d300e9b453b49fa61689c997 100644 (file)
@@ -13,6 +13,7 @@ AC_SUBST(VERSION)
 AC_SUBST(PROG_SUBDIRS)
 AC_CANONICAL_HOST
 AC_PROG_INSTALL
+AC_CHECK_PROG(AUTOCONF, autoconf)
 AC_CHECK_PROG(SED, sed, sed, no)
 AC_PREFIX_DEFAULT(/usr/local/webcit)
 
@@ -64,8 +65,8 @@ if test "$GCC" = yes; then
        esac
 fi
 
-dnl ### missing_dir=`cd $ac_aux_dir && pwd`
-dnl ### AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+# missing_dir=`cd $ac_aux_dir && pwd`
+# AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
 
 dnl Checks for libraries.
 if test "$LIBS" != -pthread; then
index 7412bb65c8cc105768f19bc1aad6969465dfbd88..a1450c91d4fcdc2254040a9eb99fd010bd17186d 100644 (file)
@@ -55,8 +55,8 @@ void display_main_menu(void)
                wprintf(_("Ungoto"));
                wprintf("</span></A><br />"
                        "<span class=\"menudesc\">");
-               wprintf(_("(oops! Back to %s)"));
-               wprintf("</span>\n", WC->ugname);
+               wprintf(_("(oops! Back to %s)"), WC->ugname);
+               wprintf("</span>\n");
        }
 
        wprintf("</TD><TD>\n"); /* start of second column */
index f7b8a95d553002fc7e5f9d95baad6efc1e1484b7..6b9a51a7cbee022be440b6cd5aacaa4401f01e9a 100644 (file)
@@ -1844,6 +1844,7 @@ void readloop(char *oper)
        int is_calendar = 0;
        int is_tasks = 0;
        int is_notes = 0;
+       int is_bbview = 0;
        int lo, hi;
        int lowest_displayed = (-1);
        int highest_displayed = 0;
@@ -1855,7 +1856,7 @@ void readloop(char *oper)
        char *subjsort_button;
        char *sendsort_button;
        char *datesort_button;
-       int bbs_reverse = 0;    /* FIXME we need to set/reset this option now.  It works. */
+       int bbs_reverse = 0;
 
        startmsg = atol(bstr("startmsg"));
        maxmsgs = atoi(bstr("maxmsgs"));
@@ -2130,14 +2131,30 @@ void readloop(char *oper)
                }
        }
 
+       /* Set the "is_bbview" variable if it appears that we are looking at
+        * a classic bulletin board view.
+        */
+       if (num_displayed > 1) {
+          if ((!is_tasks) && (!is_calendar) && (!is_addressbook)
+             && (!is_notes) && (!is_singlecard) && (!is_summary)) {
+               is_bbview = 1;
+       }
+
+       /* Output loop */
        if (displayed_msgs != NULL) {
                if (bbs_reverse) {
                        qsort(displayed_msgs, num_displayed, sizeof(long), longcmp_r);
                }
 
+               if (is_bbview) {
+                       wprintf("<div id=\"bbview_scroller\">");
+               }
                for (a=0; a<num_displayed; ++a) {
                        read_message(displayed_msgs[a], 0, "");
                }
+               if (is_bbview) {
+                       wprintf("</div>\n");
+               }
                free(displayed_msgs);
                displayed_msgs = NULL;
        }
@@ -2170,10 +2187,8 @@ void readloop(char *oper)
         * If we're not currently looking at ALL requested
         * messages, then display the selector bar
         */
-       if (num_displayed > 1) {
-          if ((!is_tasks) && (!is_calendar) && (!is_addressbook)
-             && (!is_notes) && (!is_singlecard) && (!is_summary)) {
-
+       if (is_bbview) {
+               wprintf("<div id=\"bbview_selector\">");
                wprintf("<form name=\"msgomatic\">");
                wprintf(_("Reading #"), lowest_displayed, highest_displayed);
 
@@ -2246,7 +2261,7 @@ void readloop(char *oper)
                        oper
                );
        
-               wprintf("</select></form>\n");
+               wprintf("</select></form></div>\n");
            }
        }
 
index c9d14b9272ccd34f9a70f0fa6f0bf016877b37d1..ba9c056f82c683bdf60ce361d8d41ae8e3cf15f2 100644 (file)
@@ -154,29 +154,18 @@ void do_chat(void)
 void page_popup(void)
 {
        char buf[SIZ];
-       char pagefrom[SIZ];
 
-       while (serv_puts("GEXP"), serv_getln(buf, sizeof buf), buf[0]=='1') {
-
-               extract_token(pagefrom, &buf[4], 3, '|', sizeof pagefrom);
-
-               wprintf("<table border=1 bgcolor=\"#880000\"><tr><td>");
-               wprintf("<span class=\"titlebar\">");
-               wprintf(_("Instant message from "));
-               escputs(pagefrom);
-               wprintf("</span></td></tr><tr><td><font color=\"#FFFFFF\">");
-               fmout("LEFT");
-               wprintf("</font></td></tr>"
-                       "<tr><td><div align=center><font color=\"#FFFFFF\">"
-                       "<a href=\"javascript:hide_page_popup()\">");
-               wprintf(_("[ close window ]"));
-               wprintf("</a>"
-                       "</font></div>"
-                       "</td></tr>"
-                       "</table>\n");
+       serv_puts("NOOP");
+       serv_getln(buf, sizeof buf);
+       if (buf[3] == '*') {
+               if ((time(NULL) - WC->last_pager_check) > 120) {
+                       wprintf("<script type=\"text/javascript\">"
+                               " window.open('static/instant_messenger.html', 'CTDL_MESSENGER', "
+                               " 'width=600,height=400');"
+                               "</script>"
+                       );      
+               }
        }
-
-       WC->HaveInstantMessages = 0;
 }
 
 
@@ -481,4 +470,3 @@ void chat_send(void) {
        wDumpContent(0);
 }
 
-
index b56ab0bfa62fbba83933bd566da54aa52a1bbb68..78e7cc5c8fc2e8d542d8b5d7adee6e9394733fc7 100644 (file)
@@ -18,22 +18,32 @@ if (window.navigator.userAgent.toLowerCase().match("gecko")) {
 var ns6=document.getElementById&&!document.all;
 
 
-//
-// This code handles the popups for instant messages.
-//
 
+// We love string tokenizers.
+function extract_token(source_string, token_num, delimiter) {
+       var i = 0;
+       var extracted_string = source_string;
 
-function hide_page_popup() {
-       if (browserType == "gecko" )
-               document.poppedLayer = eval('document.getElementById(\'page_popup\')');
-       else if (browserType == "ie")
-               document.poppedLayer = eval('document.all[\'page_popup\']');
-       else
-               document.poppedLayer = eval('document.layers[\'`page_popup\']');
+       if (token_num > 0) {
+               for (i=0; i<token_num; ++i) {
+                       var j = extracted_string.indexOf(delimiter);
+                       if (j >= 0) {
+                               extracted_string = extracted_string.substring(j+1);
+                       }
+               }
+       }
 
-       document.poppedLayer.style.visibility = "hidden";
+       j = extracted_string.indexOf(delimiter);
+       if (j >= 0) {
+               extracted_string = extracted_string.substring(0, j);
+       }
+
+       return extracted_string;
 }
 
+
+
+// This code handles the popups for important-messages.
 function hide_imsg_popup() {
        if (browserType == "gecko" )
                document.poppedLayer = eval('document.getElementById(\'important_message\')');
@@ -45,6 +55,7 @@ function hide_imsg_popup() {
        document.poppedLayer.style.visibility = "hidden";
 }
 
+
 // This function activates the ajax-powered recipient autocompleters on the message entry screen.
 function activate_entmsg_autocompleters() {
        new Ajax.Autocompleter('cc_id', 'cc_name_choices', 'cc_autocomplete', {} );
index e20f103751f5a5746ebaaa2b1d41af86d1ce5ca8..0f3731d8ff61b2034fd711a643576e65636276f0 100644 (file)
@@ -56,13 +56,6 @@ body {
        background: #445;
 }
 
-#page_popup {
-       position:absolute;
-       top:100px; left:100px;
-       background-color: #880000;
-       z-index: 2;
-}
-
 #important_message {
        position:absolute;
        top:0px; right:0px;
@@ -176,9 +169,50 @@ body {
        overflow: auto;
 }
 
+
+#bbview_scroller {
+       position:fixed;
+       display:block;
+       top: 15%;
+       left: 15%;
+       width: 85%;
+       height: 80%;
+       overflow: auto;
+}
+
+* html #bbview_scroller {
+       position:absolute;
+       display:block;
+       top: 15%;
+       left: 15%;
+       width: 85%;
+       height: 80%;
+       overflow: auto;
+}
+
+#bbview_selector {
+       position:fixed;
+       display:block;
+       top: 95%;
+       left: 15%;
+       width: 85%;
+       height: 5%;
+       overflow: none;
+}
+
+* html #bbview_selector {
+       position:absolute;
+       display:block;
+       top: 95%;
+       left: 15%;
+       width: 85%;
+       height: 5%;
+       overflow: none;
+}
+
 #fix_scrollbar_bug {
-       margin-right:1px;               /* Gecko */
-       width: expression('97%');       /* Only IE6 understands 'expression' and it also has the weird scrollbarbug */
+       margin-right:1px;               /* Gecko and other non-broken browsers */
+       width: expression('97%');       /* Only IE6 understands 'expression' - fixes weird scrollbarbug */
 }
 
 #button {
index 84747e300e886113c03ad214db910044fc3f353f..046c603d738e6408dec77c9748727058139d4a3b 100644 (file)
@@ -390,11 +390,10 @@ void output_headers(      int do_httpheaders,     /* 1 = output HTTP headers
        /* ICONBAR */
        if (do_htmlhead) {
 
-               if (WC->HaveInstantMessages) {
-                       wprintf("<div id=\"page_popup\">\n");
-                       page_popup();
-                       wprintf("</div>\n");
-               }
+               /* check for instant messages (these display in a new window) */
+               page_popup();
+
+               /* check for ImportantMessages (these display in a div overlaying the main screen) */
                if (strlen(WC->ImportantMessage) > 0) {
                        wprintf("<div id=\"important_message\">\n");
                        wprintf("<SPAN CLASS=\"imsg\">"
@@ -438,18 +437,6 @@ void http_redirect(char *whichpage) {
 
 
 
-void check_for_instant_messages()
-{
-       char buf[SIZ];
-
-       serv_puts("NOOP");
-       serv_getln(buf, sizeof buf);
-       if (buf[3] == '*') WC->HaveInstantMessages = 1;
-}
-
-
-
-
 /* 
  * Output a piece of content to the web browser
  */
@@ -1232,11 +1219,6 @@ void session_loop(struct httprequest *req)
                }
        }
 
-       /*
-        * If there are instant messages waiting, retrieve them for display.
-        */
-       check_for_instant_messages();
-
        if (!strcasecmp(action, "image")) {
                output_image();
 
index 93cb74756b301bbe886a2e41151c6446892fa86f..4ed7997d6534e9406924fa48769d867a2e6367be 100644 (file)
@@ -339,14 +339,11 @@ struct wcsession {
        int killthis;                   /* Nonzero == purge this session */
        struct march *march;            /* march mode room list */
        char reply_to[512];             /* reply-to address */
-
        long msgarr[10000];             /* for read operations */
        int num_summ;
        struct message_summary *summ;
-
        int is_wap;                     /* Client is a WAP gateway */
        struct urlcontent *urlstrings;
-       int HaveInstantMessages;        /* Nonzero if incoming msgs exist */
        struct wcsubst *vars;
        char this_page[512];            /* address of current page */
        char http_host[512];            /* HTTP Host: header */
@@ -364,21 +361,18 @@ struct wcsession {
        int ctdl_pid;                   /* Session ID on the Citadel server */
        char httpauth_user[256];        /* only for GroupDAV sessions */
        char httpauth_pass[256];        /* only for GroupDAV sessions */
-
        size_t burst_len;
        char *burst;
        int gzip_ok;                    /* Nonzero if Accept-encoding: gzip */
        int is_mailbox;                 /* the current room is a private mailbox */
-
        struct folder *cache_fold;      /* cache the iconbar room list */
        int cache_max_folders;
        int cache_num_floors;
        time_t cache_timestamp;
-
        int current_iconbar;            /* What's currently in the iconbar? */
        char floordiv_expanded[32];     /* which floordiv currently expanded */
-
        int selected_language;          /* Language selected by user */
+       time_t last_pager_check;        /* last time we polled for instant msgs */
 };
 
 /* values for WC->current_iconbar */