]> code.citadel.org Git - citadel.git/commitdiff
* Moved a bunch of other global variables to per-session variables
authorArt Cancro <ajc@citadel.org>
Mon, 6 Dec 1999 03:40:30 +0000 (03:40 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 6 Dec 1999 03:40:30 +0000 (03:40 +0000)
webcit/ChangeLog
webcit/messages.c
webcit/webcit.c
webcit/webcit.h

index 31e2c29d478235547744a10dc05beadb7e9a439d..89315c9c9339c04dc14206399af656a9c5927a5a 100644 (file)
@@ -1,4 +1,7 @@
 $Log$
+Revision 1.117  1999/12/06 03:40:29  ajc
+* Moved a bunch of other global variables to per-session variables
+
 Revision 1.116  1999/12/06 02:05:33  ajc
 * Moved global march list into per-session context
 
@@ -347,3 +350,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index f1779a19d74c2137ae4b8240f9308989f7204cab..cea643cc17bbd691fdc62182a85dc1c8d6d79947 100644 (file)
@@ -27,9 +27,6 @@
 
 
 
-char reply_to[512];    /* FIX make these session-specific!!! */
-long msgarr[1024];
-
 /*
  * Look for URL's embedded in a buffer and make them linkable.  We use a
  * target window in order to keep the BBS session in its own window.
@@ -109,7 +106,7 @@ char *oper;
        wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFF00\"> ");
        strcpy(m_subject, "");
 
-       strcpy(reply_to, "nobody...xxxxx");
+       strcpy(WC->reply_to, "nobody...xxxxx");
        while (serv_gets(buf), strncasecmp(buf, "text", 4)) {
                if (!strncasecmp(buf, "nhdr=yes", 8))
                        nhdr = 1;
@@ -122,7 +119,7 @@ char *oper;
                        strcpy(from, &buf[5]);
                }
                if (!strncasecmp(buf, "path=", 5))
-                       strcpy(reply_to, &buf[5]);
+                       strcpy(WC->reply_to, &buf[5]);
                if (!strncasecmp(buf, "subj=", 5))
                        strcpy(m_subject, &buf[5]);
                if ((!strncasecmp(buf, "hnod=", 5))
@@ -140,9 +137,9 @@ char *oper;
                        }
                        if ((!strcasecmp(&buf[5], serv_info.serv_nodename))
                        || (!strcasecmp(&buf[5], serv_info.serv_fqdn))) {
-                               strcpy(reply_to, from);
+                               strcpy(WC->reply_to, from);
                        } else if (haschar(&buf[5], '.') == 0) {
-                               sprintf(reply_to, "%s @ %s", from, &buf[5]);
+                               sprintf(WC->reply_to, "%s @ %s", from, &buf[5]);
                        }
                }
                if (!strncasecmp(buf, "rcpt=", 5))
@@ -224,7 +221,7 @@ char *servcmd;
                return (nummsgs);
        }
        while (serv_gets(buf), strcmp(buf, "000")) {
-               msgarr[nummsgs] = atol(buf);
+               WC->msgarr[nummsgs] = atol(buf);
                ++nummsgs;
        }
        return (nummsgs);
@@ -267,7 +264,7 @@ void readloop(char *oper)
                goto DONE;
        }
        for (a = 0; a < nummsgs; ++a) {
-               read_message(msgarr[a], oper);
+               read_message(WC->msgarr[a], oper);
        }
 
       DONE:wDumpContent(1);
index f24e5b34931a476e709bcff07b6f49e5c2bed045..b98374e26863a74a86e8ce8cecbfbbe23733023c 100644 (file)
 #include "webcit.h"
 
 
-
-char *ExpressMessages = NULL;  /* FIX move to session context */
-
-/* This variable is set to 1 if the room banner and menubar have been
- * displayed, and we need to close the <TABLE> tags.
- */
-int fake_frames = 0;   /* FIX move to session context */
-
-struct urlcontent *urlstrings = NULL;
-
-
 void unescape_input(char *buf)
 {
        int a, b;
@@ -87,8 +76,8 @@ void addurls(char *url)
                buf[b] = 0;
 
                u = (struct urlcontent *) malloc(sizeof(struct urlcontent));
-               u->next = urlstrings;
-               urlstrings = u;
+               u->next = WC->urlstrings;
+               WC->urlstrings = u;
                strcpy(u->url_key, buf);
 
                /* now chop that part off */
@@ -123,11 +112,11 @@ void free_urls(void)
 {
        struct urlcontent *u;
 
-       while (urlstrings != NULL) {
-               free(urlstrings->url_data);
-               u = urlstrings->next;
-               free(urlstrings);
-               urlstrings = u;
+       while (WC->urlstrings != NULL) {
+               free(WC->urlstrings->url_data);
+               u = WC->urlstrings->next;
+               free(WC->urlstrings);
+               WC->urlstrings = u;
        }
 }
 
@@ -138,7 +127,7 @@ void dump_vars(void)
 {
        struct urlcontent *u;
 
-       for (u = urlstrings; u != NULL; u = u->next) {
+       for (u = WC->urlstrings; u != NULL; u = u->next) {
                wprintf("%38s = %s\n", u->url_key, u->url_data);
        }
 }
@@ -147,7 +136,7 @@ char *bstr(char *key)
 {
        struct urlcontent *u;
 
-       for (u = urlstrings; u != NULL; u = u->next) {
+       for (u = WC->urlstrings; u != NULL; u = u->next) {
                if (!strcasecmp(u->url_key, key))
                        return (u->url_data);
        }
@@ -177,7 +166,7 @@ void wprintf(const char *format,...)
  */
 void wDumpContent(int print_standard_html_footer)
 {
-       if (fake_frames) {
+       if (WC->fake_frames) {
                wprintf("<CENTER><FONT SIZE=-1>"
                        "<TABLE border=0 width=100%><TR>"
                        "<TD><A HREF=\"/ungoto\">"
@@ -195,7 +184,7 @@ void wDumpContent(int print_standard_html_footer)
                        "</TR></TABLE>"
                        "</FONT>\n"
                        "</TD></TR></TABLE></TABLE>\n");
-               fake_frames = 0;
+               WC->fake_frames = 0;
        }
 
        if (print_standard_html_footer) {
@@ -316,11 +305,11 @@ void output_headers(int print_standard_html_head)
                wprintf("</TITLE>\n"
                        "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
                        "</HEAD>\n");
-               if (ExpressMessages != NULL) {
+               if (WC->ExpressMessages != NULL) {
                        wprintf("<SCRIPT language=\"javascript\">\n");
                        wprintf("function ExpressMessage() {\n");
                        wprintf(" alert(\"");
-                       escputs(ExpressMessages);
+                       escputs(WC->ExpressMessages);
                        wprintf("\")\n");
                        wprintf(" }\n </SCRIPT>\n");
                }
@@ -332,10 +321,10 @@ void output_headers(int print_standard_html_head)
                 */
 
                wprintf("<BODY ");
-               if (ExpressMessages != NULL) {
+               if (WC->ExpressMessages != NULL) {
                        wprintf("onload=\"ExpressMessage()\" ");
-                       free(ExpressMessages);
-                       ExpressMessages = NULL;
+                       free(WC->ExpressMessages);
+                       WC->ExpressMessages = NULL;
                }
                wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
        
@@ -355,7 +344,7 @@ void output_headers(int print_standard_html_head)
 
                wprintf("</TD></TR><TR VALIGN=TOP><TD>\n");
                
-               fake_frames = 1;
+               WC->fake_frames = 1;
                }
        }
 }
@@ -363,15 +352,15 @@ void output_headers(int print_standard_html_head)
 
 
 void ExpressMessageCat(char *buf) {
-       if (ExpressMessages == NULL) {
-               ExpressMessages = malloc(strlen(buf) + 4);
-               strcpy(ExpressMessages, "");
+       if (WC->ExpressMessages == NULL) {
+               WC->ExpressMessages = malloc(strlen(buf) + 4);
+               strcpy(WC->ExpressMessages, "");
        } else {
-               ExpressMessages = realloc(ExpressMessages,
-                       (strlen(ExpressMessages) + strlen(buf) + 4));
+               WC->ExpressMessages = realloc(WC->ExpressMessages,
+                       (strlen(WC->ExpressMessages) + strlen(buf) + 4));
        }
-       strcat(ExpressMessages, buf);
-       strcat(ExpressMessages, "\\n");
+       strcat(WC->ExpressMessages, buf);
+       strcat(WC->ExpressMessages, "\\n");
 }
 
 
index 121ecbcf8b357db1b62bde92664737283514b59f..598d154eae73b52ff7062d55b5a3dd46878c0ea9 100644 (file)
@@ -118,6 +118,11 @@ struct wcsession {
         time_t lastreq;                        /* Timestamp of most recent HTTP */
        int killthis;                   /* Nonzero == purge this session */
        struct march *march;            /* march mode room list */
+       char reply_to[512];             /* reply-to address */
+       long msgarr[1024];              /* for read operations */
+       int fake_frames;
+       char *ExpressMessages;
+       struct urlcontent *urlstrings;
 };