* Added an SMTP-like calling syntax to ENT0 to allow a confirmation message
authorArt Cancro <ajc@citadel.org>
Tue, 1 Feb 2005 19:46:13 +0000 (19:46 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 1 Feb 2005 19:46:13 +0000 (19:46 +0000)
  to be sent back to the client after a message is transmitted.

citadel/ChangeLog
citadel/citadel.h
citadel/msgbase.c
citadel/techdoc/protocol.txt

index ca1410b5bdd986851309b71601f7668faf2d0f2f..057e893c9844312f6b8bf5e9e9c272d403388a0b 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 630.10  2005/02/01 19:46:12  ajc
+ * Added an SMTP-like calling syntax to ENT0 to allow a confirmation message
+   to be sent back to the client after a message is transmitted.
+
  Revision 630.9  2005/02/01 03:33:22  ajc
  * Changed CtdlRoomAccess() calling syntax in order to return both
    the access bits and the current view
@@ -6335,3 +6339,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 d7d071a74778d10d8fe35a50814765e9a6ccb885..5308f0406b06943983a451c7e3dfae3b14e7243f 100644 (file)
@@ -32,7 +32,7 @@ extern "C" {
 /*
  * Text description of this software
  */
-#define CITADEL        "Citadel 6.30"
+#define CITADEL        "Citadel 6.40"
 
 /*
  * REV_LEVEL is the current version number (multiplied by 100 to avoid having
@@ -44,7 +44,7 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      630             /* This version */
+#define REV_LEVEL      640             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
 #define EXPORT_REV_MIN 626             /* Oldest compatible export files */
 
index 301ab1ee208c31a59aae9572888ef49a06874b30..97ef54ddd860df01756dbef243de8c5cbdbe3720 100644 (file)
@@ -2670,6 +2670,8 @@ void cmd_ent0(char *entargs)
        int err = 0;
        struct recptypes *valid = NULL;
        char subject[SIZ];
+       int do_confirm = 0;
+       long msgnum;
 
        unbuffer_output();
 
@@ -2678,6 +2680,7 @@ void cmd_ent0(char *entargs)
        anon_flag = extract_int(entargs, 2);
        format_type = extract_int(entargs, 3);
        extract(subject, entargs, 4);
+       do_confirm = extract_int(entargs, 6);
 
        /* first check to make sure the request is valid. */
 
@@ -2788,13 +2791,29 @@ void cmd_ent0(char *entargs)
        }
 
        /* Read in the message from the client. */
-       cprintf("%d send message\n", SEND_LISTING);
+       if (do_confirm) {
+               cprintf("%d send message\n", START_CHAT_MODE);
+       } else {
+               cprintf("%d send message\n", SEND_LISTING);
+       }
        msg = CtdlMakeMessage(&CC->user, recp,
                CC->room.QRname, anonymous, format_type,
                masquerade_as, subject, NULL);
 
        if (msg != NULL) {
-               CtdlSubmitMsg(msg, valid, "");
+               msgnum = CtdlSubmitMsg(msg, valid, "");
+
+               if (do_confirm) {
+                       cprintf("%ld\n", msgnum);
+                       if (msgnum >= 0L) {
+                               cprintf("Message accepted.\n");
+                       }
+                       else {
+                               cprintf("Internal error.\n");
+                       }
+                       cprintf("000\n");
+               }
+
                CtdlFreeMessage(msg);
        }
        CC->fake_postname[0] = '\0';
index dee0278d45478760eeffd3c8dc03ee2708053382..6758ee71d08fbb3f7d9c604e81be6e9ae00a227a 100644 (file)
@@ -792,6 +792,10 @@ typically be 0; see the MSG0 command above).
 the message.
   5  -  Post name.  When postflag is 2, this is the name you are posting as.
 This is an Aide only command.
+  6  -  Do Confirmation.  NOTE: this changes the protocol semantics!  When
+you set this to nonzero, ENT0 will reply with a confirmation message after
+you submit the message text.  The reply code for the ENT0 command will be
+START_CHAT_MODE instead of SEND_LISTING.
 
  Possible result codes:
   OK  -  The request is valid.  (Client did not set the "post" flag, so the
@@ -803,11 +807,25 @@ correct upper and lower case characters.  In addition, if the recipient is
 having his/her mail forwarded, the forwarding address will be returned.
   SEND_LISTING  -  The request is valid.  The client should now transmit
 the text of the message (ending with a 000 on a line by itself, as usual).
+  START_CHAT_MODE  -  The request is valid.  The client should now transmit
+the text of the message, ending with a 000 on a line by itself.  After
+transmitting the 000 terminator, the client MUST read in the confirmation
+from the server, which will also end with 000 on a line by itself.  The format
+of the confirmation appears below.
   ERROR + NOT_LOGGED_IN  -  Not logged in.
   ERROR + HIGHER_ACCESS_REQUIRED  -  Higher access is required.  An
 explanation follows, worded in a form that can be displayed to the user.
   ERROR + NO_SUCH_USER  -  The specified recipient does not exist.
 
+The format of the confirmation message, if requested, is as follows:
+Line 1: The new message number on the server for the message.  It will be
+        positive for a real message number, or negative to denote
+        that an error occurred.  If an error occurred, the message was
+        not saved.
+Line 2: A human-readable confirmation or error message.
+(More may be added to this in the future, so do not assume that there will
+only be two lines output.  Keep reading until 000 is received.)
+
 
  RINF   (read Room INFormation file)