* move some more vars from the session context to strbuf (the use of StrBufAppendTemp...
[citadel.git] / webcit / listsub.c
index 28300597317bd9501d49ee207622154f8aaddc2d..a694cd227e6cf689efc6f1723c5f4559c959861c 100644 (file)
@@ -2,13 +2,10 @@
  * $Id$
  *
  * Web forms for handling mailing list subscribe/unsubscribe requests.
- *
  */
 
 #include "webcit.h"
 
-
-
 /*
  * List subscription handling
  */
@@ -26,9 +23,10 @@ void do_listsub(void)
        int self;
        char sroom[SIZ];
 
-       strcpy(WC->wc_username, "");
-       strcpy(WC->wc_password, "");
-       strcpy(WC->wc_roomname, "");
+       FlushStrBuf(WC->wc_fullname);
+       FlushStrBuf(WC->wc_username);
+       FlushStrBuf(WC->wc_password);
+       FlushStrBuf(WC->wc_roomname);
 
        output_headers(1, 0, 0, 1, 1, 0);
        begin_burst();
@@ -47,11 +45,12 @@ void do_listsub(void)
        strcpy(email, bstr("email"));
        strcpy(subtype, bstr("subtype"));
 
-       wprintf("<CENTER>"
-               "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
-               "<SPAN CLASS=\"titlebar\">");
-       wprintf(_("List subscribe/unsubscribe"));
-       wprintf("</SPAN></TD></TR></TABLE><br />\n");
+       wprintf("<div align=center>");
+       wprintf("<table border=0 width=75%%><tr><td>");
+
+       svput("BOXTITLE", WCS_STRING, _("List subscribe/unsubscribe"));
+       do_template("beginboxx", NULL);
+       wprintf("<div align=center><br>");
 
        /*
         * Subscribe command
@@ -66,8 +65,8 @@ void do_listsub(void)
                );
                serv_getln(buf, sizeof buf);
                if (buf[0] == '2') {
-                       stresc(escaped_email, email, 0, 0);
-                       stresc(escaped_room, room, 0, 0);
+                       stresc(escaped_email, 256, email, 0, 0);
+                       stresc(escaped_room, 256, room, 0, 0);
 
                        wprintf("<CENTER><H1>");
                        wprintf(_("Confirmation request sent"));
@@ -133,7 +132,7 @@ void do_listsub(void)
                }
        }
 
-       /* 
+       /*
         * Confirm command
         */
        else if (!strcasecmp(cmd, "confirm")) {
@@ -165,12 +164,10 @@ void do_listsub(void)
         * Any other (invalid) command causes the form to be displayed
         */
        else {
-FORM:          wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
-                       "<TABLE BORDER=0>\n"
-               );
+FORM:          wprintf("<form method=\"POST\" action=\"listsub\">\n");
 
-               wprintf("<TR><TD>Name of list</TD><TD>"
-                       "<SELECT NAME=\"room\" SIZE=1>\n");
+               wprintf("Name of list: "
+                       "<select name=\"room\" size=1>\n");
 
                serv_puts("LPRM");
                serv_getln(buf, sizeof buf);
@@ -179,39 +176,37 @@ FORM:             wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
                                extract_token(sroom, buf, 0, '|', sizeof sroom);
                                self = extract_int(buf, 4) & QR2_SELFLIST ;
                                if (self) {
-                                       wprintf("<OPTION VALUE=\"");
+                                       wprintf("<option value=\"");
                                        escputs(sroom);
                                        wprintf("\">");
                                        escputs(sroom);
-                                       wprintf("</OPTION>\n");
+                                       wprintf("</option>\n");
                                }
                        }
                }
-               wprintf("</SELECT>"
-                       "</TD></TR>\n");
+               wprintf("</select><br><br>\n");
 
-               wprintf("<TR><TD>Your e-mail address</TD><TD>"
+               wprintf("Your e-mail address: "
                        "<INPUT TYPE=\"text\" NAME=\"email\" "
                        "VALUE=\""
                );
                escputs(email);
-               wprintf("\" MAXLENGTH=128></TD></TR>\n");
-
-               wprintf("</TABLE>"
-                       "(If subscribing) preferred format: "
-                       "<INPUT TYPE=\"radio\" NAME=\"subtype\""
-                       "VALUE=\"list\">One message at a time&nbsp; "
-                       "<INPUT TYPE=\"radio\" NAME=\"subtype\""
-                       "VALUE=\"digest\" CHECKED>Digest format&nbsp; "
-                       "<br />\n"
+               wprintf("\" maxlength=128 size=60><br><br>\n");
+
+               wprintf("(If subscribing) preferred format: "
+                       "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
+                       "VALUE=\"list\" CHECKED>One message at a time&nbsp; "
+                       "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
+                       "VALUE=\"digest\">Digest format&nbsp; "
+                       "<br><br>\n"
                        "<INPUT TYPE=\"submit\" NAME=\"cmd\""
                        " VALUE=\"subscribe\">\n"
                        "<INPUT TYPE=\"submit\" NAME=\"cmd\""
-                       " VALUE=\"unsubscribe\">\n"
+                       " VALUE=\"unsubscribe\"><br><br>\n"
                        "</FORM>\n"
                );
 
-               wprintf("<br />When you attempt to subscribe or unsubscribe to "
+               wprintf("<hr>When you attempt to subscribe or unsubscribe to "
                        "a mailing list, you will receive an e-mail containing"
                        " one additional web link to click on for final "
                        "confirmation.  This extra step is for your "
@@ -221,6 +216,10 @@ FORM:              wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
 
        }
 
+       wprintf("</div>");
+       do_template("endbox", NULL);
+       wprintf("</td></tr></table></div>");
+
        wprintf("</BODY></HTML>\n");
        wDumpContent(0);
        end_webcit_session();