/* 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);
}
((!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)) {
#include <stdio.h>
#include <regex.h>
#include <sys/stat.h>
+#include <assert.h>
#include <libcitadel.h>
#include "ctdl_module.h"
#include "citserver.h"
/*
* 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) {
if (CtdlClientGetLine(LineBuf) < 0) {
finished = 1;
}
+ ++lines_read;
if ((StrLength(LineBuf) == tlen) && (!strcmp(ChrPtr(LineBuf), terminator))) {
finished = 1;
}
} 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;
}