00001
00002
00003
00010 #include "webcit.h"
00011
00012
00013
00017 void do_listsub(void)
00018 {
00019 char cmd[256];
00020 char room[256];
00021 char token[256];
00022 char email[256];
00023 char subtype[256];
00024 char escaped_email[256];
00025 char escaped_room[256];
00026
00027 char buf[SIZ];
00028 int self;
00029 char sroom[SIZ];
00030
00031 strcpy(WC->wc_fullname, "");
00032 strcpy(WC->wc_username, "");
00033 strcpy(WC->wc_password, "");
00034 strcpy(WC->wc_roomname, "");
00035
00036 output_headers(1, 0, 0, 1, 1, 0);
00037 begin_burst();
00038
00039 wprintf("<HTML><HEAD>\n"
00040 "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
00041 "<link href=\"static/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
00042 "<TITLE>\n"
00043 );
00044 wprintf(_("List subscription"));
00045 wprintf("</TITLE></HEAD><BODY>\n");
00046
00047 strcpy(cmd, bstr("cmd"));
00048 strcpy(room, bstr("room"));
00049 strcpy(token, bstr("token"));
00050 strcpy(email, bstr("email"));
00051 strcpy(subtype, bstr("subtype"));
00052
00053 wprintf("<CENTER>"
00054 "<TABLE class=\"listsub_banner\"><TR><TD>"
00055 "<SPAN CLASS=\"titlebar\">");
00056 wprintf(_("List subscribe/unsubscribe"));
00057 wprintf("</SPAN></TD></TR></TABLE><br />\n");
00058
00062 if (!strcasecmp(cmd, "subscribe")) {
00063 serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
00064 room,
00065 email,
00066 subtype,
00067 (is_https ? "https" : "http"),
00068 WC->http_host
00069 );
00070 serv_getln(buf, sizeof buf);
00071 if (buf[0] == '2') {
00072 stresc(escaped_email, email, 0, 0);
00073 stresc(escaped_room, room, 0, 0);
00074
00075 wprintf("<CENTER><H1>");
00076 wprintf(_("Confirmation request sent"));
00077 wprintf("</H1>");
00078 wprintf(_("You are subscribing <TT>%s"
00079 "</TT> to the <b>%s</b> mailing list. "
00080 "The listserver has "
00081 "sent you an e-mail with one additional "
00082 "Web link for you to click on to confirm "
00083 "your subscription. This extra step is for "
00084 "your protection, as it prevents others from "
00085 "being able to subscribe you to lists "
00086 "without your consent.<br /><br />"
00087 "Please click on the link which is being "
00088 "e-mailed to you and your subscription will "
00089 "be confirmed.<br />\n"),
00090 escaped_email, escaped_room);
00091 wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
00092 }
00093 else {
00094 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
00095 "</FONT><br /><br />\n",
00096 &buf[4]);
00097 goto FORM;
00098 }
00099 }
00100
00104 else if (!strcasecmp(cmd, "unsubscribe")) {
00105 serv_printf("SUBS unsubscribe|%s|%s|%s://%s/listsub",
00106 room,
00107 email,
00108 (is_https ? "https" : "http"),
00109 WC->http_host
00110 );
00111 serv_getln(buf, sizeof buf);
00112 if (buf[0] == '2') {
00113 wprintf("<CENTER><H1>Confirmation request sent</H1>"
00114 "You are unsubscribing <TT>");
00115 escputs(email);
00116 wprintf("</TT> from the "");
00117 escputs(room);
00118 wprintf("" mailing list. The listserver has "
00119 "sent you an e-mail with one additional "
00120 "Web link for you to click on to confirm "
00121 "your unsubscription. This extra step is for "
00122 "your protection, as it prevents others from "
00123 "being able to unsubscribe you from "
00124 "lists without your consent.<br /><br />"
00125 "Please click on the link which is being "
00126 "e-mailed to you and your unsubscription will "
00127 "be confirmed.<br />\n"
00128 "<a href=\"listsub\">Back...</A></CENTER>\n"
00129 );
00130 }
00131 else {
00132 wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
00133 "</FONT><br /><br />\n",
00134 &buf[4]);
00135 goto FORM;
00136 }
00137 }
00138
00142 else if (!strcasecmp(cmd, "confirm")) {
00143 serv_printf("SUBS confirm|%s|%s",
00144 room,
00145 token
00146 );
00147 serv_getln(buf, sizeof buf);
00148 if (buf[0] == '2') {
00149 wprintf("<CENTER><H1>Confirmation successful!</H1>");
00150 }
00151 else {
00152 wprintf("<CENTER><H1>Confirmation failed.</H1>"
00153 "This could mean one of two things:<UL>\n"
00154 "<LI>You waited too long to confirm your "
00155 "subscribe/unsubscribe request (the "
00156 "confirmation link is only valid for three "
00157 "days)\n<LI>You have <i>already</i> "
00158 "successfully confirmed your "
00159 "subscribe/unsubscribe request and are "
00160 "attempting to do it again.</UL>\n"
00161 "The error returned by the server was: "
00162 );
00163 }
00164 wprintf("%s</CENTER><br />\n", &buf[4]);
00165 }
00166
00170 else {
00171 FORM: wprintf("<FORM METHOD=\"POST\" action=\"listsub\">\n"
00172 "<TABLE BORDER=0>\n"
00173 );
00174
00175 wprintf("<TR><TD>Name of list</TD><TD>"
00176 "<SELECT NAME=\"room\" SIZE=1>\n");
00177
00178 serv_puts("LPRM");
00179 serv_getln(buf, sizeof buf);
00180 if (buf[0] == '1') {
00181 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
00182 extract_token(sroom, buf, 0, '|', sizeof sroom);
00183 self = extract_int(buf, 4) & QR2_SELFLIST ;
00184 if (self) {
00185 wprintf("<OPTION VALUE=\"");
00186 escputs(sroom);
00187 wprintf("\">");
00188 escputs(sroom);
00189 wprintf("</OPTION>\n");
00190 }
00191 }
00192 }
00193 wprintf("</SELECT>"
00194 "</TD></TR>\n");
00195
00196 wprintf("<TR><TD>Your e-mail address</TD><TD>"
00197 "<INPUT TYPE=\"text\" NAME=\"email\" "
00198 "VALUE=\""
00199 );
00200 escputs(email);
00201 wprintf("\" MAXLENGTH=128></TD></TR>\n");
00202
00203 wprintf("</TABLE>"
00204 "(If subscribing) preferred format: "
00205 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
00206 "VALUE=\"list\" CHECKED>One message at a time "
00207 "<INPUT TYPE=\"radio\" NAME=\"subtype\" "
00208 "VALUE=\"digest\">Digest format "
00209 "<br />\n"
00210 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
00211 " VALUE=\"subscribe\">\n"
00212 "<INPUT TYPE=\"submit\" NAME=\"cmd\""
00213 " VALUE=\"unsubscribe\">\n"
00214 "</FORM>\n"
00215 );
00216
00217 wprintf("<br />When you attempt to subscribe or unsubscribe to "
00218 "a mailing list, you will receive an e-mail containing"
00219 " one additional web link to click on for final "
00220 "confirmation. This extra step is for your "
00221 "protection, as it prevents others from being able to "
00222 "subscribe or unsubscribe you to lists.<br />\n"
00223 );
00224
00225 }
00226
00227 wprintf("</BODY></HTML>\n");
00228 wDumpContent(0);
00229 end_webcit_session();
00230 }
00231
00232
00233