-/*
- * 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];
-
- FlushStrBuf(WC->wc_fullname);
- FlushStrBuf(WC->wc_username);
- FlushStrBuf(WC->wc_password);
- FlushStrBuf(WC->CurRoom.name);
-
- output_headers(1, 0, 0, 1, 1, 0);
- begin_burst();
-
- wc_printf("<HTML><HEAD>\n"
- "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\" />\n"
- "<link href=\"static/styles/webcit.css\" rel=\"stylesheet\" type=\"text/css\">\n"
- "<TITLE>\n"
- );
- wc_printf(_("List subscription"));
- wc_printf("</TITLE></HEAD><BODY>\n");
-
- strcpy(cmd, bstr("cmd"));
- strcpy(room, bstr("room"));
- strcpy(token, bstr("token"));
- strcpy(email, bstr("email"));
- strcpy(subtype, bstr("subtype"));
-
- wc_printf("<div align=center>");
- wc_printf("<table border=0 width=75%%><tr><td>");
-
- do_template("beginbox_1", NULL);
- StrBufAppendBufPlain(WC->WBuf, _("List subscribe/unsubscribe"), -1, 0);
- do_template("beginbox_2", NULL);
- wc_printf("<div align=center><br>");
-
- /*
- * Subscribe command
- */
- if (!strcasecmp(cmd, "subscribe")) {
- serv_printf("SUBS subscribe|%s|%s|%s|%s://%s/listsub",
- room,
- email,
- subtype,
- (is_https ? "https" : "http"),
- ChrPtr(WC->Hdr->HR.http_host)
- );
- serv_getln(buf, sizeof buf);
- if (buf[0] == '2') {
- stresc(escaped_email, 256, email, 0, 0);
- stresc(escaped_room, 256, room, 0, 0);
-
- wc_printf("<CENTER><H1>");
- wc_printf(_("Confirmation request sent"));
- wc_printf("</H1>");
- wc_printf(_("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);
- wc_printf("<a href=\"listsub\">%s</A></CENTER>\n", _("Go back..."));
- }
- else {
- wc_printf("<FONT SIZE=+1><B>ERROR: %s</B>"
- "</FONT><br /><br />\n",
- &buf[4]);
- goto FORM;
- }
+// List subscription handling
+int Conditional_LISTSUB_EXECUTE_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP) {
+ int rc;
+ StrBuf *Line;
+ const char *ImpMsg;
+ const StrBuf *Room, *Email;
+
+ if (strcmp(bstr("cmd"), "subscribe")) {
+ 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;
+ }
+
+ 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;