extern struct config config;
long config_msgnum;
+
+/*
+ * This really belongs in serv_network.c, but I don't know how to export
+ * symbols between modules.
+ */
+struct FilterList *filterlist = NULL;
+
+
+/*
+ * These are the four-character field headers we use when outputting
+ * messages in Citadel format (as opposed to RFC822 format).
+ */
char *msgkeys[] = {
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "",
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL,
"from",
- "", "", "",
+ NULL, NULL, NULL,
"exti",
"rfca",
- "",
+ NULL,
"hnod",
"msgn",
- "", "", "",
+ NULL, NULL, NULL,
"text",
"node",
"room",
"path",
- "",
+ NULL,
"rcpt",
"spec",
"time",
"subj",
- "",
- "",
- "",
- "",
- ""
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL
};
/*
char display_name[SIZ];
char *mptr;
char *nl; /* newline string */
+ int suppress_f = 0;
/* buffers needed for RFC822 translation */
char suser[SIZ];
}
}
+ /* Don't show Internet address for users on the
+ * local Citadel network.
+ */
+ suppress_f = 0;
+ if (TheMessage->cm_fields['N'] != NULL)
+ if (strlen(TheMessage->cm_fields['N']) > 0)
+ if (haschar(TheMessage->cm_fields['N'], '.') == 0) {
+ suppress_f = 1;
+ }
+
+ /* Now spew the header fields in the order we like them. */
strcpy(allkeys, FORDER);
for (i=0; i<strlen(allkeys); ++i) {
k = (int) allkeys[i];
if (k != 'M') {
- if (TheMessage->cm_fields[k] != NULL) {
+ if ( (TheMessage->cm_fields[k] != NULL)
+ && (msgkeys[k] != NULL) ) {
if (k == 'A') {
if (do_proto) cprintf("%s=%s\n",
msgkeys[k],
display_name);
}
+ else if ((k == 'F') && (suppress_f)) {
+ /* do nothing */
+ }
+ /* Masquerade display name if needed */
else {
if (do_proto) cprintf("%s=%s\n",
msgkeys[k],
else if (i == 'R')
cprintf("To: %s%s", mptr, nl);
else if (i == 'T') {
- datestring(datestamp, atol(mptr),
+ datestring(datestamp, sizeof datestamp, atol(mptr),
DATESTRING_RFC822 );
cprintf("Date: %s%s", datestamp, nl);
}
if (exist == NULL) {
m = mallok(4096);
+ m[0] = 0;
+ buffer_len = 4096;
+ message_len = 0;
}
else {
- m = reallok(exist, strlen(exist) + 4096);
- if (m == NULL) phree(exist);
+ message_len = strlen(exist);
+ buffer_len = message_len + 4096;
+ m = reallok(exist, buffer_len);
+ if (m == NULL) {
+ phree(exist);
+ return m;
+ }
}
/* flush the input if we have nowhere to store it */
return(NULL);
}
- /* otherwise read it into memory */
- else {
- buffer_len = 4096;
- m[0] = 0;
- message_len = 0;
- }
/* read in the lines of message text one by one */
while ( (client_gets(buf)>0) && strcmp(buf, terminator) ) {
char *room, /* room where it's going */
int type, /* see MES_ types in header file */
int format_type, /* variformat, plain text, MIME... */
- char *fake_name /* who we're masquerading as */
+ char *fake_name, /* who we're masquerading as */
+ char *subject /* Subject (optional) */
) {
char dest_node[SIZ];
char buf[SIZ];
msg->cm_fields['F'] = strdoop(CC->cs_inet_email);
}
+ if (subject != NULL) {
+ striplt(subject);
+ if (strlen(subject) > 0) {
+ msg->cm_fields['U'] = strdoop(subject);
+ }
+ }
+
msg->cm_fields['M'] = CtdlReadMessageBody("000",
config.c_maxmsglen, NULL);
char errmsg[SIZ];
int err = 0;
struct recptypes *valid = NULL;
+ char subject[SIZ];
post = extract_int(entargs, 0);
extract(recp, entargs, 1);
anon_flag = extract_int(entargs, 2);
format_type = extract_int(entargs, 3);
+ extract(subject, entargs, 4);
/* first check to make sure the request is valid. */
}
CC->cs_flags |= CS_POSTING;
- if (CC->quickroom.QRflags & QR_MAILBOX) {
+ /* In the Mail> room we have to behave a little differently --
+ * make sure the user has specified at least one recipient. Then
+ * validate the recipient(s).
+ */
+ if ( (CC->quickroom.QRflags & QR_MAILBOX)
+ && (!strcasecmp(&CC->quickroom.QRname[11], MAILROOM)) ) {
+
if (CC->usersupp.axlevel < 2) {
strcpy(recp, "sysop");
}
/* Read in the message from the client. */
cprintf("%d send message\n", SEND_LISTING);
msg = make_message(&CC->usersupp, recp,
- CC->quickroom.QRname, anonymous, format_type, masquerade_as);
+ CC->quickroom.QRname, anonymous, format_type,
+ masquerade_as, subject);
if (msg != NULL) {
CtdlSubmitMsg(msg, valid, "");