4 * Web forms for handling mailing list subscribe/unsubscribe requests.
13 * List subscription handling
22 char escaped_email[256];
23 char escaped_room[256];
29 strcpy(WC->wc_username, "");
30 strcpy(WC->wc_password, "");
31 strcpy(WC->wc_roomname, "");
33 output_headers(1, 0, 0, 1, 1, 0);
36 wprintf("<HTML><HEAD>\n"
37 "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
38 "<link href=\"static/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
41 wprintf(_("List subscription"));
42 wprintf("</TITLE></HEAD><BODY>\n");
44 strcpy(cmd, bstr("cmd"));
45 strcpy(room, bstr("room"));
46 strcpy(token, bstr("token"));
47 strcpy(email, bstr("email"));
48 strcpy(subtype, bstr("subtype"));
51 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
52 "<SPAN CLASS=\"titlebar\">");
53 wprintf(_("List subscribe/unsubscribe"));
54 wprintf("</SPAN></TD></TR></TABLE><br />\n");
59 if (!strcasecmp(cmd, "subscribe")) {
60 serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
64 (is_https ? "https" : "http"),
67 serv_getln(buf, sizeof buf);
69 stresc(escaped_email, email, 0, 0);
70 stresc(escaped_room, room, 0, 0);
72 wprintf("<CENTER><H1>");
73 wprintf(_("Confirmation request sent"));
75 wprintf(_("You are subscribing <TT>%s"
76 "</TT> to the <b>%s</b> mailing list. "
78 "sent you an e-mail with one additional "
79 "Web link for you to click on to confirm "
80 "your subscription. This extra step is for "
81 "your protection, as it prevents others from "
82 "being able to subscribe you to lists "
83 "without your consent.<br /><br />"
84 "Please click on the link which is being "
85 "e-mailed to you and your subscription will "
86 "be confirmed.<br />\n"),
87 escaped_email, escaped_room);
88 wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
91 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
92 "</FONT><br /><br />\n",
101 else if (!strcasecmp(cmd, "unsubscribe")) {
102 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
105 (is_https ? "https" : "http"),
108 serv_getln(buf, sizeof buf);
110 wprintf("<CENTER><H1>Confirmation request sent</H1>"
111 "You are unsubscribing <TT>");
113 wprintf("</TT> from the "");
115 wprintf("" mailing list. The listserver has "
116 "sent you an e-mail with one additional "
117 "Web link for you to click on to confirm "
118 "your unsubscription. This extra step is for "
119 "your protection, as it prevents others from "
120 "being able to unsubscribe you from "
121 "lists without your consent.<br /><br />"
122 "Please click on the link which is being "
123 "e-mailed to you and your unsubscription will "
124 "be confirmed.<br />\n"
125 "<a href=\"listsub\">Back...</A></CENTER>\n"
129 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
130 "</FONT><br /><br />\n",
139 else if (!strcasecmp(cmd, "confirm")) {
140 serv_printf("SUBS confirm|%s|%s",
144 serv_getln(buf, sizeof buf);
146 wprintf("<CENTER><H1>Confirmation successful!</H1>");
149 wprintf("<CENTER><H1>Confirmation failed.</H1>"
150 "This could mean one of two things:<UL>\n"
151 "<LI>You waited too long to confirm your "
152 "subscribe/unsubscribe request (the "
153 "confirmation link is only valid for three "
154 "days)\n<LI>You have <i>already</i> "
155 "successfully confirmed your "
156 "subscribe/unsubscribe request and are "
157 "attempting to do it again.</UL>\n"
158 "The error returned by the server was: "
161 wprintf("%s</CENTER><br />\n", &buf[4]);
165 * Any other (invalid) command causes the form to be displayed
168 FORM: wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
172 wprintf("<TR><TD>Name of list</TD><TD>"
173 "<SELECT NAME=\"room\" SIZE=1>\n");
176 serv_getln(buf, sizeof buf);
178 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
179 extract_token(sroom, buf, 0, '|', sizeof sroom);
180 self = extract_int(buf, 4) & QR2_SELFLIST ;
182 wprintf("<OPTION VALUE=\"");
186 wprintf("</OPTION>\n");
193 wprintf("<TR><TD>Your e-mail address</TD><TD>"
194 "<INPUT TYPE=\"text\" NAME=\"email\" "
198 wprintf("\" MAXLENGTH=128></TD></TR>\n");
201 "(If subscribing) preferred format: "
202 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
203 "VALUE=\"list\">One message at a time "
204 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
205 "VALUE=\"digest\" CHECKED>Digest format "
207 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
208 " VALUE=\"subscribe\">\n"
209 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
210 " VALUE=\"unsubscribe\">\n"
214 wprintf("<br />When you attempt to subscribe or unsubscribe to "
215 "a mailing list, you will receive an e-mail containing"
216 " one additional web link to click on for final "
217 "confirmation. This extra step is for your "
218 "protection, as it prevents others from being able to "
219 "subscribe or unsubscribe you to lists.<br />\n"
224 wprintf("</BODY></HTML>\n");
226 end_webcit_session();