X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fctdlproto%2Fserv_messages.c;h=6550e44211ca4d1afe078a5adcf3902215c1b3cd;hb=0387f48886a9395d89eaca01cd40ab751610426f;hp=4be56cde67508f75b1b8225e25f692fd26872b09;hpb=56b9c7b63d9169bca7bcaeaff5c2c997cc603856;p=citadel.git diff --git a/citadel/modules/ctdlproto/serv_messages.c b/citadel/modules/ctdlproto/serv_messages.c index 4be56cde6..6550e4421 100644 --- a/citadel/modules/ctdlproto/serv_messages.c +++ b/citadel/modules/ctdlproto/serv_messages.c @@ -1,7 +1,7 @@ /* * represent messages to the citadel clients * - * Copyright (c) 1987-2017 by the citadel.org team + * Copyright (c) 1987-2020 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -42,23 +42,33 @@ void headers_listing(long msgnum, void *userdata) struct CtdlMessage *msg; int output_mode = *(int *)userdata; - msg = CtdlFetchMessage(msgnum, 0, 1); + msg = CtdlFetchMessage(msgnum, 0); if (msg == NULL) { cprintf("%ld|0|||||||\n", msgnum); return; } + // change all vertical bars in the subject to hyphens so it doesn't screw up the protocol + if (!CM_IsEmpty(msg, eMsgSubject)) { + char *p; + for (p=msg->cm_fields[eMsgSubject]; *p; p++) { + if (*p == '|') { + *p = '-'; + } + } + } + // output all fields except the references hash cprintf("%ld|%s|%s|%s|%s|%s", msgnum, (!CM_IsEmpty(msg, eTimestamp) ? msg->cm_fields[eTimestamp] : "0"), (!CM_IsEmpty(msg, eAuthor) ? msg->cm_fields[eAuthor] : ""), - (!CM_IsEmpty(msg, eNodeName) ? msg->cm_fields[eNodeName] : ""), + CtdlGetConfigStr("c_nodename"), // no more nodenames anymore (!CM_IsEmpty(msg, erFc822Addr) ? msg->cm_fields[erFc822Addr] : ""), (!CM_IsEmpty(msg, eMsgSubject) ? msg->cm_fields[eMsgSubject] : "") ); - if (output_mode == MSG_HDRS_THREADS) { + if (output_mode == MSG_HDRS_THREADS) { // field view with thread hashes // output the references hash cprintf ("|%d|", @@ -76,10 +86,13 @@ void headers_listing(long msgnum, void *userdata) } } - cprintf("|"); + cprintf("|\n"); + } + + else { // field view with no threads, subject extends out forever + cprintf("\n"); } - cprintf("\n"); CM_Free(msg); } @@ -96,7 +109,7 @@ void headers_brief_filter(long msgnum, void *userdata) msg_filter *flt = (msg_filter*) userdata; l = GetCount(flt->Filter); - msg = CtdlFetchMessage(msgnum, 0, 1); + msg = CtdlFetchMessage(msgnum, 0); StrBufPrintf(flt->buffer, "%ld", msgnum); if (msg == NULL) { for (i = 0; i < l; i++) { @@ -128,7 +141,7 @@ void headers_euid(long msgnum, void *userdata) { struct CtdlMessage *msg; - msg = CtdlFetchMessage(msgnum, 0, 1); + msg = CtdlFetchMessage(msgnum, 0); if (msg == NULL) { cprintf("%ld||\n", msgnum); return; @@ -316,46 +329,6 @@ void cmd_msg2(char *cmdbuf) } - -/* - * display a message (mode 3 - IGnet raw format - internal programs only) - */ -void cmd_msg3(char *cmdbuf) -{ - long msgnum; - struct CtdlMessage *msg = NULL; - struct ser_ret smr; - - if (CC->internal_pgm == 0) { - cprintf("%d This command is for internal programs only.\n", - ERROR + HIGHER_ACCESS_REQUIRED); - return; - } - - msgnum = extract_long(cmdbuf, 0); - msg = CtdlFetchMessage(msgnum, 1, 1); - if (msg == NULL) { - cprintf("%d Message %ld not found.\n", - ERROR + MESSAGE_NOT_FOUND, msgnum); - return; - } - - CtdlSerializeMessage(&smr, msg); - CM_Free(msg); - - if (smr.len == 0) { - cprintf("%d Unable to serialize message\n", - ERROR + INTERNAL_ERROR); - return; - } - - cprintf("%d %ld\n", BINARY_FOLLOWS, (long)smr.len); - client_write((char *)smr.ser, (int)smr.len); - free(smr.ser); -} - - - /* * Display a message using MIME content types */ @@ -370,7 +343,6 @@ void cmd_msg4(char *cmdbuf) } - /* * Client tells us its preferred message format(s) */ @@ -714,7 +686,7 @@ void cmd_ent0(char *entargs) } if (msg != NULL) { - msgnum = CtdlSubmitMsg(msg, valid, "", QP_EADDR); + msgnum = CtdlSubmitMsg(msg, valid, ""); if (do_confirm) { cprintf("%ld\n", msgnum); @@ -912,7 +884,6 @@ CTDL_MODULE_INIT(ctdl_message) CtdlRegisterProtoHook(cmd_msgs, "MSGS", "Output a list of messages in the current room"); CtdlRegisterProtoHook(cmd_msg0, "MSG0", "Output a message in plain text format"); CtdlRegisterProtoHook(cmd_msg2, "MSG2", "Output a message in RFC822 format"); - CtdlRegisterProtoHook(cmd_msg3, "MSG3", "Output a message in raw format (deprecated)"); CtdlRegisterProtoHook(cmd_msg4, "MSG4", "Output a message in the client's preferred format"); CtdlRegisterProtoHook(cmd_msgp, "MSGP", "Select preferred format for MSG4 output"); CtdlRegisterProtoHook(cmd_opna, "OPNA", "Open an attachment for download");