Temporarily added some debugs and an assert() statement to show where the message...
authorArt Cancro <ajc@citadel.org>
Tue, 17 May 2022 18:03:11 +0000 (19:03 +0100)
committerArt Cancro <ajc@citadel.org>
Tue, 17 May 2022 18:03:11 +0000 (19:03 +0100)
citadel/modules/ctdlproto/serv_messages.c
citadel/msgbase.c

index 3d37dcc8122a271544a6f9fbb7596c63e7158006..f48060b14d492999158ec755990ee0892b161d89 100644 (file)
@@ -602,7 +602,8 @@ void cmd_ent0(char *entargs) {
        /* Read in the message from the client. */
        if (do_confirm) {
                cprintf("%d send message\n", START_CHAT_MODE);
-       } else {
+       }
+       else {
                cprintf("%d send message\n", SEND_LISTING);
        }
 
@@ -612,9 +613,7 @@ void cmd_ent0(char *entargs) {
                              ((!IsEmptyStr(supplied_euid)) ? supplied_euid : NULL),
                              NULL, references);
 
-       /* Put together one big recipients struct containing to/cc/bcc all in
-        * one.  This is for the envelope.
-        */
+       // Put together one big recipients struct containing to/cc/bcc all in one.  This is for the envelope.
        char *all_recps = malloc(SIZ * 3);
        strcpy(all_recps, recp);
        if (!IsEmptyStr(cc)) {
index 3acd13b36587982858997f467507db85a8a41df8..17e58e261df7fdd4e874d7443a43ff2c67c2e88d 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdio.h>
 #include <regex.h>
 #include <sys/stat.h>
+#include <assert.h>
 #include <libcitadel.h>
 #include "ctdl_module.h"
 #include "citserver.h"
@@ -2968,18 +2969,18 @@ long quickie_message(const char *from,
 /*
  * Back end function used by CtdlMakeMessage() and similar functions
  */
-StrBuf *CtdlReadMessageBodyBuf(char *terminator,       /* token signalling EOT */
+StrBuf *CtdlReadMessageBodyBuf(char *terminator,       // token signalling EOT
                               long tlen,
-                              size_t maxlen,           /* maximum message length */
-                              StrBuf *exist,           /* if non-null, append to it;
-                                                          exist is ALWAYS freed  */
-                              int crlf                 /* CRLF newlines instead of LF */
+                              size_t maxlen,           // maximum message length
+                              StrBuf *exist,           // if non-null, append to it; exist is ALWAYS freed
+                              int crlf                 // CRLF newlines instead of LF
 ) {
        StrBuf *Message;
        StrBuf *LineBuf;
        int flushing = 0;
        int finished = 0;
        int dotdot = 0;
+       int lines_read = 0;                             // FIXME remove this after debugging
 
        LineBuf = NewStrBufPlain(NULL, SIZ);
        if (exist == NULL) {
@@ -2999,6 +3000,7 @@ StrBuf *CtdlReadMessageBodyBuf(char *terminator,  /* token signalling EOT */
                if (CtdlClientGetLine(LineBuf) < 0) {
                        finished = 1;
                }
+               ++lines_read;
                if ((StrLength(LineBuf) == tlen) && (!strcmp(ChrPtr(LineBuf), terminator))) {
                        finished = 1;
                }
@@ -3022,6 +3024,14 @@ StrBuf *CtdlReadMessageBodyBuf(char *terminator, /* token signalling EOT */
 
        } while (!finished);
        FreeStrBuf(&LineBuf);
+
+       // DEBUG remove this
+       int lines_in_buffer = num_tokens(ChrPtr(Message), '\n');
+       syslog(LOG_DEBUG, "\033[31mLines from client : %d\033[0m", lines_read);
+       syslog(LOG_DEBUG, "\033[32mLines in buffer   : %d\033[0m", lines_in_buffer);
+       assert(lines_read == lines_in_buffer);
+
+
        return Message;
 }