2 * Web forms for handling mailing list subscribe/unsubscribe requests.
8 * List subscription handling
17 char escaped_email[256];
18 char escaped_room[256];
24 FlushStrBuf(WC->wc_fullname);
25 FlushStrBuf(WC->wc_username);
26 FlushStrBuf(WC->wc_password);
27 FlushStrBuf(WC->CurRoom.name);
29 output_headers(1, 0, 0, 1, 1, 0);
32 wc_printf("<HTML><HEAD>\n"
33 "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
34 "<link href=\"static/styles/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
37 wc_printf(_("List subscription"));
38 wc_printf("</TITLE></HEAD><BODY>\n");
40 strcpy(cmd, bstr("cmd"));
41 strcpy(room, bstr("room"));
42 strcpy(token, bstr("token"));
43 strcpy(email, bstr("email"));
44 strcpy(subtype, bstr("subtype"));
46 wc_printf("<div align=center>");
47 wc_printf("<table border=0 width=75%%><tr><td>");
49 do_template("beginbox_1", NULL);
50 StrBufAppendBufPlain(WC->WBuf, _("List subscribe/unsubscribe"), -1, 0);
51 do_template("beginbox_2", NULL);
52 wc_printf("<div align=center><br>");
57 if (!strcasecmp(cmd, "subscribe")) {
58 serv_printf("SUBS subscribe|%s|%s|%s|%s/listsub",
64 serv_getln(buf, sizeof buf);
66 stresc(escaped_email, 256, email, 0, 0);
67 stresc(escaped_room, 256, room, 0, 0);
69 wc_printf("<CENTER><H1>");
70 wc_printf(_("Confirmation request sent"));
72 wc_printf(_("You are subscribing <TT>%s"
73 "</TT> to the <b>%s</b> mailing list. "
75 "sent you an e-mail with one additional "
76 "Web link for you to click on to confirm "
77 "your subscription. This extra step is for "
78 "your protection, as it prevents others from "
79 "being able to subscribe you to lists "
80 "without your consent.<br><br>"
81 "Please click on the link which is being "
82 "e-mailed to you and your subscription will "
83 "be confirmed.<br>\n"),
84 escaped_email, escaped_room);
85 wc_printf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
88 wc_printf("<FONT SIZE=+1><B>ERROR: %s</B>"
98 else if (!strcasecmp(cmd, "unsubscribe")) {
99 serv_printf("SUBS unsubscribe|%s|%s|%s/listsub",
104 serv_getln(buf, sizeof buf);
106 wc_printf("<CENTER><H1>Confirmation request sent</H1>"
107 "You are unsubscribing <TT>");
109 wc_printf("</TT> from the "");
111 wc_printf("" mailing list. The listserver has "
112 "sent you an e-mail with one additional "
113 "Web link for you to click on to confirm "
114 "your unsubscription. This extra step is for "
115 "your protection, as it prevents others from "
116 "being able to unsubscribe you from "
117 "lists without your consent.<br><br>"
118 "Please click on the link which is being "
119 "e-mailed to you and your unsubscription will "
120 "be confirmed.<br>\n"
121 "<a href=\"listsub\">Back...</A></CENTER>\n"
125 wc_printf("<FONT SIZE=+1><B>ERROR: %s</B>"
135 else if (!strcasecmp(cmd, "confirm")) {
136 serv_printf("SUBS confirm|%s|%s",
140 serv_getln(buf, sizeof buf);
142 wc_printf("<CENTER><H1>Confirmation successful!</H1>");
145 wc_printf("<CENTER><H1>Confirmation failed.</H1>"
146 "This could mean one of two things:<UL>\n"
147 "<LI>You waited too long to confirm your "
148 "subscribe/unsubscribe request (the "
149 "confirmation link is only valid for three "
150 "days)\n<LI>You have <i>already</i> "
151 "successfully confirmed your "
152 "subscribe/unsubscribe request and are "
153 "attempting to do it again.</UL>\n"
154 "The error returned by the server was: "
157 wc_printf("%s</CENTER><br>\n", &buf[4]);
161 * Any other (invalid) command causes the form to be displayed
164 FORM: wc_printf("<form method=\"POST\" action=\"listsub\">\n");
166 wc_printf("Name of list: "
167 "<select name=\"room\" size=1>\n");
170 serv_getln(buf, sizeof buf);
172 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
173 extract_token(sroom, buf, 0, '|', sizeof sroom);
174 self = extract_int(buf, 4) & QR2_SELFLIST ;
176 wc_printf("<option value=\"");
180 wc_printf("</option>\n");
184 wc_printf("</select><br><br>\n");
186 wc_printf("Your e-mail address: "
187 "<INPUT TYPE=\"text\" NAME=\"email\" "
191 wc_printf("\" maxlength=128 size=60><br><br>\n");
193 wc_printf("(If subscribing) preferred format: "
194 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
195 "VALUE=\"list\" CHECKED>One message at a time "
196 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
197 "VALUE=\"digest\">Digest format "
199 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
200 " VALUE=\"subscribe\">\n"
201 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
202 " VALUE=\"unsubscribe\"><br><br>\n"
206 wc_printf("<hr>When you attempt to subscribe or unsubscribe to "
207 "a mailing list, you will receive an e-mail containing"
208 " one additional web link to click on for final "
209 "confirmation. This extra step is for your "
210 "protection, as it prevents others from being able to "
211 "subscribe or unsubscribe you to lists.<br>\n"
217 do_template("endbox", NULL);
218 wc_printf("</td></tr></table></div>");
220 wc_printf("</BODY></HTML>\n");
222 end_webcit_session();
231 WebcitAddUrlHandler(HKEY("listsub"), "", 0, do_listsub, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);