]> code.citadel.org Git - citadel.git/commitdiff
* IGnet stuff
authorArt Cancro <ajc@citadel.org>
Mon, 28 Feb 2000 05:38:30 +0000 (05:38 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 28 Feb 2000 05:38:30 +0000 (05:38 +0000)
citadel/Makefile.in
citadel/ignet.c [new file with mode: 0644]
citadel/ignet.h [new file with mode: 0644]
citadel/serv_smtp.c
citadel/sysdep.c

index 7daefb1d81139b51f1bb752813172ddb63252001..5dde47ce7e85f4c5dcac5fb2fc4c91b01c8b2f32 100644 (file)
@@ -76,7 +76,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \
        whobbs.c sendcommand.c mime_parser.c base64.c qpdecode.c getutline.c \
        auth.c chkpwd.c client_icq.c html.c vcard.c serv_upgrade.c \
        serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
-       domain.c clientsocket.c serv_inetcfg.c serv_rwho.c
+       domain.c clientsocket.c serv_inetcfg.c serv_rwho.c ignet.c
 
 DEP_FILES=$(SOURCES:.c=.d)
 
@@ -113,7 +113,7 @@ SERV_OBJS = citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \
        msgbase.ro config.ro sysdep.ro locate_host.ro housekeeping.ro \
        database.ro control.ro logging.ro policy.ro dynloader.ro tools.ro \
        mime_parser.ro html.ro internet_addressing.ro \
-       parsedate.ro genstamp.ro clientsocket.ro \
+       parsedate.ro genstamp.ro clientsocket.ro ignet.ro \
        $(AUTH) $(LIBOBJS:.o=.ro)
 
 citserver: $(SERV_OBJS)
diff --git a/citadel/ignet.c b/citadel/ignet.c
new file mode 100644 (file)
index 0000000..cdc1cd5
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * $Id$
+ *
+ */
+
+#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 <sys/time.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include <time.h>
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "tools.h"
+#include "msgbase.h"
+#include "internet_addressing.h"
+#include "ignet.h"
+#include "user_ops.h"
+#include "room_ops.h"
+#include "parsedate.h"
+
+
+
+/*
+ * Returns nonzero if the specified nodename is on the Citadel network
+ */
+
+int is_ignet(char *node) {
+
+       return 0;               /* FIXME */
+
+}
+
+
+int ignet_spool_to(char *node, long msgnum) {
+
+       return 1;               /* FIXME */
+
+}
+
+
+
+
+
diff --git a/citadel/ignet.h b/citadel/ignet.h
new file mode 100644 (file)
index 0000000..b371d86
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * $Id$
+ */
+
+
+
+int is_ignet(char *node);
+int ignet_spool_to(char *node, long msgnum);
+
+
+
index d767860208e0c78ae7fe62547bd429a671a63b81..8dd3b6554ed52ff263d4466fbfb336f350a501e2 100644 (file)
@@ -30,6 +30,7 @@
 #include "msgbase.h"
 #include "tools.h"
 #include "internet_addressing.h"
+#include "ignet.h"
 #include "genstamp.h"
 #include "domain.h"
 #include "clientsocket.h"
@@ -704,6 +705,19 @@ void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum)
 
        /* Parse out the host portion of the recipient address */
        process_rfc822_addr(addr, user, node, name);
+
+       if (is_ignet(node)) {
+               if (ignet_spool_to(node, msgnum) == 0) {
+                       strcpy(dsn, "Delivery via Citadel network successful");
+                       *status = 2;
+               }
+               else {
+                       strcpy(dsn, "Delivery via Citadel network failed");
+                       *status = 5;
+               }
+               return;
+       }
+
        lprintf(9, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
                user, node, name);
 
@@ -1321,6 +1335,20 @@ void smtp_do_procmsg(long msgnum) {
  * Run through the queue sending out messages.
  */
 void smtp_do_queue(void) {
+       static int doing_queue = 0;
+
+       /*
+        * This is a simple concurrency check to make sure only one queue run
+        * is done at a time.  We could do this with a mutex, but since we
+        * don't really require extremely fine granularity here, we'll do it
+        * with a static variable instead.
+        */
+       if (doing_queue) return;
+       doing_queue = 1;
+
+       /* 
+        * Go ahead and run the queue
+        */
        lprintf(5, "SMTP: processing outbound queue\n");
 
        if (getroom(&CC->quickroom, SMTP_SPOOLOUT_ROOM) != 0) {
@@ -1330,6 +1358,7 @@ void smtp_do_queue(void) {
        CtdlForEachMessage(MSGS_ALL, 0L, SPOOLMIME, NULL, smtp_do_procmsg);
 
        lprintf(5, "SMTP: queue run completed\n");
+       doing_queue = 0;
 }
 
 
index 53f48392c6c17912ca699f4be32c4519ec7caa62..6bb0720e5995104e70a7550eec9977dcf3d92004 100644 (file)
@@ -1085,9 +1085,6 @@ SETUP_FD: memcpy(&readfds, &masterfds, sizeof(fd_set) );
                                } 
                                write(rescan[1], &junk, 1);
                        }
-                       else {
-                               lprintf(9, "Thread found nothing to do!\n");
-                       }
 
                }
                dead_session_purge();