]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/listsub/serv_listsub.c
* urlescs new parameter added.
[citadel.git] / citadel / modules / listsub / serv_listsub.c
index 93e93553b5a54c92618cb64125e6596b93baeced..331868d237260036bb06f582066e7cc3200ccca2 100644 (file)
@@ -33,6 +33,7 @@
 #include <sys/wait.h>
 #include <string.h>
 #include <limits.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "server.h"
 #include "citserver.h"
@@ -43,9 +44,7 @@
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
-#include "tools.h"
 #include "internet_addressing.h"
-#include "serv_network.h"
 #include "clientsocket.h"
 #include "file_ops.h"
 
@@ -75,7 +74,7 @@ void listsub_generate_token(char *buf) {
        );
 
        /* Convert it to base64 so it looks cool */     
-       CtdlEncodeBase64(buf, sourcebuf, strlen(sourcebuf));
+       CtdlEncodeBase64(buf, sourcebuf, strlen(sourcebuf), 0);
 }
 
 
@@ -157,7 +156,7 @@ void do_subscribe(char *room, char *email, char *subtype, char *webpage) {
 
        /* Generate and send the confirmation request */
 
-       urlesc(urlroom, qrbuf.QRname);
+       urlesc(urlroom, ROOMNAMELEN, qrbuf.QRname);
 
        snprintf(confirmation_request, sizeof confirmation_request,
 
@@ -297,7 +296,7 @@ void do_unsubscribe(char *room, char *email, char *webpage) {
 
        /* Generate and send the confirmation request */
 
-       urlesc(urlroom, qrbuf.QRname);
+       urlesc(urlroom, ROOMNAMELEN, qrbuf.QRname);
 
        snprintf(confirmation_request, sizeof confirmation_request,
 
@@ -451,7 +450,7 @@ void do_confirm(char *room, char *token) {
         * make another pass at the file, stripping out lines referring to
         * that address.
         */
-       if (strlen(address_to_unsubscribe) > 0) {
+       if (!IsEmptyStr(address_to_unsubscribe)) {
                holdbuf = malloc(SIZ);
                begin_critical_section(S_NETCONFIGS);
                ncfp = fopen(filename, "r+");
@@ -507,7 +506,12 @@ void do_confirm(char *room, char *token) {
         */
        if (success) {
                cprintf("%d %d operation(s) confirmed.\n", CIT_OK, success);
-               lprintf(CTDL_NOTICE, "Mailing list: %s %ssubscribed to %s with token %s\n", email, (strlen(address_to_unsubscribe) > 0) ? "un" : "", room, token);
+               lprintf(CTDL_NOTICE, 
+                       "Mailing list: %s %ssubscribed to %s with token %s\n", 
+                       email, 
+                       (!IsEmptyStr(address_to_unsubscribe)) ? "un" : "", 
+                       room, 
+                       token);
        }
        else {
                cprintf("%d Invalid token.\n", ERROR + ILLEGAL_VALUE);
@@ -566,8 +570,11 @@ void cmd_subs(char *cmdbuf) {
  */
 CTDL_MODULE_INIT(listsub)
 {
-       CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
-
+       if (!threading)
+       {
+               CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
+       }
+       
        /* return our Subversion id for the Log */
        return "$Id$";
 }