From: Art Cancro Date: Mon, 2 Jan 2006 18:41:35 +0000 (+0000) Subject: New way to display incoming instant messages. Not finished. X-Git-Tag: v7.86~4355 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=906b7c88f631465125f676cd65f2984033be358f;p=citadel.git New way to display incoming instant messages. Not finished. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 7c9cd80b6..aa91ac559 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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() diff --git a/webcit/configure.in b/webcit/configure.in index b7ec53f18..701754ef3 100644 --- a/webcit/configure.in +++ b/webcit/configure.in @@ -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 diff --git a/webcit/mainmenu.c b/webcit/mainmenu.c index 7412bb65c..a1450c91d 100644 --- a/webcit/mainmenu.c +++ b/webcit/mainmenu.c @@ -55,8 +55,8 @@ void display_main_menu(void) wprintf(_("Ungoto")); wprintf("
" ""); - wprintf(_("(oops! Back to %s)")); - wprintf("\n", WC->ugname); + wprintf(_("(oops! Back to %s)"), WC->ugname); + wprintf("\n"); } wprintf("\n"); /* start of second column */ diff --git a/webcit/messages.c b/webcit/messages.c index f7b8a95d5..6b9a51a7c 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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("
"); + } for (a=0; a\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("
"); wprintf("
"); wprintf(_("Reading #"), lowest_displayed, highest_displayed); @@ -2246,7 +2261,7 @@ void readloop(char *oper) oper ); - wprintf("
\n"); + wprintf("
\n"); } } diff --git a/webcit/paging.c b/webcit/paging.c index c9d14b927..ba9c056f8 100644 --- a/webcit/paging.c +++ b/webcit/paging.c @@ -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("" - "" - "
"); - wprintf(""); - wprintf(_("Instant message from ")); - escputs(pagefrom); - wprintf("
"); - fmout("LEFT"); - wprintf("
" - "
\n"); + serv_puts("NOOP"); + serv_getln(buf, sizeof buf); + if (buf[3] == '*') { + if ((time(NULL) - WC->last_pager_check) > 120) { + wprintf("" + ); + } } - - WC->HaveInstantMessages = 0; } @@ -481,4 +470,3 @@ void chat_send(void) { wDumpContent(0); } - diff --git a/webcit/static/wclib.js b/webcit/static/wclib.js index b56ab0bfa..78e7cc5c8 100644 --- a/webcit/static/wclib.js +++ b/webcit/static/wclib.js @@ -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= 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', {} ); diff --git a/webcit/static/webcit.css b/webcit/static/webcit.css index e20f10375..0f3731d8f 100644 --- a/webcit/static/webcit.css +++ b/webcit/static/webcit.css @@ -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 { diff --git a/webcit/webcit.c b/webcit/webcit.c index 84747e300..046c603d7 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -390,11 +390,10 @@ void output_headers( int do_httpheaders, /* 1 = output HTTP headers /* ICONBAR */ if (do_htmlhead) { - if (WC->HaveInstantMessages) { - wprintf("
\n"); - page_popup(); - wprintf("
\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("
\n"); wprintf("" @@ -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(); diff --git a/webcit/webcit.h b/webcit/webcit.h index 93cb74756..4ed7997d6 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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 */