4 * Web forms for handling mailing list subscribe/unsubscribe requests.
10 * List subscription handling
19 char escaped_email
[256];
20 char escaped_room
[256];
26 FlushStrBuf(WC
->wc_fullname
);
27 FlushStrBuf(WC
->wc_username
);
28 FlushStrBuf(WC
->wc_password
);
29 FlushStrBuf(WC
->wc_roomname
);
31 output_headers(1, 0, 0, 1, 1, 0);
34 wprintf("<HTML><HEAD>\n"
35 "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
36 "<link href=\"static/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
39 wprintf(_("List subscription"));
40 wprintf("</TITLE></HEAD><BODY>\n");
42 strcpy(cmd
, bstr("cmd"));
43 strcpy(room
, bstr("room"));
44 strcpy(token
, bstr("token"));
45 strcpy(email
, bstr("email"));
46 strcpy(subtype
, bstr("subtype"));
48 wprintf("<div align=center>");
49 wprintf("<table border=0 width=75%%><tr><td>");
51 svput("BOXTITLE", WCS_STRING
, _("List subscribe/unsubscribe"));
52 do_template("beginboxx", NULL
);
53 wprintf("<div align=center><br>");
58 if (!strcasecmp(cmd
, "subscribe")) {
59 serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
63 (is_https
? "https" : "http"),
66 serv_getln(buf
, sizeof buf
);
68 stresc(escaped_email
, 256, email
, 0, 0);
69 stresc(escaped_room
, 256, room
, 0, 0);
71 wprintf("<CENTER><H1>");
72 wprintf(_("Confirmation request sent"));
74 wprintf(_("You are subscribing <TT>%s"
75 "</TT> to the <b>%s</b> mailing list. "
77 "sent you an e-mail with one additional "
78 "Web link for you to click on to confirm "
79 "your subscription. This extra step is for "
80 "your protection, as it prevents others from "
81 "being able to subscribe you to lists "
82 "without your consent.<br /><br />"
83 "Please click on the link which is being "
84 "e-mailed to you and your subscription will "
85 "be confirmed.<br />\n"),
86 escaped_email
, escaped_room
);
87 wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
90 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
91 "</FONT><br /><br />\n",
100 else if (!strcasecmp(cmd
, "unsubscribe")) {
101 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
104 (is_https
? "https" : "http"),
105 ChrPtr(WC
->http_host
)
107 serv_getln(buf
, sizeof buf
);
109 wprintf("<CENTER><H1>Confirmation request sent</H1>"
110 "You are unsubscribing <TT>");
112 wprintf("</TT> from the "");
114 wprintf("" mailing list. The listserver has "
115 "sent you an e-mail with one additional "
116 "Web link for you to click on to confirm "
117 "your unsubscription. This extra step is for "
118 "your protection, as it prevents others from "
119 "being able to unsubscribe you from "
120 "lists without your consent.<br /><br />"
121 "Please click on the link which is being "
122 "e-mailed to you and your unsubscription will "
123 "be confirmed.<br />\n"
124 "<a href=\"listsub\">Back...</A></CENTER>\n"
128 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
129 "</FONT><br /><br />\n",
138 else if (!strcasecmp(cmd
, "confirm")) {
139 serv_printf("SUBS confirm|%s|%s",
143 serv_getln(buf
, sizeof buf
);
145 wprintf("<CENTER><H1>Confirmation successful!</H1>");
148 wprintf("<CENTER><H1>Confirmation failed.</H1>"
149 "This could mean one of two things:<UL>\n"
150 "<LI>You waited too long to confirm your "
151 "subscribe/unsubscribe request (the "
152 "confirmation link is only valid for three "
153 "days)\n<LI>You have <i>already</i> "
154 "successfully confirmed your "
155 "subscribe/unsubscribe request and are "
156 "attempting to do it again.</UL>\n"
157 "The error returned by the server was: "
160 wprintf("%s</CENTER><br />\n", &buf
[4]);
164 * Any other (invalid) command causes the form to be displayed
167 FORM
: wprintf("<form method=\"POST\" action=\"listsub\">\n");
169 wprintf("Name of list: "
170 "<select name=\"room\" size=1>\n");
173 serv_getln(buf
, sizeof buf
);
175 while (serv_getln(buf
, sizeof buf
), strcmp(buf
, "000")) {
176 extract_token(sroom
, buf
, 0, '|', sizeof sroom
);
177 self
= extract_int(buf
, 4) & QR2_SELFLIST
;
179 wprintf("<option value=\"");
183 wprintf("</option>\n");
187 wprintf("</select><br><br>\n");
189 wprintf("Your e-mail address: "
190 "<INPUT TYPE=\"text\" NAME=\"email\" "
194 wprintf("\" maxlength=128 size=60><br><br>\n");
196 wprintf("(If subscribing) preferred format: "
197 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
198 "VALUE=\"list\" CHECKED>One message at a time "
199 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
200 "VALUE=\"digest\">Digest format "
202 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
203 " VALUE=\"subscribe\">\n"
204 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
205 " VALUE=\"unsubscribe\"><br><br>\n"
209 wprintf("<hr>When you attempt to subscribe or unsubscribe to "
210 "a mailing list, you will receive an e-mail containing"
211 " one additional web link to click on for final "
212 "confirmation. This extra step is for your "
213 "protection, as it prevents others from being able to "
214 "subscribe or unsubscribe you to lists.<br />\n"
220 do_template("endbox", NULL
);
221 wprintf("</td></tr></table></div>");
223 wprintf("</BODY></HTML>\n");
225 end_webcit_session();