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/listsub",
59 serv_getln(buf, sizeof buf);
61 stresc(escaped_email, email, 0, 0);
62 stresc(escaped_room, room, 0, 0);
64 wprintf("<CENTER><H1>");
65 wprintf(_("Confirmation request sent"));
67 wprintf(_("You are subscribing <TT>%s"
68 "</TT> to the <b>%s</b> mailing list. "
70 "sent you an e-mail with one additional "
71 "Web link for you to click on to confirm "
72 "your subscription. This extra step is for "
73 "your protection, as it prevents others from "
74 "being able to subscribe you to lists "
75 "without your consent.<br /><br />"
76 "Please click on the link which is being "
77 "e-mailed to you and your subscription will "
78 "be confirmed.<br />\n"),
79 escaped_email, escaped_room);
80 wprintf("<A HREF=\"/listsub\">%s</A></CENTER>\n", _("Go back..."));
83 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
84 "</FONT><br /><br />\n",
93 else if (!strcasecmp(cmd, "unsubscribe")) {
94 serv_printf("SUBS unsubscribe|%s|%s|%s/listsub",
99 serv_getln(buf, sizeof buf);
101 wprintf("<CENTER><H1>Confirmation request sent</H1>"
102 "You are unsubscribing <TT>");
104 wprintf("</TT> from the "");
106 wprintf("" mailing list. The listserver has "
107 "sent you an e-mail with one additional "
108 "Web link for you to click on to confirm "
109 "your unsubscription. This extra step is for "
110 "your protection, as it prevents others from "
111 "being able to unsubscribe you from "
112 "lists without your consent.<br /><br />"
113 "Please click on the link which is being "
114 "e-mailed to you and your unsubscription will "
115 "be confirmed.<br />\n"
116 "<A HREF=\"/listsub\">Back...</A></CENTER>\n"
120 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
121 "</FONT><br /><br />\n",
130 else if (!strcasecmp(cmd, "confirm")) {
131 serv_printf("SUBS confirm|%s|%s",
135 serv_getln(buf, sizeof buf);
137 wprintf("<CENTER><H1>Confirmation successful!</H1>");
140 wprintf("<CENTER><H1>Confirmation failed.</H1>"
141 "This could mean one of two things:<UL>\n"
142 "<LI>You waited too long to confirm your "
143 "subscribe/unsubscribe request (the "
144 "confirmation link is only valid for three "
145 "days)\n<LI>You have <i>already</i> "
146 "successfully confirmed your "
147 "subscribe/unsubscribe request and are "
148 "attempting to do it again.</UL>\n"
149 "The error returned by the server was: "
152 wprintf("%s</CENTER><br />\n", &buf[4]);
156 * Any other (invalid) command causes the form to be displayed
159 FORM: wprintf("<FORM METHOD=\"POST\" ACTION=\"/listsub\">\n"
163 wprintf("<TR><TD>Name of list</TD><TD>"
164 "<SELECT NAME=\"room\" SIZE=1>\n");
167 serv_getln(buf, sizeof buf);
169 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
170 extract_token(sroom, buf, 0, '|', sizeof sroom);
171 self = extract_int(buf, 4) & QR2_SELFLIST ;
173 wprintf("<OPTION VALUE=\"");
177 wprintf("</OPTION>\n");
184 wprintf("<TR><TD>Your e-mail address</TD><TD>"
185 "<INPUT TYPE=\"text\" NAME=\"email\" "
189 wprintf("\" MAXLENGTH=128></TD></TR>\n");
192 "(If subscribing) preferred format: "
193 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
194 "VALUE=\"list\">One message at a time "
195 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
196 "VALUE=\"digest\" CHECKED>Digest format "
198 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
199 " VALUE=\"subscribe\">\n"
200 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
201 " VALUE=\"unsubscribe\">\n"
205 wprintf("<br />When you attempt to subscribe or unsubscribe to "
206 "a mailing list, you will receive an e-mail containing"
207 " one additional web link to click on for final "
208 "confirmation. This extra step is for your "
209 "protection, as it prevents others from being able to "
210 "subscribe or unsubscribe you to lists.<br />\n"
216 * Since this isn't part of a normal Citadel session, we bail right
217 * out without maintaining any state.
219 /* wDumpContent(2); */
220 wprintf("</BODY></HTML>\n");
221 end_webcit_session();