2 * Web forms for handling mailing list subscribe/unsubscribe requests.
4 * Copyright (c) 1996-2012 by the citadel.org team
6 * This program is open source software. You can redistribute it and/or
7 * modify it under the terms of the GNU General Public License, version 3.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
18 * List subscription handling
21 int Conditional_LISTSUB_EXECUTE_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP)
26 const StrBuf *Room, *Email, *SubType;
31 ImpMsg = _("You need to specify the mailinglist to subscribe to.");
32 AppendImportantMessage(ImpMsg, -1);
35 Email = sbstr("email");
38 ImpMsg = _("You need to specify the email address you'd like to subscribe with.");
39 AppendImportantMessage(ImpMsg, -1);
42 SubType = sbstr("subtype");
45 serv_printf("SUBS subscribe|%s|%s|%s|%s/listsub",
51 StrBuf_ServGetln(Line);
52 rc = GetServerStatusMsg(Line, NULL, 1, 2);
55 putbstr("__FAIL", NewStrBufPlain(HKEY("1")));
59 int Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE(StrBuf *Target, WCTemplputParams *TP)
64 const StrBuf *Room, *Email;
69 ImpMsg = _("You need to specify the mailinglist to subscribe to.");
70 AppendImportantMessage(ImpMsg, -1);
73 Email = sbstr("email");
76 ImpMsg = _("You need to specify the email address you'd like to subscribe with.");
77 AppendImportantMessage(ImpMsg, -1);
81 serv_printf("SUBS unsubscribe|%s|%s|%s/listsub",
87 StrBuf_ServGetln(Line);
88 rc = GetServerStatusMsg(Line, NULL, 1, 2);
91 putbstr("__FAIL", NewStrBufPlain(HKEY("1")));
95 int Conditional_LISTSUB_EXECUTE_CONFIRM_SUBSCRIBE(StrBuf *Target, WCTemplputParams *TP)
100 const StrBuf *Room, *Token;
102 Room = sbstr("room");
105 ImpMsg = _("You need to specify the mailinglist to subscribe to.");
106 AppendImportantMessage(ImpMsg, -1);
109 Token = sbstr("token");
112 ImpMsg = _("You need to specify the mailinglist to subscribe to.");
113 AppendImportantMessage(ImpMsg, -1);
118 serv_printf("SUBS confirm|%s|%s",
122 StrBuf_ServGetln(Line);
123 rc = GetServerStatusMsg(Line, NULL, 1, 2);
126 putbstr("__FAIL", NewStrBufPlain(HKEY("1")));
130 void do_listsub(void)
132 if (!havebstr("cmd"))
134 putbstr("cmd", NewStrBufPlain(HKEY("choose")));
136 output_headers(1, 0, 0, 0, 1, 0);
137 do_template("listsub_display");
145 RegisterConditional("COND:LISTSUB:EXECUTE:SUBSCRIBE", 0, Conditional_LISTSUB_EXECUTE_SUBSCRIBE, CTX_NONE);
146 RegisterConditional("COND:LISTSUB:EXECUTE:UNSUBSCRIBE", 0, Conditional_LISTSUB_EXECUTE_UNSUBSCRIBE, CTX_NONE);
147 RegisterConditional("COND:LISTSUB:EXECUTE:CONFIRM:SUBSCRIBE", 0, Conditional_LISTSUB_EXECUTE_CONFIRM_SUBSCRIBE, CTX_NONE);
149 WebcitAddUrlHandler(HKEY("listsub"), "", 0, do_listsub, ANONYMOUS|COOKIEUNNEEDED|FORCE_SESSIONCLOSE);