]> code.citadel.org Git - citadel.git/commitdiff
Display express messages in cute little JavaScript popup window.
authorArt Cancro <ajc@citadel.org>
Mon, 14 Dec 1998 05:11:53 +0000 (05:11 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 14 Dec 1998 05:11:53 +0000 (05:11 +0000)
webcit/ChangeLog
webcit/webcit.c

index c27dd5e2fc3291dd02d2652859c78bd0aa4ea785..264dfe0a53d7267f7a8956dc54434bcc00ca92dd 100644 (file)
@@ -11,6 +11,7 @@ Sun Dec 13 13:35:12 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * roomops.c: fixed buggy implementation of ungoto
        * Set up an option in output_headers() to optionally print the most
          often used opening HTML as well as the HTTP headers.
+       * Display express messages in cute little JavaScript popup window.
 
 Fri Dec 11 21:14:36 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Brought over message reading and entry functions from old WebCit
index ed680bc51cb7a636d528021c6026d0678ab6cb92..f5f1faa69a71955223dbf5b60b3b12df5b71d7cd 100644 (file)
@@ -31,6 +31,7 @@ int TransactionCount = 0;
 int connected = 0;
 int logged_in = 0;
 int axlevel;
+char *ExpressMessages = NULL;
 
 struct webcontent *wlist = NULL;
 struct webcontent *wlast = NULL;
@@ -286,11 +287,52 @@ void output_headers(int print_standard_html_head) {
                wprintf("<HTML><HEAD><TITLE>");
                escputs("WebCit");
                wprintf("</TITLE></HEAD>");
-               wprintf("<BODY BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
+               if (ExpressMessages != NULL) {
+                       wprintf("<SCRIPT language=\"javascript\">\n");
+                       wprintf("function ExpressMessage() {\n");
+                       wprintf(" alert(\"");
+                       escputs(ExpressMessages);
+                       wprintf("\")\n");
+                       wprintf(" }\n </SCRIPT>\n");
+                       }
+               wprintf("<BODY ");
+               if (ExpressMessages != NULL) {
+                       wprintf("onload=\"ExpressMessage()\" ");
+                       free(ExpressMessages);
+                       ExpressMessages = NULL;
+                       }
+               wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
                }
 
        }
 
+
+
+
+void check_for_express_messages() {
+       char buf[256];
+
+       serv_puts("PEXP");
+       serv_gets(buf);
+       if (buf[0]=='1') {
+               while (serv_gets(buf), strcmp(buf, "000")) {
+                       if (ExpressMessages == NULL) {
+                               ExpressMessages = malloc(strlen(buf) + 4);
+                               strcpy(ExpressMessages, "");
+                               }
+                       else {
+                               ExpressMessages = realloc(ExpressMessages,
+                                (strlen(ExpressMessages) + strlen(buf) + 4) );
+                               }
+                       strcat(ExpressMessages, buf);
+                       strcat(ExpressMessages, "\\n");
+                       }
+               }
+       }
+
+
+
+
 void output_static(char *what) {
        char buf[256];
        FILE *fp;
@@ -469,6 +511,7 @@ fclose(fp);
                get_serv_info();
                }
 
+       check_for_express_messages();
 
        /*
         * If we're not logged in, but we have username and password cookies