4 * Web forms for handling mailing list subscribe/unsubscribe requests.
14 #include <sys/types.h>
16 #include <sys/socket.h>
19 #include <netinet/in.h>
32 * List subscription handling
46 strcpy(WC->wc_username, "");
47 strcpy(WC->wc_password, "");
48 strcpy(WC->wc_roomname, "");
50 wprintf("<HTML><HEAD><TITLE>List subscription</TITLE></HEAD><BODY>\n");
52 strcpy(cmd, bstr("cmd"));
53 strcpy(room, bstr("room"));
54 strcpy(token, bstr("token"));
55 strcpy(email, bstr("email"));
56 strcpy(subtype, bstr("subtype"));
59 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
60 "<SPAN CLASS=\"titlebar\">List subscribe/unsubscribe</SPAN>\n"
61 "</TD></TR></TABLE><br />\n"
67 if (!strcasecmp(cmd, "subscribe")) {
68 serv_printf("SUBS subscribe|%s|%s|%s|%s/listsub",
74 serv_getln(buf, sizeof buf);
76 wprintf("<CENTER><H1>Confirmation request sent</H1>"
77 "You are subscribing <TT>");
79 wprintf("</TT> to the "");
81 wprintf("" mailing list. The listserver has "
82 "sent you an e-mail with one additional "
83 "Web link for you to click on to confirm "
84 "your subscription. This extra step is for "
85 "your protection, as it prevents others from "
86 "being able to subscribe you to lists "
87 "without your consent.<br /><br />"
88 "Please click on the link which is being "
89 "e-mailed to you and your subscription will "
90 "be confirmed.<br />\n"
91 "<A HREF=\"/listsub\">Back...</A></CENTER>\n"
95 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
96 "</FONT><br /><br />\n",
103 * Unsubscribe command
105 else if (!strcasecmp(cmd, "unsubscribe")) {
106 serv_printf("SUBS unsubscribe|%s|%s|%s/listsub",
111 serv_getln(buf, sizeof buf);
113 wprintf("<CENTER><H1>Confirmation request sent</H1>"
114 "You are unsubscribing <TT>");
116 wprintf("</TT> from the "");
118 wprintf("" mailing list. The listserver has "
119 "sent you an e-mail with one additional "
120 "Web link for you to click on to confirm "
121 "your unsubscription. This extra step is for "
122 "your protection, as it prevents others from "
123 "being able to unsubscribe you from "
124 "lists without your consent.<br /><br />"
125 "Please click on the link which is being "
126 "e-mailed to you and your unsubscription will "
127 "be confirmed.<br />\n"
128 "<A HREF=\"/listsub\">Back...</A></CENTER>\n"
132 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
133 "</FONT><br /><br />\n",
142 else if (!strcasecmp(cmd, "confirm")) {
143 serv_printf("SUBS confirm|%s|%s",
147 serv_getln(buf, sizeof buf);
149 wprintf("<CENTER><H1>Confirmation successful!</H1>");
152 wprintf("<CENTER><H1>Confirmation failed.</H1>"
153 "This could mean one of two things:<UL>\n"
154 "<LI>You waited too long to confirm your "
155 "subscribe/unsubscribe request (the "
156 "confirmation link is only valid for three "
157 "days)\n<LI>You have <i>already</i> "
158 "successfully confirmed your "
159 "subscribe/unsubscribe request and are "
160 "attempting to do it again.</UL>\n"
161 "The error returned by the server was: "
164 wprintf("%s</CENTER><br />\n", &buf[4]);
168 * Any other (invalid) command causes the form to be displayed
171 FORM: wprintf("<FORM METHOD=\"GET\" ACTION=\"/listsub\">\n"
175 wprintf("<TR><TD>Name of list</TD><TD>"
176 "<SELECT NAME=\"room\" SIZE=1>\n");
179 serv_getln(buf, sizeof buf);
181 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
182 extract_token(sroom, buf, 0, '|', sizeof sroom);
183 self = extract_int(buf, 4) & QR2_SELFLIST ;
185 wprintf("<OPTION VALUE=\"");
189 wprintf("</OPTION>\n");
196 wprintf("<TR><TD>Your e-mail address</TD><TD>"
197 "<INPUT TYPE=\"text\" NAME=\"email\" "
201 wprintf("\" MAXLENGTH=128></TD></TR>\n");
204 "(If subscribing) preferred format: "
205 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
206 "VALUE=\"list\">One message at a time "
207 "<INPUT TYPE=\"radio\" NAME=\"subtype\""
208 "VALUE=\"digest\" CHECKED>Digest format "
210 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
211 " VALUE=\"subscribe\">\n"
212 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
213 " VALUE=\"unsubscribe\">\n"
217 wprintf("<br />When you attempt to subscribe or unsubscribe to "
218 "a mailing list, you will receive an e-mail containing"
219 " one additional web link to click on for final "
220 "confirmation. This extra step is for your "
221 "protection, as it prevents others from being able to "
222 "subscribe or unsubscribe you to lists.<br />\n"
228 * Since this isn't part of a normal Citadel session, we bail right
229 * out without maintaining any state.
231 /* wDumpContent(2); */
232 wprintf("</BODY></HTML>\n");
233 end_webcit_session();