#include "euidindex.h"
#include "journaling.h"
#include "citadel_dirs.h"
+#include "clientsocket.h"
long config_msgnum;
else if (i == 'N')
safestrncpy(snode, mptr, sizeof snode);
else if (i == 'R')
- cprintf("To: %s%s", mptr, nl);
+ {
+ if (haschar(mptr, '@') == 0)
+ {
+ cprintf("To: %s@%s%s", mptr, config.c_fqdn, nl);
+ }
+ else
+ {
+ cprintf("To: %s%s", mptr, nl);
+ }
+ }
else if (i == 'T') {
datestring(datestamp, sizeof datestamp,
atol(mptr), DATESTRING_RFC822);
}
}
- for (i=0; i<strlen(suser); ++i) {
+ for (i=0; !IsEmptyStr(&suser[i]); ++i) {
suser[i] = tolower(suser[i]);
if (!isalnum(suser[i])) suser[i]='_';
}
else if (!is_room_aide() && (TheMessage->cm_anon_type == MES_ANONOPT)) {
cprintf("From: \"anonymous\" <x@x.org>%s", nl);
}
- else if (strlen(fuser) > 0) {
+ else if (!IsEmptyStr(fuser)) {
cprintf("From: \"%s\" <%s>%s", luser, fuser, nl);
}
else {
if (msg->cm_fields['P'] == NULL) {
if (msg->cm_fields['A'] != NULL) {
msg->cm_fields['P'] = strdup(msg->cm_fields['A']);
- for (a=0; a<strlen(msg->cm_fields['P']); ++a) {
+ for (a=0; !IsEmptyStr(&msg->cm_fields['P'][a]); ++a) {
if (isspace(msg->cm_fields['P'][a])) {
msg->cm_fields['P'][a] = ' ';
}
size_t maxlen, /* maximum message length */
char *exist, /* if non-null, append to it;
exist is ALWAYS freed */
- int crlf /* CRLF newlines instead of LF */
+ int crlf, /* CRLF newlines instead of LF */
+ int sock /* socket handle or 0 for this session's client socket */
) {
char buf[1024];
int linelen;
/* read in the lines of message text one by one */
do {
- if (client_getln(buf, (sizeof buf - 3)) < 1) finished = 1;
+ if (sock > 0) {
+ if (sock_getln(sock, buf, (sizeof buf - 3)) < 0) finished = 1;
+ }
+ else {
+ if (client_getln(buf, (sizeof buf - 3)) < 1) finished = 1;
+ }
if (!strcmp(buf, terminator)) finished = 1;
if (crlf) {
strcat(buf, "\r\n");
msg->cm_fields['M'] = preformatted_text;
}
else {
- msg->cm_fields['M'] = CtdlReadMessageBody("000", config.c_maxmsglen, NULL, 0);
+ msg->cm_fields['M'] = CtdlReadMessageBody("000", config.c_maxmsglen, NULL, 0, 0);
}
return(msg);
ret->recptypes_magic = RECPTYPES_MAGIC;
/* Change all valid separator characters to commas */
- for (i=0; i<strlen(recipients); ++i) {
+ for (i=0; !IsEmptyStr(&recipients[i]); ++i) {
if ((recipients[i] == ';') || (recipients[i] == '|')) {
recipients[i] = ',';
}
mailtype = alias(this_recp);
mailtype = alias(this_recp);
mailtype = alias(this_recp);
- for (j=0; j<=strlen(this_recp); ++j) {
+ for (j=0; !IsEmptyStr(&this_recp[j]); ++j) {
if (this_recp[j]=='_') {
this_recp_cooked[j] = ' ';
}