* serv_network.c: retain unknown commands in netconfigs and write them back
authorArt Cancro <ajc@citadel.org>
Thu, 8 Aug 2002 02:49:12 +0000 (02:49 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 8 Aug 2002 02:49:12 +0000 (02:49 +0000)
* techdoc/netconfigs.txt: specify commands for subscribe/unsubscribe pending
* serv_listsub.c: added (currently a stub)

citadel/ChangeLog
citadel/Makefile.in
citadel/serv_listsub.c [new file with mode: 0644]
citadel/serv_network.c
citadel/serv_network.h
citadel/techdoc/netconfigs.txt

index 6018884941e90ad501beea308a95bfb8c0615152..c67074031a24a4ba7a7cad3496ab58dcd8db23d0 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 591.83  2002/08/08 02:49:12  ajc
+ * serv_network.c: retain unknown commands in netconfigs and write them back
+ * techdoc/netconfigs.txt: specify commands for subscribe/unsubscribe pending
+ * serv_listsub.c: added (currently a stub)
+
  Revision 591.82  2002/08/06 03:12:14  ajc
  * Fixed and clarified "new mail has arrived" messages.
 
@@ -3868,3 +3873,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 867470864cde2c751245a2d90d728feaf5e412fd..fdfe60d44fb873f5ed55cf7ddab2b4e7300a1efc 100644 (file)
@@ -33,6 +33,7 @@ SERV_MODULES=modules/libchat.la modules/libvcard.la \
        modules/libspam.la \
        modules/libimap.la \
        modules/libnetwork.la \
+       modules/liblistsub.la \
        modules/libnetfilter.la \
        modules/libpas2.la \
        modules/libinetcfg.la \
@@ -88,7 +89,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c \
        serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
        $(DOMAIN) clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
        client_passwords.c imap_misc.c serv_netfilter.c serv_mrtg.c \
-       serv_spam.c citadel_ipc.c \
+       serv_spam.c citadel_ipc.c serv_listsub.c \
        serv_imap.c imap_tools.c imap_fetch.c imap_search.c imap_store.c \
        serv_network.c serv_pas2.c serv_ical.c md5.c server_main.c
 
@@ -185,6 +186,9 @@ modules/libvandelay.la: serv_vandelay.lo $(LIBTOOL) libcitserver.la
 modules/libnetwork.la: serv_network.lo $(LIBTOOL) libcitserver.la
        $(LTSHARE) -o libnetwork.la ../serv_network.lo ../libcitserver.la
 
+modules/liblistsub.la: serv_listsub.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o liblistsub.la ../serv_listsub.lo ../libcitserver.la
+
 modules/libnetfilter.la: serv_netfilter.lo $(LIBTOOL) libcitserver.la
        $(LTSHARE) -o libnetfilter.la ../serv_netfilter.lo ../libcitserver.la
 
diff --git a/citadel/serv_listsub.c b/citadel/serv_listsub.c
new file mode 100644 (file)
index 0000000..45ee2cf
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * This module handles self-service subscription/unsubscription to mail lists.
+ *
+ * Copyright (C) 2002 by Art Cancro and others.
+ * This code is released under the terms of the GNU General Public License.
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <dirent.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "dynloader.h"
+#include "room_ops.h"
+#include "user_ops.h"
+#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"
+
+#ifndef HAVE_SNPRINTF
+#include "snprintf.h"
+#endif
+
+
+void cmd_subs(char *cmdbuf) {
+       cprintf("%d not yet implemented, dumbass...\n", ERROR);
+}
+
+
+/*
+ * Module entry point
+ */
+char *Dynamic_Module_Init(void)
+{
+       CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
+       return "$Id$";
+}
index f40c79829a140c2d305bfcf2e7cfa9f2855bbe97..fa1c7d1e7897f00f669708369eeed2bd7cad65df 100644 (file)
@@ -676,6 +676,8 @@ void network_spoolout_room(char *room_to_spool) {
        FILE *fp;
        struct SpoolControl sc;
        struct namelist *nptr;
+       size_t miscsize = 0;
+       size_t linesize = 0;
 
        lprintf(7, "Spooling <%s>\n", room_to_spool);
        if (getroom(&CC->quickroom, room_to_spool) != 0) {
@@ -724,6 +726,13 @@ void network_spoolout_room(char *room_to_spool) {
                        extract(nptr->name, buf, 1);
                        sc.ignet_push_shares = nptr;
                }
+               else {
+                       linesize = strlen(buf);
+                       sc.misc = realloc(sc.misc,
+                               (miscsize + linesize + 2) );
+                       sprintf(&sc.misc[miscsize], "%s\n", buf);
+                       miscsize = miscsize + linesize + 1;
+               }
 
 
        }
@@ -783,6 +792,8 @@ void network_spoolout_room(char *room_to_spool) {
                        phree(sc.ignet_push_shares);
                        sc.ignet_push_shares = nptr;
                }
+               fwrite(sc.misc, strlen(sc.misc), 1, fp);
+               phree(sc.misc);
 
                fclose(fp);
        }
index 1e8c6ef6beb78e95ac3f898576f0f4d3afa79037..927b980d8a1294644299898e45f8f4d6f7a3a5a3 100644 (file)
@@ -8,6 +8,7 @@ struct SpoolControl {
        struct namelist *listrecps;
        struct namelist *digestrecps;
        struct namelist *ignet_push_shares;
+       char *misc;
        FILE *digestfp;
        int num_msgs_spooled;
 };
index 08206d4552a2ee0454761bbe8cdf14f2211cfa7b..9d66b620388113f8feb6de5bb132b3468299c191 100644 (file)
@@ -46,4 +46,19 @@ IGnet (Citadel/UX networking) network, to which this room should be pushed
 (spooled).  Conceptually, this node will have a corresponding record pushing
 data in the other direction.
  
+  
+ INSTRUCTION:  subpending
+ SYNTAX:       subpending|friko@mumjiboolean.com|listrecp|A234Z|1234567890
+    "Subscription pending" for the specified address.  This means that
+someone has requested to subscribe an e-mail address (in this case,
+friko@mumjiboolean.com) to the list.  The third parameter is either "listrecp"
+or "digestrecp" to specify a normal subscription or a digest subscription.
+The fourth parameter is an authentication token which is generated by the server
+and e-mailed to the specified address.  When the user comes back and supplies
+this token, the subscription is complete.  The fifth parameter is a simple
+timestamp, so that we may purge old records which were never confirmed.
  
+ INSTRUCTION:  unsubpending
+ SYNTAX:       unsubpending|friko@mumjiboolean.com|A234Z|1234567890
+    Similar to the 'subpending' command, except this one is for unsubscribe
+requests.  The same rules apply with regard to the token.