safestrncpy(mret[0]->node, &aaa[5], SIZ);
else if (!strncasecmp(aaa, "rcpt=", 5))
safestrncpy(mret[0]->recipient, &aaa[5], SIZ);
+ else if (!strncasecmp(aaa, "wefw=", 5))
+ safestrncpy(mret[0]->references, &aaa[5], SIZ);
else if (!strncasecmp(aaa, "time=", 5))
mret[0]->time = atol(&aaa[5]);
/* ENT0 */
-int CtdlIPCPostMessage(CtdlIPC *ipc, int flag, int *subject_required, const struct ctdlipcmessage *mr, char *cret)
+int CtdlIPCPostMessage(CtdlIPC *ipc, int flag, int *subject_required, struct ctdlipcmessage *mr, char *cret)
{
register int ret;
char cmd[SIZ];
+ char *ptr;
if (!cret) return -2;
if (!mr) return -2;
+ if (mr->references) {
+ for (ptr=mr->references; *ptr != 0; ++ptr) {
+ if (*ptr == '|') *ptr = '!';
+ }
+ }
+
snprintf(cmd, sizeof cmd,
- "ENT0 %d|%s|%d|%d|%s|%s", flag, mr->recipient,
- mr->anonymous, mr->type, mr->subject, mr->author);
+ "ENT0 %d|%s|%d|%d|%s|%s||||||%s|", flag, mr->recipient,
+ mr->anonymous, mr->type, mr->subject, mr->author, mr->references);
ret = CtdlIPCGenericCommand(ipc, cmd, mr->text, strlen(mr->text), NULL,
NULL, cret);
if ((flag == 0) && (subject_required != NULL)) {
char anonymous; /* An anonymous message */
char mime_chosen[SIZ]; /* Chosen MIME part to output */
char content_type[SIZ]; /* How would you like that? */
+ char references[SIZ]; /* Thread references */
};
int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret);
int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret);
int CtdlIPCPostMessage(CtdlIPC *ipc, int flag, int *subject_required,
- const struct ctdlipcmessage *mr,
+ struct ctdlipcmessage *mr,
char *cret);
int CtdlIPCRoomInfo(CtdlIPC *ipc, char **iret, char *cret);
int CtdlIPCDeleteMessage(CtdlIPC *ipc, long msgnum, char *cret);
char reply_to[SIZ];
char reply_subject[SIZ];
+char reply_references[SIZ];
struct cittext {
struct cittext *next;
strcpy(reply_to, NO_REPLY_TO);
strcpy(reply_subject, "");
+ strcpy(reply_references, "");
r = CtdlIPCGetSingleMessage(ipc, num, (pagin == READ_HEADER ? 1 : 0), 4, &message, buf);
if (r / 100 != 1) {
lines_printed = checkpagin(lines_printed, pagin, screenheight);
}
+
+ /* Always do msgid before references ... the latter is a concatenation! */
+ if (message->msgid != NULL) {
+ safestrncpy(reply_references, message->msgid, sizeof reply_references);
+ }
+
+ if (message->references != NULL) if (!IsEmptyStr(message->references)) {
+ int l = strlen(reply_references);
+ strcpy(&reply_references[l++], "|");
+ safestrncpy(&reply_references[l], message->references, (sizeof(reply_references) - l));
+ }
+
if (message->subject != NULL) {
- safestrncpy(reply_subject, message->subject,
- sizeof reply_subject);
+ safestrncpy(reply_subject, message->subject, sizeof reply_subject);
if (!IsEmptyStr(message->subject)) {
if (dest) {
fprintf(dest, "Subject: %s\n",
strcpy(message.recipient, "");
strcpy(message.author, "");
strcpy(message.subject, "");
+ strcpy(message.references, "");
message.text = ""; /* point to "", changes later */
message.anonymous = 0;
message.type = mode;
strcpy(message.recipient, buf);
if (is_reply) {
+
if (!IsEmptyStr(reply_subject)) {
if (!strncasecmp(reply_subject,
"Re: ", 3)) {
reply_subject);
}
}
+
+ safestrncpy(message.references, reply_references, sizeof message.references);
}
if (room_flags & QR_ANONOPT) {
"",
summary_string, /* Use summary for subject */
NULL,
- reply_message_text);
+ reply_message_text,
+ NULL);
if (msg != NULL) {
valid = validate_recipients(organizer_string, NULL, 0);
"",
"", /* no subject */
NULL,
- message_text);
+ message_text,
+ NULL);
if (msg != NULL) {
CIT_ICAL->avoid_sending_invitations = 1;
"",
summary_string, /* Use summary for subject */
NULL,
- request_message_text);
+ request_message_text,
+ NULL);
if (msg != NULL) {
valid = validate_recipients(attendees_string, NULL, 0);
char *my_email, /* which of my email addresses to use (empty is ok) */
char *subject, /* Subject (optional) */
char *supplied_euid, /* ...or NULL if this is irrelevant */
- char *preformatted_text /* ...or NULL to read text from client */
+ char *preformatted_text, /* ...or NULL to read text from client */
+ char *references /* Thread references */
) {
char dest_node[256];
char buf[1024];
msg->cm_fields['E'] = strdup(supplied_euid);
}
+ if (references != NULL) {
+ if (!IsEmptyStr(references)) {
+ msg->cm_fields['W'] = strdup(references);
+ }
+ }
+
if (preformatted_text != NULL) {
msg->cm_fields['M'] = preformatted_text;
}
int i, j;
char buf[256];
int newuseremail_ok = 0;
+ char references[SIZ];
+ char *ptr;
unbuffer_output();
break;
}
extract_token(newuseremail, entargs, 10, '|', sizeof newuseremail);
+ extract_token(references, entargs, 11, '|', sizeof references);
+ for (ptr=references; *ptr != 0; ++ptr) {
+ if (*ptr == '!') *ptr = '|';
+ }
/* first check to make sure the request is valid. */
CC->room.QRname, anonymous, format_type,
newusername, newuseremail, subject,
((!IsEmptyStr(supplied_euid)) ? supplied_euid : NULL),
- NULL);
+ NULL, references);
/* Put together one big recipients struct containing to/cc/bcc all in
* one. This is for the envelope.
char *my_email, /* which of my email addresses to use (empty is ok) */
char *subject, /* Subject (optional) */
char *supplied_euid, /* ...or NULL if this is irrelevant */
- char *preformatted_text /* ...or NULL to read text from client */
+ char *preformatted_text, /* ...or NULL to read text from client */
+ char *references /* Thread references */
);
int CtdlCheckInternetMailPermission(struct ctdluser *who);
int CtdlIsMe(char *addr, int addr_buf_len);