* move serv_info into the session, here we can control its de/allocation the right...
authorWilfried Göesgens <willi@citadel.org>
Tue, 10 Feb 2009 18:50:50 +0000 (18:50 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 10 Feb 2009 18:50:50 +0000 (18:50 +0000)
19 files changed:
webcit/addressbook_popup.c
webcit/auth.c
webcit/context_loop.c
webcit/groupdav_main.c
webcit/ical_dezonify.c
webcit/messages.c
webcit/msg_renderers.c
webcit/openid.c
webcit/roomops.c
webcit/rss.c
webcit/serv_func.c
webcit/setup_wizard.c
webcit/sieve.c
webcit/siteconfig.c
webcit/smtpqueue.c
webcit/summary.c
webcit/userlist.c
webcit/webcit.c
webcit/webcit.h

index 19e06c0b427218e782dc785d485fd6b5971a438d..8e687f3debe1a26ebfbe01a0816b1e3baaea0220 100644 (file)
@@ -51,7 +51,7 @@ void display_address_book_middle_div(void) {
        wprintf("<option value=\"__LOCAL_USERS__\" %s>", 
                (strcmp(ChrPtr(DefAddrBook), "__LOCAL_USERS__") == 0)?
                "selected=\"selected\" ":"");
-       escputs(ChrPtr(serv_info.serv_humannode));
+       escputs(ChrPtr(WC->serv_info->serv_humannode));
        wprintf("</option>\n");
 
        
index c938851b103f9b05cdde271c6caf209f85dfa37e..9274552148febe326c90571c15c7c2c5d247852b 100644 (file)
@@ -91,7 +91,7 @@ void display_openid_name_request(const StrBuf *claimed_id, const StrBuf *usernam
        svput("EXIT_BUTTON", WCS_STRING, _("Exit"));
 
        svprintf(HKEY("BOXTITLE"), WCS_STRING, _("%s - powered by <a href=\"http://www.citadel.org\">Citadel</a>"),
-                ChrPtr(serv_info.serv_humannode));
+                ChrPtr(WC->serv_info->serv_humannode));
 
        do_template("openid_manual_create", NULL);
        wDumpContent(2);
index a11b930d2873c035084d5eb201b70d896a6db006..c8461d2c8f56741209994d08d953c68db1c9ff25 100644 (file)
@@ -32,6 +32,7 @@ void DestroySession(wcsession **sessions_to_kill)
        if ((*sessions_to_kill)->cache_fold != NULL) {
                free((*sessions_to_kill)->cache_fold);
        }
+       DeleteServInfo(&((*sessions_to_kill)->serv_info));
        DeleteHash(&((*sessions_to_kill)->attachments));
        free_march_list((*sessions_to_kill));
        DeleteHash(&((*sessions_to_kill)->hash_prefs));
index a2c3f169df267eb0e54a25685668b362afffbd56..6a7f8beacada8e943b9860e97afbeab0b919e0e6 100644 (file)
@@ -22,7 +22,7 @@ void groupdav_common_headers(void) {
        hprintf(
                "Server: %s / %s\r\n"
                "Connection: close\r\n",
-               PACKAGE_STRING, ChrPtr(serv_info.serv_software)
+               PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software)
        );
 }
 
@@ -129,7 +129,7 @@ void groupdav_main(HashList *HTTPHeaders,
                hprintf("HTTP/1.1 401 Unauthorized\r\n");
                groupdav_common_headers();
                hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n",
-                       ChrPtr(serv_info.serv_humannode));
+                       ChrPtr(WCC->serv_info->serv_humannode));
                hprintf("Content-Length: 0\r\n");
                end_burst();
                return;
index 044825592e4d213c0eeda42f6149c55a74eb96b1..ea4b53ece8d458b3291684373343db7dbee054f9 100644 (file)
@@ -21,7 +21,7 @@
 icaltimezone *get_default_icaltimezone(void) {
 
         icaltimezone *zone = NULL;
-       const char *default_zone_name = ChrPtr(serv_info.serv_default_cal_zone);
+       const char *default_zone_name = ChrPtr(WC->serv_info->serv_default_cal_zone);
 
         if (!zone) {
                 zone = icaltimezone_get_builtin_timezone(default_zone_name);
index 171b73e0237f6481cf3442932f682954768cc0ff..a30263a2f924620c8f1aa13727c5c644e5d9ead5 100644 (file)
@@ -43,7 +43,9 @@ typedef struct _MsgPartEvaluatorStruct {
  * printable_view      Nonzero to display a printable view
  * section             Optional for encapsulated message/rfc822 submessage
  */
-int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, int printable_view, const StrBuf *PartNum) {
+int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, int printable_view, const StrBuf *PartNum) 
+{
+       wcsession *WCC = WC;
        StrBuf *Buf;
        StrBuf *HdrToken;
        StrBuf *FoundCharset;
@@ -208,8 +210,8 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, in
        else 
        {
                if ((StrLength(Msg->OtherNode)>0) && 
-                   (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(serv_info.serv_nodename))) &&
-                   (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(serv_info.serv_humannode)) ))
+                   (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_nodename))) &&
+                   (strcasecmp(ChrPtr(Msg->OtherNode), ChrPtr(WCC->serv_info->serv_humannode)) ))
                {
                        if (Msg->reply_to == NULL)
                                Msg->reply_to = NewStrBuf();
@@ -256,13 +258,14 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, in
  */
 void embed_message(void) {
        long msgnum = 0L;
+       wcsession *WCC = WC;
        const StrBuf *Tmpl = sbstr("template");
 
-       msgnum = StrTol(WC->UrlFragment2);
+       msgnum = StrTol(WCC->UrlFragment2);
        if (StrLength(Tmpl) > 0) 
-               read_message(WC->WBuf, SKEY(Tmpl), msgnum, 0, NULL);
+               read_message(WCC->WBuf, SKEY(Tmpl), msgnum, 0, NULL);
        else 
-               read_message(WC->WBuf, HKEY("view_message"), msgnum, 0, NULL);
+               read_message(WCC->WBuf, HKEY("view_message"), msgnum, 0, NULL);
 }
 
 
@@ -440,8 +443,8 @@ int load_msg_ptrs(char *servcmd, int with_headers)
                                StrBufExtract_token(Buf2, Buf, 3, '|');
                                if ((StrLength(Buf2) !=0 ) &&
                                    ( ((WCC->room_flags & QR_NETWORK)
-                                      || ((strcasecmp(ChrPtr(Buf2), ChrPtr(serv_info.serv_nodename))
-                                           && (strcasecmp(ChrPtr(Buf2), ChrPtr(serv_info.serv_fqdn))))))))
+                                      || ((strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_nodename))
+                                           && (strcasecmp(ChrPtr(Buf2), ChrPtr(WCC->serv_info->serv_fqdn))))))))
                                {
                                        StrBufAppendBufPlain(Msg->from, HKEY(" @ "), 0);
                                        StrBufAppendBuf(Msg->from, Buf2, 0);
@@ -963,12 +966,12 @@ void post_mime_to_server(void) {
        char *txtmail = NULL;
 
        sprintf(top_boundary, "Citadel--Multipart--%s--%04x--%04x",
-               ChrPtr(serv_info.serv_fqdn),
+               ChrPtr(WCC->serv_info->serv_fqdn),
                getpid(),
                ++seq
        );
        sprintf(alt_boundary, "Citadel--Multipart--%s--%04x--%04x",
-               ChrPtr(serv_info.serv_fqdn),
+               ChrPtr(WCC->serv_info->serv_fqdn),
                getpid(),
                ++seq
        );
@@ -1647,7 +1650,7 @@ void jsonMessageListHdr(void)
        /* TODO: make a generic function */
   hprintf("HTTP/1.1 200 OK\r\n");
   hprintf("Content-type: application/json; charset=utf-8\r\n");
-  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
+  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
   hprintf("Connection: close\r\n");
   hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
   begin_burst();
@@ -1662,8 +1665,8 @@ void new_summary_view(void) {
 /** Output message list in JSON-format */
 void jsonMessageList(void) {
   const StrBuf *room = sbstr("room");
-  WC->is_ajax = 1; 
   long oper = (havebstr("query")) ? do_search : readnew;
+  WC->is_ajax = 1; 
   gotoroom(room);
   readloop(oper);
   WC->is_ajax = 0;
index 8ca86433efab0e537366a97b0ed2db9e0ddf4329..6554be70d67d4bf9214c9d1d1f64de7be941acf1 100644 (file)
@@ -366,10 +366,12 @@ int Conditional_MAIL_SUMM_CCCC(StrBuf *Target, WCTemplputParams *TP)
 
 void examine_node(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
 {
+       wcsession *WCC = WC;
+
        if ( (StrLength(HdrLine) > 0) &&
             ((WC->room_flags & QR_NETWORK)
-             || ((strcasecmp(ChrPtr(HdrLine), ChrPtr(serv_info.serv_nodename))
-                  && (strcasecmp(ChrPtr(HdrLine), ChrPtr(serv_info.serv_fqdn))))))) {
+             || ((strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_nodename))
+                  && (strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_fqdn))))))) {
                FreeStrBuf(&Msg->OtherNode);
                Msg->OtherNode = NewStrBufDup(HdrLine);
        }
index a4af9d257a1bb4dda1f7618017d3a14b19a8ad01..4c234b178ea3c5aaddd06b9ff23e3400192195bc 100644 (file)
@@ -10,6 +10,7 @@
  */
 void display_openids(void)
 {
+       wcsession *WCC = WC;
        char buf[1024];
        int bg = 0;
 
@@ -20,7 +21,7 @@ void display_openids(void)
        svput("BOXTITLE", WCS_STRING, _("Manage Account/OpenID Associations"));
        do_template("beginboxx", NULL);
 
-       if (serv_info.serv_supports_openid) {
+       if (WCC->serv_info->serv_supports_openid) {
 
                wprintf("<table class=\"altern\">");
        
@@ -43,7 +44,7 @@ void display_openids(void)
                wprintf("</table><br />\n");
        
                wprintf("<form method=\"POST\" action=\"openid_attach\">\n");
-               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
+               wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WCC->nonce);
                wprintf(_("Add an OpenID: "));
                wprintf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n");
                wprintf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">"
@@ -51,7 +52,7 @@ void display_openids(void)
        }
 
        else {
-               wprintf(_("%s does not permit authentication via OpenID."), ChrPtr(serv_info.serv_humannode));
+               wprintf(_("%s does not permit authentication via OpenID."), ChrPtr(WCC->serv_info->serv_humannode));
        }
 
        do_template("endbox", NULL);
index 40c8a3aab830febbbbacd8feaa5b961b97402053..b1fce7f15e7b062ba65ed9025788de974306c529 100644 (file)
@@ -451,7 +451,7 @@ void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
        wprintf("<label for=\"srchquery\">");
        wprintf(_("Search: "));
        wprintf("</label><input ");
-       wprintf("%s", serv_info.serv_fulltext_enabled ? "" : "disabled ");
+       wprintf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
        wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
                );
        wprintf("</div></form>\n");
@@ -3820,7 +3820,7 @@ void jsonRoomFlr(void) {
        /* Send as our own (application/json) content type */
   hprintf("HTTP/1.1 200 OK\r\n");
   hprintf("Content-type: application/json; charset=utf-8\r\n");
-  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
+  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
   hprintf("Connection: close\r\n");
   hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
   begin_burst();
index 60f09784467958f467a7681a0507ab4e622cfaee..ab01a2aef1d598d1062a8966a3047c0bf2848969 100644 (file)
@@ -163,7 +163,7 @@ void display_rss(const StrBuf *roomname, StrBuf *request_method)
        svput("XML_HEAD", WCS_STRING, "<?xml version=\"1.0\" ?>");
        svput("XML_STYLE", WCS_STRING, "<?xml-stylesheet type=\"text/css\" href=\"/static/rss_browser.css\" ?>");
        SVPutBuf("ROOM", WCC->wc_roomname, 1);
-       SVPutBuf("NODE", serv_info.serv_humannode, 1);
+       SVPutBuf("NODE", WCC->serv_info->serv_humannode, 1);
        /* TODO:  Fix me */
        svprintf(HKEY("ROOM_LINK"), WCS_STRING, "%s://%s/", (is_https ? "https" : "http"), ChrPtr(WCC->http_host));
        
@@ -233,7 +233,7 @@ void display_rss(const StrBuf *roomname, StrBuf *request_method)
                        svput("SUBJ", WCS_STRING, _("From"));
                }
                svprintf(HKEY("IN_ROOM"), WCS_STRING, _("%s in %s"), from, room);
-               if (strcmp(hnod, ChrPtr(serv_info.serv_humannode)) && !IsEmptyStr(hnod)) {
+               if (strcmp(hnod, ChrPtr(WCC->serv_info->serv_humannode)) && !IsEmptyStr(hnod)) {
                        svprintf(HKEY("NODE"), WCS_STRING, _(" on %s"), hnod);
                }
                if (now) {
index cbd53634e47ed1ae4a5826fa11ec2c52e68cd33b..6b36860f4cd520283c71e99896b0ec7c05f8f875 100644 (file)
@@ -5,15 +5,31 @@
 #include "webcit.h"
 #include "webserver.h"
 
-struct serv_info serv_info; /**< our connection data to the server */
+
+void DeleteServInfo(ServInfo **FreeMe)
+{
+       FreeStrBuf(&(*FreeMe)->serv_nodename);
+       FreeStrBuf(&(*FreeMe)->serv_humannode);
+       FreeStrBuf(&(*FreeMe)->serv_fqdn);
+       FreeStrBuf(&(*FreeMe)->serv_software);
+       FreeStrBuf(&(*FreeMe)->serv_bbs_city);
+       FreeStrBuf(&(*FreeMe)->serv_sysadm);
+       FreeStrBuf(&(*FreeMe)->serv_moreprompt);
+       FreeStrBuf(&(*FreeMe)->serv_default_cal_zone);
+       FreeStrBuf(&(*FreeMe)->serv_svn_revision);
+       free(*FreeMe);
+       *FreeMe = NULL;
+}
+
 /*
  * get info about the server we've connected to
  *
  * browser_host                the citadell we want to connect to
  * user_agent          which browser uses our client?
  */
-void get_serv_info(StrBuf *browser_host, char *user_agent)
+ServInfo *get_serv_info(StrBuf *browser_host, char *user_agent)
 {
+       ServInfo *info;
        StrBuf *Buf;
        char buf[SIZ];
        int a;
@@ -44,65 +60,69 @@ void get_serv_info(StrBuf *browser_host, char *user_agent)
        serv_puts("INFO");
        serv_getln(buf, sizeof buf);
        if (buf[0] != '1')
-               return;
+               return NULL;
 
+       info = (ServInfo*)malloc(sizeof(ServInfo));
+       memset(info, 0, sizeof(ServInfo));
        a = 0;
        Buf = NewStrBuf();
        while (StrBuf_ServGetln(Buf), (strcmp(ChrPtr(Buf), "000")!= 0)) {
 /*             lprintf (1, "a: %d [%s]", a, ChrPtr(Buf));*/
                switch (a) {
                case 0:
-                       serv_info.serv_pid = StrToi(Buf);
-                       WC->ctdl_pid = serv_info.serv_pid;
+                       info->serv_pid = StrToi(Buf);
+                       WC->ctdl_pid = info->serv_pid;
                        break;
                case 1:
-                       serv_info.serv_nodename = NewStrBufDup(Buf);
+                       info->serv_nodename = NewStrBufDup(Buf);
                        break;
                case 2:
-                       serv_info.serv_humannode = NewStrBufDup(Buf);
+                       info->serv_humannode = NewStrBufDup(Buf);
                        break;
                case 3:
-                       serv_info.serv_fqdn = NewStrBufDup(Buf);
+                       info->serv_fqdn = NewStrBufDup(Buf);
                        break;
                case 4:
-                       serv_info.serv_software = NewStrBufDup(Buf);
+                       info->serv_software = NewStrBufDup(Buf);
                        break;
                case 5:
-                       serv_info.serv_rev_level = StrToi(Buf);
+                       info->serv_rev_level = StrToi(Buf);
                        break;
                case 6:
-                       serv_info.serv_bbs_city = NewStrBufDup(Buf);
+                       info->serv_bbs_city = NewStrBufDup(Buf);
                        break;
                case 7:
-                       serv_info.serv_sysadm = NewStrBufDup(Buf);
+                       info->serv_sysadm = NewStrBufDup(Buf);
                        break;
                case 9:
-                       serv_info.serv_moreprompt = NewStrBufDup(Buf);
+                       info->serv_moreprompt = NewStrBufDup(Buf);
                        break;
                case 14:
-                       serv_info.serv_supports_ldap = StrToi(Buf);
+                       info->serv_supports_ldap = StrToi(Buf);
                        break;
                case 15:
-                       serv_info.serv_newuser_disabled = StrToi(Buf);
+                       info->serv_newuser_disabled = StrToi(Buf);
                        break;
                case 16:
-                       serv_info.serv_default_cal_zone = NewStrBufDup(Buf);
+                       info->serv_default_cal_zone = NewStrBufDup(Buf);
                        break;
                case 20:
-                       serv_info.serv_supports_sieve = StrToi(Buf);
+                       info->serv_supports_sieve = StrToi(Buf);
                        break;
                case 21:
-                       serv_info.serv_fulltext_enabled = StrToi(Buf);
+                       info->serv_fulltext_enabled = StrToi(Buf);
                        break;
                case 22:
-                       serv_info.serv_svn_revision = NewStrBufDup(Buf);
+                       info->serv_svn_revision = NewStrBufDup(Buf);
                        break;
                case 23:
-                       serv_info.serv_supports_openid = StrToi(Buf);
+                       info->serv_supports_openid = StrToi(Buf);
                        break;
                }
                ++a;
        }
+       FreeStrBuf(&Buf);
+       return info;
 }
 
 
@@ -512,42 +532,42 @@ void tmplput_serv_ip(StrBuf *Target, WCTemplputParams *TP)
 
 void tmplput_serv_nodename(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendTemplate(Target, TP, serv_info.serv_nodename, 0);
+       StrBufAppendTemplate(Target, TP, WC->serv_info->serv_nodename, 0);
 }
 
 void tmplput_serv_humannode(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendTemplate(Target, TP, serv_info.serv_humannode, 0);
+       StrBufAppendTemplate(Target, TP, WC->serv_info->serv_humannode, 0);
 }
 
 void tmplput_serv_fqdn(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendTemplate(Target, TP, serv_info.serv_fqdn, 0);
+       StrBufAppendTemplate(Target, TP, WC->serv_info->serv_fqdn, 0);
 }
 
 void tmplput_serv_software(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendTemplate(Target, TP, serv_info.serv_software, 0);
+       StrBufAppendTemplate(Target, TP, WC->serv_info->serv_software, 0);
 }
 
 void tmplput_serv_rev_level(StrBuf *Target, WCTemplputParams *TP)
 {
        StrBufAppendPrintf(Target, "%d.%02d",
-                           serv_info.serv_rev_level / 100,
-                           serv_info.serv_rev_level % 100);
+                           WC->serv_info->serv_rev_level / 100,
+                           WC->serv_info->serv_rev_level % 100);
 }
 int conditional_serv_newuser_disabled(StrBuf *Target, WCTemplputParams *TP)
 {
-       return serv_info.serv_newuser_disabled != 0;
+       return WC->serv_info->serv_newuser_disabled != 0;
 }
 int conditional_serv_supports_openid(StrBuf *Target, WCTemplputParams *TP)
 {
-       return serv_info.serv_supports_openid != 0;
+       return WC->serv_info->serv_supports_openid != 0;
 }
 
 void tmplput_serv_bbs_city(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBufAppendTemplate(Target, TP, serv_info.serv_bbs_city, 0);
+       StrBufAppendTemplate(Target, TP, WC->serv_info->serv_bbs_city, 0);
 }
 
 
index 8b52e0616f812a609beea2e2a6e840f1e45a7025..a22b8fc03a2c0191031fa54c6315f71f8012d40f 100644 (file)
@@ -19,7 +19,7 @@ void do_setup_wizard(void)
        if (!strcasecmp(step, "Finish")) {
                fp = fopen(wizard_filename, "w");
                if (fp != NULL) {
-                       fprintf(fp, "%d\n", serv_info.serv_rev_level);
+                       fprintf(fp, "%d\n", WC->serv_info->serv_rev_level);
                        fclose(fp);
                }
                do_welcome();
index 14a04a7ad921b8d8e136e998564f441c3c274ca8..ee9449883117ee8ebc9158904ffb80ea2fc5df76 100644 (file)
@@ -49,7 +49,7 @@ void display_sieve(void)
        int i;
        int rules_script_is_active = 0;
 
-       if (!serv_info.serv_supports_sieve) {
+       if (!WC->serv_info->serv_supports_sieve) {
                display_no_sieve();
                return;
        }
index 01824a592807332b12d1b8e0dd466f48727644e7..785a54d36a55658846e6015be4ae45acb50fb236 100644 (file)
@@ -237,8 +237,8 @@ void siteconfig(void)
        serv_getln(buf, sizeof buf);
        serv_printf("SPEX mailboxes|%d|%d", ibstr("mboxpolicy"), ibstr("mboxvalue"));
        serv_getln(buf, sizeof buf);
-       FreeStrBuf(&serv_info.serv_default_cal_zone);
-       serv_info.serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone"));
+       FreeStrBuf(&WCC->serv_info->serv_default_cal_zone);
+       WCC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone"));
 
        safestrncpy(WCC->ImportantMessage, _("Your system configuration has been updated."),
                sizeof WCC->ImportantMessage);
index 1f86b3f27bf438bc1d1b89486af09aec999bc8f4..43f5cd90ac064ecb079d0e622a008766d52fd9c5 100644 (file)
@@ -90,7 +90,7 @@ void display_queue_msg(long msgnum)
                                atsign = strchr(sender, '@');
                                if (atsign != NULL) {
                                        ++atsign;
-                                       if (!strcasecmp(atsign, ChrPtr(serv_info.serv_nodename))) {
+                                       if (!strcasecmp(atsign, ChrPtr(WC->serv_info->serv_nodename))) {
                                                --atsign;
                                                *atsign = 0;
                                        }
index 19caa74fa1f9b9406391c1ad07848946af87246c..43c8e590dac5bffac585b0ab0115447fa5363ed3 100644 (file)
@@ -156,15 +156,16 @@ void calendar_section(void) {
  */
 void server_info_section(void) {
        char message[512];
+       wcsession *WCC = WC;
 
        snprintf(message, sizeof message,
                _("You are connected to %s, running %s with %s, server build %s and located in %s.  Your system administrator is %s."),
-                ChrPtr(serv_info.serv_humannode),
-                ChrPtr(serv_info.serv_software),
+                ChrPtr(WCC->serv_info->serv_humannode),
+                ChrPtr(WCC->serv_info->serv_software),
                 PACKAGE_STRING,
-                ChrPtr(serv_info.serv_svn_revision),
-                ChrPtr(serv_info.serv_bbs_city),
-                ChrPtr(serv_info.serv_sysadm));
+                ChrPtr(WCC->serv_info->serv_svn_revision),
+                ChrPtr(WCC->serv_info->serv_bbs_city),
+                ChrPtr(WCC->serv_info->serv_sysadm));
        escputs(message);
 }
 
index f0b8325acb127d22942c2b01ee3da9bed9580b1b..83d82e3cf10b1606367bd2c746949dac7ffe772a 100644 (file)
@@ -39,7 +39,7 @@ void userlist(void)
        output_headers(1, 1, 2, 0, 0, 0);
        wprintf("<div id=\"banner\">\n");
        wprintf("<h1>");
-       snprintf(title, sizeof title, _("User list for %s"), ChrPtr(serv_info.serv_humannode));
+       snprintf(title, sizeof title, _("User list for %s"), ChrPtr(WC->serv_info->serv_humannode));
        escputs(title);
        wprintf("</h1>");
         wprintf("</div>");
index e8a295814769a59395fab4f82118a3594460ef48..edc19a0c6422ec9079ed8edd56833871d90a4b65 100644 (file)
@@ -108,6 +108,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
                        int suppress_check,     /* 1 = suppress check for instant messages          */
                        int cache               /* 1 = allow browser to cache this page             */
 ) {
+       wcsession *WCC = WC;
        char cookie[1024];
        char httpnow[128];
 
@@ -119,7 +120,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
                        "Server: %s / %s\n"
                        "Connection: close\r\n",
                        PACKAGE_STRING, 
-                       ChrPtr(serv_info.serv_software)
+                       ChrPtr(WCC->serv_info->serv_software)
                );
        }
 
@@ -145,8 +146,8 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
        }
 
        stuff_to_cookie(cookie, 1024, 
-                       WC->wc_session, WC->wc_username,
-                       WC->wc_password, WC->wc_roomname);
+                       WCC->wc_session, WCC->wc_username,
+                       WCC->wc_password, WCC->wc_roomname);
 
        if (unset_cookies) {
                hprintf("Set-cookie: webcit=%s; path=/\r\n", unset);
@@ -169,13 +170,13 @@ void output_headers(      int do_httpheaders,     /* 1 = output HTTP headers
                        wprintf("</span><br />\n"
                                "</div>\n"
                        );
-                       StrBufAppendPrintf(WC->trailing_javascript,
+                       StrBufAppendPrintf(WCC->trailing_javascript,
                                "setTimeout('hide_imsg_popup()', 5000); \n"
                        );
-                       WC->ImportantMessage[0] = 0;
+                       WCC->ImportantMessage[0] = 0;
                }
 
-               if ( (WC->logged_in) && (!unset_cookies) ) {
+               if ( (WCC->logged_in) && (!unset_cookies) ) {
                  //DoTemplate(HKEY("iconbar"), NULL, &NoCtx);
                        page_popup();
                }
@@ -195,7 +196,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
 void output_custom_content_header(const char *ctype) {
   hprintf("HTTP/1.1 200 OK\r\n");
   hprintf("Content-type: %s; charset=utf-8\r\n",ctype);
-  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
+  hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
   hprintf("Connection: close\r\n");
 }
 
@@ -395,7 +396,7 @@ void display_success(char *successmessage)
 void authorization_required(const char *message)
 {
        hprintf("HTTP/1.1 401 Authorization Required\r\n");
-       hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", ChrPtr(serv_info.serv_humannode));
+       hprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", ChrPtr(WC->serv_info->serv_humannode));
        hprintf("Content-Type: text/html\r\n");
        wprintf("<h1>");
        wprintf(_("Authorization Required"));
@@ -827,16 +828,16 @@ void session_loop(HashList *HTTPHeaders, StrBuf *ReqLine, StrBuf *request_method
                                locate_host(browser_host, WCC->http_sock);
                        }
 
-                       get_serv_info(browser_host, user_agent);
-                       if (serv_info.serv_rev_level < MINIMUM_CIT_VERSION) {
+                       WCC->serv_info = get_serv_info(browser_host, user_agent);
+                       if (WCC->serv_info->serv_rev_level < MINIMUM_CIT_VERSION) {
                                begin_burst();
                                wprintf(_("You are connected to a Citadel "
                                        "server running Citadel %d.%02d. \n"
                                        "In order to run this version of WebCit "
                                        "you must also have Citadel %d.%02d or"
                                        " newer.\n\n\n"),
-                                               serv_info.serv_rev_level / 100,
-                                               serv_info.serv_rev_level % 100,
+                                               WCC->serv_info->serv_rev_level / 100,
+                                               WCC->serv_info->serv_rev_level % 100,
                                                MINIMUM_CIT_VERSION / 100,
                                                MINIMUM_CIT_VERSION % 100
                                        );
index 5b2aa23ce95835f6d7640685a0332c8cff44b162..604205bc0f4d19d556b619dd63978626ca4dc8b6 100644 (file)
@@ -214,7 +214,7 @@ struct urlcontent {
 /*
  * \brief information about us ???
  */ 
-struct serv_info {
+typedef struct _serv_info {
        int serv_pid;                   /* Process ID of the Citadel server */
        StrBuf *serv_nodename;          /* Node name of the Citadel server */
        StrBuf *serv_humannode;         /* human readable node name of the Citadel server */
@@ -232,7 +232,7 @@ struct serv_info {
        int serv_fulltext_enabled;      /* Does the server have the full text index enabled? */
        StrBuf *serv_svn_revision;      /* SVN revision of the server */
        int serv_supports_openid;       /* Does the server support authentication via OpenID? */
-};
+} ServInfo;
 
 
 
@@ -343,6 +343,7 @@ struct wcsession {
        int chat_sock;                          /**< Client socket to Citadel server - for chat */
        time_t lastreq;                         /**< Timestamp of most recent HTTP */
        time_t last_pager_check;                /**< last time we polled for instant msgs */
+       ServInfo *serv_info;                   /**< Iformation about the citserver we're connected to */
 /* Request local Members */
        StrBuf *CLineBuf;                       /**< linebuffering client stuff */
        StrBuf *UrlFragment1;                   /**< first urlfragment, if NEED_URL is specified by the handler*/
@@ -488,7 +489,6 @@ extern char file_crpt_file_csr[PATH_MAX];
 extern char file_crpt_file_cer[PATH_MAX];
 #endif
 
-struct serv_info serv_info;
 extern char floorlist[128][SIZ];
 extern char *axdefs[];
 extern char *ctdlhost, *ctdlport;
@@ -526,7 +526,8 @@ void display_main_menu(void);
 void display_aide_menu(void);
 void display_advanced_menu(void);
 void slrp_highest(void);
-void get_serv_info(StrBuf *, char *);
+ServInfo *get_serv_info(StrBuf *, char *);
+void DeleteServInfo(ServInfo **FreeMe);
 int uds_connectsock(char *);
 int tcp_connectsock(char *, char *);
 int serv_getln(char *strbuf, int bufsize);
@@ -602,10 +603,8 @@ void confirm_delete_room(void);
 void validate(void);
 void display_graphics_upload(char *, char *, char *);
 void do_graphics_upload(char *upl_cmd);
-void serv_read(char *buf, int bytes);
 void serv_gets(char *strbuf);
 void serv_write(const char *buf, int nbytes);
-void serv_puts(const char *string);
 void serv_putbuf(const StrBuf *string);
 void serv_printf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
 void load_floorlist(void);