-/**
- * \brief List subscription handling
- */
-void do_listsub(void)
-{
- char cmd[256];
- char room[256];
- char token[256];
- char email[256];
- char subtype[256];
- char escaped_email[256];
- char escaped_room[256];
-
- char buf[SIZ];
- int self;
- char sroom[SIZ];
-
- strcpy(WC->wc_fullname, "");
- strcpy(WC->wc_username, "");
- strcpy(WC->wc_password, "");
- strcpy(WC->wc_roomname, "");
-
- output_headers(1, 0, 0, 1, 1, 0);
- begin_burst();
-
- wprintf("<HTML><HEAD>\n"
- "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
- "<link href=\"static/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
- "<TITLE>\n"
- );
- wprintf(_("List subscription"));
- wprintf("</TITLE></HEAD><BODY>\n");
-
- strcpy(cmd, bstr("cmd"));
- strcpy(room, bstr("room"));
- strcpy(token, bstr("token"));
- strcpy(email, bstr("email"));
- strcpy(subtype, bstr("subtype"));
-
- wprintf("<CENTER>"
- "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
- "<SPAN CLASS=\"titlebar\">");
- wprintf(_("List subscribe/unsubscribe"));
- wprintf("</SPAN></TD></TR></TABLE><br />\n");
-
- /**
- * Subscribe command
- */
- if (!strcasecmp(cmd, "subscribe")) {
- serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
- room,
- email,
- subtype,
- (is_https ? "https" : "http"),
- WC->http_host
- );
- serv_getln(buf, sizeof buf);
- if (buf[0] == '2') {
- stresc(escaped_email, email, 0, 0);
- stresc(escaped_room, room, 0, 0);
-
- wprintf("<CENTER><H1>");
- wprintf(_("Confirmation request sent"));
- wprintf("</H1>");
- wprintf(_("You are subscribing <TT>%s"
- "</TT> to the <b>%s</b> mailing list. "
- "The listserver has "
- "sent you an e-mail with one additional "
- "Web link for you to click on to confirm "
- "your subscription. This extra step is for "
- "your protection, as it prevents others from "
- "being able to subscribe you to lists "
- "without your consent.<br /><br />"
- "Please click on the link which is being "
- "e-mailed to you and your subscription will "
- "be confirmed.<br />\n"),
- escaped_email, escaped_room);
- wprintf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
- }
- else {
- wprintf("<FONT SIZE=+1><B>ERROR: %s</B>"
- "</FONT><br /><br />\n",
- &buf[4]);
- goto FORM;
- }
+ Room = sbstr("room");
+ if (Room == NULL) {
+ ImpMsg = _("You need to specify the mailinglist to subscribe to.");
+ AppendImportantMessage(ImpMsg, -1);
+ return 0;
+ }
+ Email = sbstr("email");
+ if (Email == NULL) {
+ ImpMsg = _("You need to specify the email address you'd like to subscribe with.");
+ AppendImportantMessage(ImpMsg, -1);
+ return 0;
+ }
+
+ Line = NewStrBuf();
+ serv_printf("LSUB subscribe|%s|%s|%s/listsub", ChrPtr(Room), ChrPtr(Email), ChrPtr(site_prefix));
+ StrBuf_ServGetln(Line);
+ rc = GetServerStatusMsg(Line, NULL, 1, 2);
+ FreeStrBuf(&Line);
+ if (rc == 2) {
+ putbstr("__FAIL", NewStrBufPlain(HKEY("1")));
+ }
+ return rc == 2;
+}
+
+
+int Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) {
+ int rc;
+ StrBuf *Line;
+ const char *ImpMsg;
+ const StrBuf *Room, *Email;
+
+ if (strcmp(bstr("cmd"), "unsubscribe")) {
+ return 0;
+ }
+
+ Room = sbstr("room");
+ if (Room == NULL) {
+ ImpMsg = _("You need to specify the mailinglist to subscribe to.");
+ AppendImportantMessage(ImpMsg, -1);
+ return 0;
+ }
+ Email = sbstr("email");
+ if (Email == NULL) {
+ ImpMsg = _("You need to specify the email address you'd like to subscribe with.");
+ AppendImportantMessage(ImpMsg, -1);
+ return 0;