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://%s/listsub",
62 (is_https ? "https" : "http"),
63 ChrPtr(WC->Hdr->HR.http_host)
65 serv_getln(buf, sizeof buf);
67 stresc(escaped_email, 256, email, 0, 0);
68 stresc(escaped_room, 256, room, 0, 0);
70 wc_printf("<CENTER><H1>");
71 wc_printf(_("Confirmation request sent"));
73 wc_printf(_("You are subscribing <TT>%s"
74 "</TT> to the <b>%s</b> mailing list. "
76 "sent you an e-mail with one additional "
77 "Web link for you to click on to confirm "
78 "your subscription. This extra step is for "
79 "your protection, as it prevents others from "
80 "being able to subscribe you to lists "
81 "without your consent.<br /><br />"
82 "Please click on the link which is being "
83 "e-mailed to you and your subscription will "
84 "be confirmed.<br />\n"),
85 escaped_email, escaped_room);
86 wc_printf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
89 wc_printf("<FONT SIZE=+1><B>ERROR: %s</B>"
90 "</FONT><br /><br />\n",
99 else if (!strcasecmp(cmd, "unsubscribe")) {
100 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
103 (is_https ? "https" : "http"),
104 ChrPtr(WC->Hdr->HR.http_host)
106 serv_getln(buf, sizeof buf);
108 wc_printf("<CENTER><H1>Confirmation request sent</H1>"
109 "You are unsubscribing <TT>");
111 wc_printf("</TT> from the "");
113 wc_printf("" mailing list. The listserver has "
114 "sent you an e-mail with one additional "
115 "Web link for you to click on to confirm "
116 "your unsubscription. This extra step is for "
117 "your protection, as it prevents others from "
118 "being able to unsubscribe you from "
119 "lists without your consent.<br /><br />"
120 "Please click on the link which is being "
121 "e-mailed to you and your unsubscription will "
122 "be confirmed.<br />\n"
123 "<a href=\"listsub\">Back...</A></CENTER>\n"
127 wc_printf("<FONT SIZE=+1><B>ERROR: %s</B>"
128 "</FONT><br /><br />\n",
137 else if (!strcasecmp(cmd, "confirm")) {
138 serv_printf("SUBS confirm|%s|%s",
142 serv_getln(buf, sizeof buf);
144 wc_printf("<CENTER><H1>Confirmation successful!</H1>");
147 wc_printf("<CENTER><H1>Confirmation failed.</H1>"
148 "This could mean one of two things:<UL>\n"
149 "<LI>You waited too long to confirm your "
150 "subscribe/unsubscribe request (the "
151 "confirmation link is only valid for three "
152 "days)\n<LI>You have <i>already</i> "
153 "successfully confirmed your "
154 "subscribe/unsubscribe request and are "
155 "attempting to do it again.</UL>\n"
156 "The error returned by the server was: "
159 wc_printf("%s</CENTER><br />\n", &buf[4]);
163 * Any other (invalid) command causes the form to be displayed
166 FORM: wc_printf("<form method=\"POST\" action=\"listsub\">\n");
168 wc_printf("Name of list: "
169 "<select name=\"room\" size=1>\n");
172 serv_getln(buf, sizeof buf);
174 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
175 extract_token(sroom, buf, 0, '|', sizeof sroom);
176 self = extract_int(buf, 4) & QR2_SELFLIST ;
178 wc_printf("<option value=\"");
182 wc_printf("</option>\n");
186 wc_printf("</select><br><br>\n");
188 wc_printf("Your e-mail address: "
189 "<INPUT TYPE=\"text\" NAME=\"email\" "
193 wc_printf("\" maxlength=128 size=60><br><br>\n");
195 wc_printf("(If subscribing) preferred format: "
196 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
197 "VALUE=\"list\" CHECKED>One message at a time "
198 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
199 "VALUE=\"digest\">Digest format "
201 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
202 " VALUE=\"subscribe\">\n"
203 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
204 " VALUE=\"unsubscribe\"><br><br>\n"
208 wc_printf("<hr>When you attempt to subscribe or unsubscribe to "
209 "a mailing list, you will receive an e-mail containing"
210 " one additional web link to click on for final "
211 "confirmation. This extra step is for your "
212 "protection, as it prevents others from being able to "
213 "subscribe or unsubscribe you to lists.<br />\n"
219 do_template("endbox", NULL);
220 wc_printf("</td></tr></table></div>");
222 wc_printf("</BODY></HTML>\n");
224 end_webcit_session();
233 WebcitAddUrlHandler(HKEY("listsub"), "", 0, do_listsub, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);