From 00f6e3e7aeb7974bcdc825a2d88a6fdb48090b58 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 14 Sep 2010 11:19:27 -0400 Subject: [PATCH] text client, enter message, send reply references during pre-compose security check --- citadel/textclient/messages.c | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/citadel/textclient/messages.c b/citadel/textclient/messages.c index 111bac6c4..3359d7514 100644 --- a/citadel/textclient/messages.c +++ b/citadel/textclient/messages.c @@ -1117,6 +1117,37 @@ int entmsg(CtdlIPC *ipc, newprompt("Display name for this message: ", message.author, 40); } + if (is_reply) { + + if (!IsEmptyStr(reply_subject)) { + if (!strncasecmp(reply_subject, + "Re: ", 3)) { + strcpy(message.subject, reply_subject); + } + else { + snprintf(message.subject, + sizeof message.subject, + "Re: %s", + reply_subject); + } + } + + /* Trim down excessively long lists of thread references. We eliminate the + * second one in the list so that the thread root remains intact. + */ + int rrtok = num_tokens(reply_references, '|'); + int rrlen = strlen(reply_references); + if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) { + remove_token(reply_references, 1, '|'); + } + + snprintf(message.references, sizeof message.references, "%s%s%s", + reply_references, + (IsEmptyStr(reply_references) ? "" : "|"), + reply_inreplyto + ); + } + r = CtdlIPCPostMessage(ipc, 0, &subject_required, &message, buf); if (r / 100 != 2 && r / 10 != 57) { @@ -1154,37 +1185,6 @@ int entmsg(CtdlIPC *ipc, } strcpy(message.recipient, buf); - if (is_reply) { - - if (!IsEmptyStr(reply_subject)) { - if (!strncasecmp(reply_subject, - "Re: ", 3)) { - strcpy(message.subject, reply_subject); - } - else { - snprintf(message.subject, - sizeof message.subject, - "Re: %s", - reply_subject); - } - } - - /* Trim down excessively long lists of thread references. We eliminate the - * second one in the list so that the thread root remains intact. - */ - int rrtok = num_tokens(reply_references, '|'); - int rrlen = strlen(reply_references); - if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) { - remove_token(reply_references, 1, '|'); - } - - snprintf(message.references, sizeof message.references, "%s%s%s", - reply_references, - (IsEmptyStr(reply_references) ? "" : "|"), - reply_inreplyto - ); - } - if (room_flags & QR_ANONOPT) { scr_printf("Anonymous (Y/N)? "); if (yesno() == 1) -- 2.39.2