5 * \defgroup ListSubForms Web forms for handling mailing list subscribe/unsubscribe requests.
6 * \ingroup WebcitDisplayItems
15 * \brief List subscription handling
24 char escaped_email[256];
25 char escaped_room[256];
31 strcpy(WC->wc_fullname, "");
32 strcpy(WC->wc_username, "");
33 strcpy(WC->wc_password, "");
34 strcpy(WC->wc_roomname, "");
36 output_headers(1, 0, 0, 1, 1, 0);
39 wprintf("<HTML><HEAD>\n"
40 "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
41 "<link href=\"static/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
44 wprintf(_("List subscription"));
45 wprintf("</TITLE></HEAD><BODY>\n");
47 strcpy(cmd, bstr("cmd"));
48 strcpy(room, bstr("room"));
49 strcpy(token, bstr("token"));
50 strcpy(email, bstr("email"));
51 strcpy(subtype, bstr("subtype"));
54 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
55 "<SPAN CLASS=\"titlebar\">");
56 wprintf(_("List subscribe/unsubscribe"));
57 wprintf("</SPAN></TD></TR></TABLE><br />\n");
62 if (!strcasecmp(cmd, "subscribe")) {
63 serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
67 (is_https ? "https" : "http"),
70 serv_getln(buf, sizeof buf);
72 stresc(escaped_email, email, 0, 0);
73 stresc(escaped_room, room, 0, 0);
75 wprintf("<CENTER><H1>");
76 wprintf(_("Confirmation request sent"));
78 wprintf(_("You are subscribing <TT>%s"
79 "</TT> to the <b>%s</b> mailing list. "
81 "sent you an e-mail with one additional "
82 "Web link for you to click on to confirm "
83 "your subscription. This extra step is for "
84 "your protection, as it prevents others from "
85 "being able to subscribe you to lists "
86 "without your consent.<br /><br />"
87 "Please click on the link which is being "
88 "e-mailed to you and your subscription will "
89 "be confirmed.<br />\n"),
90 escaped_email, escaped_room);
91 wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
94 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
95 "</FONT><br /><br />\n",
102 * Unsubscribe command
104 else if (!strcasecmp(cmd, "unsubscribe")) {
105 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
108 (is_https ? "https" : "http"),
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=\"POST\" 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"
227 wprintf("</BODY></HTML>\n");
229 end_webcit_session();