]> code.citadel.org Git - citadel.git/commitdiff
* Added a command "SMTP" to the Citadel protocol, to do some unimportant
authorArt Cancro <ajc@citadel.org>
Sat, 1 Dec 2001 05:26:01 +0000 (05:26 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 1 Dec 2001 05:26:01 +0000 (05:26 +0000)
  utility/diagnostic functions.

citadel/ChangeLog
citadel/serv_smtp.c
citadel/techdoc/session.txt

index e856cd9b2253bafe542355b5ccd1f482cd415c0f..8cc1aa2e0cbffd4f529965912476964f4e835973 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 580.80  2001/12/01 05:26:01  ajc
+ * Added a command "SMTP" to the Citadel protocol, to do some unimportant
+   utility/diagnostic functions.
+
  Revision 580.79  2001/11/27 17:08:29  ajc
  * When calling an external editor, set the environment variable
    WINDOW_TITLE to an appropriate value.
@@ -2878,3 +2882,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 e3724487c4fc67ea7fb6f7f27c8ae01034bdaf81..f6bcfa08b4e6a67713fd815f478c338f2d3d05f2 100644 (file)
@@ -84,6 +84,8 @@ enum {                                /* Delivery modes */
 long SYM_SMTP;
 long SYM_SMTP_RECP;
 
+int run_queue_now = 0; /* Set to 1 to ignore SMTP send retry times */
+
 
 
 /*****************************************************************************/
@@ -1331,11 +1333,10 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                }
        }
 
-
        /*
         * Postpone delivery if we've already tried recently.
         */
-       if ( (time(NULL) - last_attempted) < retry) {
+       if (((time(NULL) - last_attempted) < retry) && (run_queue_now == 0)) {
                lprintf(7, "Retry time not yet reached.\n");
                phree(instr);
                return;
@@ -1467,11 +1468,55 @@ void smtp_do_queue(void) {
                SPOOLMIME, NULL, smtp_do_procmsg, NULL);
 
        lprintf(7, "SMTP: queue run completed\n");
+       run_queue_now = 0;
        doing_queue = 0;
 }
 
 
 
+/*****************************************************************************/
+/*                          SMTP UTILITY COMMANDS                            */
+/*****************************************************************************/
+
+void cmd_smtp(char *argbuf) {
+       char cmd[SIZ];
+       char node[SIZ];
+       char buf[SIZ];
+       int i;
+       int num_mxhosts;
+
+       if (CtdlAccessCheck(ac_aide)) return;
+
+       extract(cmd, argbuf, 0);
+
+       if (!strcasecmp(cmd, "mx")) {
+               extract(node, argbuf, 1);
+               num_mxhosts = getmx(buf, node);
+               cprintf("%d %d MX hosts listed for %s\n",
+                       LISTING_FOLLOWS, num_mxhosts, node);
+               for (i=0; i<num_mxhosts; ++i) {
+                       extract(node, buf, i);
+                       cprintf("%s\n", node);
+               }
+               cprintf("000\n");
+               return;
+       }
+
+       else if (!strcasecmp(cmd, "runqueue")) {
+               run_queue_now = 1;
+               cprintf("%d All outbound SMTP will be retried now.\n", OK);
+               return;
+       }
+
+       else {
+               cprintf("%d Invalid command.\n", ERROR+ILLEGAL_VALUE);
+       }
+
+}
+
+
+
+
 /*****************************************************************************/
 /*                      MODULE INITIALIZATION STUFF                          */
 /*****************************************************************************/
@@ -1494,5 +1539,6 @@ char *Dynamic_Module_Init(void)
 
        create_room(SMTP_SPOOLOUT_ROOM, 3, "", 0, 1);
        CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
+       CtdlRegisterProtoHook(cmd_smtp, "SMTP", "SMTP utility commands");
        return "$Id$";
 }
index 2ced93ec2f19de73d0007faa08fe302445288d6e..435ba2540e7e4b4229cc671e4239a16edd952592 100644 (file)
@@ -1846,8 +1846,20 @@ message to be set, and a 1 or 0 to set or clear the "seen" bit.
 occurred, in which case it returns ERROR.  Please note that no checking is
 done on the supplied data; if the requested message does not exist, the SEEN
 command simply returns OK without doing anything.
+ SMTP   (utility commands for the SMTP gateway)
+ This command, accessible only by Aides, supports several utility operations
+which examine or manipulate Citadel's SMTP support.  The first command argument
+is a subcommand telling the server what to do.  The following subcommands are
+supported:
+      SMTP mx|hostname             (display all MX hosts for 'hostname')
+      SMTP runqueue                (attempt immediate delivery of all messages
+                                    in the outbound SMTP queue, ignoring any
+                                    retry times stored there)
   
-   
   
  ASYN   (ASYNchronous message support)