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 wprintf("<HTML><HEAD><TITLE>");
34 wprintf(_("List subscription"));
35 wprintf("</TITLE></HEAD><BODY>\n");
37 strcpy(cmd, bstr("cmd"));
38 strcpy(room, bstr("room"));
39 strcpy(token, bstr("token"));
40 strcpy(email, bstr("email"));
41 strcpy(subtype, bstr("subtype"));
44 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
45 "<SPAN CLASS=\"titlebar\">");
46 wprintf(_("List subscribe/unsubscribe"));
47 wprintf("</SPAN></TD></TR></TABLE><br />\n");
52 if (!strcasecmp(cmd, "subscribe")) {
53 serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
57 (is_https ? "https" : "http"),
60 serv_getln(buf, sizeof buf);
62 stresc(escaped_email, email, 0, 0);
63 stresc(escaped_room, room, 0, 0);
65 wprintf("<CENTER><H1>");
66 wprintf(_("Confirmation request sent"));
68 wprintf(_("You are subscribing <TT>%s"
69 "</TT> to the <b>%s</b> mailing list. "
71 "sent you an e-mail with one additional "
72 "Web link for you to click on to confirm "
73 "your subscription. This extra step is for "
74 "your protection, as it prevents others from "
75 "being able to subscribe you to lists "
76 "without your consent.<br /><br />"
77 "Please click on the link which is being "
78 "e-mailed to you and your subscription will "
79 "be confirmed.<br />\n"),
80 escaped_email, escaped_room);
81 wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
84 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
85 "</FONT><br /><br />\n",
94 else if (!strcasecmp(cmd, "unsubscribe")) {
95 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
98 (is_https ? "https" : "http"),
101 serv_getln(buf, sizeof buf);
103 wprintf("<CENTER><H1>Confirmation request sent</H1>"
104 "You are unsubscribing <TT>");
106 wprintf("</TT> from the "");
108 wprintf("" mailing list. The listserver has "
109 "sent you an e-mail with one additional "
110 "Web link for you to click on to confirm "
111 "your unsubscription. This extra step is for "
112 "your protection, as it prevents others from "
113 "being able to unsubscribe you from "
114 "lists without your consent.<br /><br />"
115 "Please click on the link which is being "
116 "e-mailed to you and your unsubscription will "
117 "be confirmed.<br />\n"
118 "<a href=\"listsub\">Back...</A></CENTER>\n"
122 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
123 "</FONT><br /><br />\n",
132 else if (!strcasecmp(cmd, "confirm")) {
133 serv_printf("SUBS confirm|%s|%s",
137 serv_getln(buf, sizeof buf);
139 wprintf("<CENTER><H1>Confirmation successful!</H1>");
142 wprintf("<CENTER><H1>Confirmation failed.</H1>"
143 "This could mean one of two things:<UL>\n"
144 "<LI>You waited too long to confirm your "
145 "subscribe/unsubscribe request (the "
146 "confirmation link is only valid for three "
147 "days)\n<LI>You have <i>already</i> "
148 "successfully confirmed your "
149 "subscribe/unsubscribe request and are "
150 "attempting to do it again.</UL>\n"
151 "The error returned by the server was: "
154 wprintf("%s</CENTER><br />\n", &buf[4]);
158 * Any other (invalid) command causes the form to be displayed
161 FORM: wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
165 wprintf("<TR><TD>Name of list</TD><TD>"
166 "<SELECT NAME=\"room\" SIZE=1>\n");
169 serv_getln(buf, sizeof buf);
171 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
172 extract_token(sroom, buf, 0, '|', sizeof sroom);
173 self = extract_int(buf, 4) & QR2_SELFLIST ;
175 wprintf("<OPTION VALUE=\"");
179 wprintf("</OPTION>\n");
186 wprintf("<TR><TD>Your e-mail address</TD><TD>"
187 "<INPUT TYPE=\"text\" NAME=\"email\" "
191 wprintf("\" MAXLENGTH=128></TD></TR>\n");
194 "(If subscribing) preferred format: "
195 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
196 "VALUE=\"list\">One message at a time "
197 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
198 "VALUE=\"digest\" CHECKED>Digest format "
200 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
201 " VALUE=\"subscribe\">\n"
202 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
203 " VALUE=\"unsubscribe\">\n"
207 wprintf("<br />When you attempt to subscribe or unsubscribe to "
208 "a mailing list, you will receive an e-mail containing"
209 " one additional web link to click on for final "
210 "confirmation. This extra step is for your "
211 "protection, as it prevents others from being able to "
212 "subscribe or unsubscribe you to lists.<br />\n"
218 * Since this isn't part of a normal Citadel session, we bail right
219 * out without maintaining any state.
221 /* wDumpContent(2); */
222 wprintf("</BODY></HTML>\n");
223 end_webcit_session();