From 5ac2920028e92a453c686c799327d7a66b3e7b49 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 5 Jul 2020 11:52:51 -0400 Subject: [PATCH] Removed some leftover dependencies on message fields which no longer exist --- citadel/citserver.c | 10 +-- citadel/modules/calendar/serv_calendar.c | 3 +- citadel/modules/imap/imap_fetch.c | 15 ++-- citadel/modules/imap/imap_misc.c | 13 ++- citadel/modules/network/serv_netmail.c | 18 ++-- citadel/modules/sieve/serv_sieve.c | 6 +- citadel/modules/smtp/serv_smtp.c | 1 - citadel/msgbase.c | 103 ++++++++--------------- citadel/msgbase.h | 1 - citadel/server.h | 7 +- 10 files changed, 58 insertions(+), 119 deletions(-) diff --git a/citadel/citserver.c b/citadel/citserver.c index 3eb8cf2a7..b9648f6f7 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -1,7 +1,7 @@ /* * Main source module for the Citadel server * - * Copyright (c) 1987-2019 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. @@ -189,12 +189,12 @@ char CtdlCheckExpress(void) void citproto_begin_session() { if (CC->nologin == 1) { - cprintf("%d %s: Too many users are already online (maximum is %d)\n", - ERROR + MAX_SESSIONS_EXCEEDED, CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions") + cprintf("%d Too many users are already online (maximum is %d)\n", + ERROR + MAX_SESSIONS_EXCEEDED, CtdlGetConfigInt("c_maxsessions") ); CC->kill_me = KILLME_MAX_SESSIONS_EXCEEDED; } else { - cprintf("%d %s Citadel server ready.\n", CIT_OK, CtdlGetConfigStr("c_nodename")); + cprintf("%d %s Citadel server ready.\n", CIT_OK, CtdlGetConfigStr("c_fqdn")); CC->can_receive_im = 1; } } @@ -203,7 +203,7 @@ void citproto_begin_session() void citproto_begin_admin_session() { CC->internal_pgm = 1; - cprintf("%d %s Citadel server ADMIN CONNECTION ready.\n", CIT_OK, CtdlGetConfigStr("c_nodename")); + cprintf("%d %s Citadel server ADMIN CONNECTION ready.\n", CIT_OK, CtdlGetConfigStr("c_fqdn")); } diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index 02153287f..c38ffd250 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -3,7 +3,7 @@ * room on a Citadel server. It handles iCalendar objects using the * iTIP protocol. See RFCs 2445 and 2446. * - * Copyright (c) 1987-2018 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. @@ -137,7 +137,6 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) { msg->cm_format_type = 4; CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname)); CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname)); - CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode"))); MsgBody = NewStrBufPlain(NULL, serlen + 100); StrBufAppendBufPlain(MsgBody, HKEY("Content-type: text/calendar\r\n\r\n"), 0); diff --git a/citadel/modules/imap/imap_fetch.c b/citadel/modules/imap/imap_fetch.c index 91cb39832..293fecca0 100644 --- a/citadel/modules/imap/imap_fetch.c +++ b/citadel/modules/imap/imap_fetch.c @@ -2,7 +2,7 @@ * Implements the FETCH command in IMAP. * This is a good example of the protocol's gratuitous complexity. * - * Copyright (c) 2001-2017 by the citadel.org team + * Copyright (c) 2001-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 as published by @@ -347,19 +347,14 @@ void imap_output_envelope_from(struct CtdlMessage *msg) { if (!CM_IsEmpty(msg, erFc822Addr)) { process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name); - IPutStr(user, strlen(user)); /* mailbox name (user id) */ + IPutStr(user, strlen(user)); /* mailbox name (user id) */ IAPuts(" "); - if (!strcasecmp(node, CtdlGetConfigStr("c_nodename"))) { - IPutStr(CtdlGetConfigStr("c_fqdn"), strlen(CtdlGetConfigStr("c_fqdn"))); - } - else { - IPutStr(node, strlen(node)); /* host name */ - } + IPutStr(node, strlen(node)); /* host name */ } else { - IPutMsgField(eAuthor); /* mailbox name (user id) */ + IPutMsgField(eAuthor); /* Make up a synthetic address */ IAPuts(" "); - IPutMsgField(eNodeName); /* host name */ + IPutStr(CtdlGetConfigStr("c_fqdn"), strlen(CtdlGetConfigStr("c_fqdn"))); } IAPuts(")) "); /* close double-parens */ diff --git a/citadel/modules/imap/imap_misc.c b/citadel/modules/imap/imap_misc.c index 39ae34b82..6e68b6cbe 100644 --- a/citadel/modules/imap/imap_misc.c +++ b/citadel/modules/imap/imap_misc.c @@ -1,5 +1,5 @@ /* - * 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 as published by @@ -275,7 +275,6 @@ void imap_do_append_flags(long new_msgnum, char *new_message_flags) { * This function is called by the main command loop. */ void imap_append(int num_parms, ConstStr *Params) { - struct CitContext *CCC = CC; long literal_length; struct CtdlMessage *msg = NULL; long new_msgnum = (-1L); @@ -366,19 +365,17 @@ void imap_append(int num_parms, ConstStr *Params) { * folder is selected, save its name so we can return there!!!!!) */ if (Imap->selected) { - strcpy(savedroom, CCC->room.QRname); + strcpy(savedroom, CC->room.QRname); } CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL); /* If the user is locally authenticated, FORCE the From: header to * show up as the real sender. (Configurable setting) */ - if (CCC->logged_in) { - if ( ((CCC->room.QRflags & QR_MAILBOX) == 0) && (CtdlGetConfigInt("c_imap_keep_from") == 0)) + if (CC->logged_in) { + if ( ((CC->room.QRflags & QR_MAILBOX) == 0) && (CtdlGetConfigInt("c_imap_keep_from") == 0)) { - CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname)); - CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); - CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode"))); + CM_SetField(msg, eAuthor, CC->user.fullname, strlen(CC->user.fullname)); } } diff --git a/citadel/modules/network/serv_netmail.c b/citadel/modules/network/serv_netmail.c index 6ee61cfd5..b4c5f713b 100644 --- a/citadel/modules/network/serv_netmail.c +++ b/citadel/modules/network/serv_netmail.c @@ -1,7 +1,7 @@ /* * This module handles network mail and mailing list processing. * - * Copyright (c) 2000-2018 by the citadel.org team + * Copyright (c) 2000-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. @@ -269,11 +269,6 @@ void network_process_digest(SpoolControl *sc, struct CtdlMessage *omsg, long *de "<%s> ", msg->cm_fields[erFc822Addr]); } - else if (!CM_IsEmpty(msg, eNodeName)) { - fprintf(sc->digestfp, - "@%s ", - msg->cm_fields[eNodeName]); - } fprintf(sc->digestfp, "\n"); if (!CM_IsEmpty(msg, eMsgSubject)) { fprintf(sc->digestfp, @@ -397,12 +392,11 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon * is rude... */ ok_to_participate = 0; - if (!CM_IsEmpty(msg, eNodeName)) { - if (!strcasecmp(msg->cm_fields[eNodeName], CtdlGetConfigStr("c_nodename"))) - { - ok_to_participate = 1; - } - } + + // FIXME -- After we removed CitaNet/IGnet support , we now need a new heuristic to determine + // whether a message originated locally. This means the "participate" mode no longer works. + // We'll definitely need to refactor this when we do other federated stuff later. + if (ok_to_participate) { /* Replace the Internet email address of the diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 30e031007..437bd662b 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -2,7 +2,7 @@ * This module glues libSieve to the Citadel server in order to implement * the Sieve mailbox filtering language (RFC 3028). * - * Copyright (c) 1987-2018 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. @@ -619,10 +619,6 @@ void sieve_do_msg(long msgnum, void *userdata) { } else if (!CM_IsEmpty(msg, eRecipient)) { safestrncpy(my.envelope_to, msg->cm_fields[eRecipient], sizeof my.envelope_to); - if (!CM_IsEmpty(msg, eDestination)) { - strcat(my.envelope_to, "@"); - strcat(my.envelope_to, msg->cm_fields[eDestination]); - } stripallbut(my.envelope_to, '<', '>'); } else { diff --git a/citadel/modules/smtp/serv_smtp.c b/citadel/modules/smtp/serv_smtp.c index b7ee16a69..5fbc5003c 100644 --- a/citadel/modules/smtp/serv_smtp.c +++ b/citadel/modules/smtp/serv_smtp.c @@ -900,7 +900,6 @@ void smtp_data(long offset, long flags) return; } - CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode"))); CM_SetField(msg, eOriginalRoom, HKEY(MAILROOM)); if (sSMTP->preferred_sender_name != NULL) CM_SetField(msg, eAuthor, SKEY(sSMTP->preferred_sender_name)); diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 8421dfc11..d120ca410 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1,7 +1,7 @@ /* * Implements the message store. * - * Copyright (c) 1987-2018 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. @@ -38,7 +38,7 @@ struct addresses_to_be_filed *atbf = NULL; * These are the four-character field headers we use when outputting * messages in Citadel format (as opposed to RFC822 format). */ -char *msgkeys[91] = { +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, @@ -48,34 +48,34 @@ char *msgkeys[91] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - "from", /* A -> eAuthor */ - NULL, /* B -> eBig_message */ - NULL, /* C -> eRemoteRoom FIXME no more ignet */ - NULL, /* D -> eDestination FIXME no more ignet */ - "exti", /* E -> eXclusivID */ - "rfca", /* F -> erFc822Addr */ - NULL, /* G */ - "hnod", /* H -> eHumanNode FIXME no more ignet */ - "msgn", /* I -> emessageId */ - "jrnl", /* J -> eJournal */ - "rep2", /* K -> eReplyTo */ - "list", /* L -> eListID */ - "text", /* M -> eMesageText */ - "node", /* N -> eNodeName FIXME no more ignet */ - "room", /* O -> eOriginalRoom */ - "path", /* P -> eMessagePath */ - NULL, /* Q */ - "rcpt", /* R -> eRecipient */ - "spec", /* S -> eSpecialField FIXME we might not be using this anymore */ - "time", /* T -> eTimestamp */ - "subj", /* U -> eMsgSubject */ - "nvto", /* V -> eenVelopeTo */ - "wefw", /* W -> eWeferences */ - NULL, /* X */ - "cccc", /* Y -> eCarbonCopY */ - NULL /* Z */ - + "from", // A -> eAuthor + NULL, // B -> eBig_message + NULL, // C (formerly used as eRemoteRoom) + NULL, // D (formerly used as eDestination) + "exti", // E -> eXclusivID + "rfca", // F -> erFc822Addr + NULL, // G + "hnod", // H (formerly used as eHumanNode) + "msgn", // I -> emessageId + "jrnl", // J -> eJournal + "rep2", // K -> eReplyTo + "list", // L -> eListID + "text", // M -> eMesageText + NULL, // N (formerly used as eNodeName) + "room", // O -> eOriginalRoom + "path", // P -> eMessagePath + NULL, // Q + "rcpt", // R -> eRecipient + NULL, // S (formerly used as eSpecialField) + "time", // T -> eTimestamp + "subj", // U -> eMsgSubject + "nvto", // V -> eenVelopeTo + "wefw", // W -> eWeferences + NULL, // X + "cccc", // Y -> eCarbonCopY + NULL // Z }; + HashList *msgKeyLookup = NULL; int GetFieldFromMnemonic(eMsgField *f, const char* c) @@ -109,21 +109,16 @@ eMsgField FieldOrder[] = { eAuthor , erFc822Addr , eOriginalRoom, - eNodeName , - eHumanNode , eRecipient , - eDestination , /* Semi-important fields */ eBig_message , - eRemoteRoom , eExclusiveID , eWeferences , eJournal , -/* G is not used yet, may become virus signature*/ +/* G is not used yet */ eReplyTo , eListID , /* Q is not used yet */ - eSpecialField, eenVelopeTo , /* X is not used yet */ /* Z is not used yet */ @@ -1695,7 +1690,6 @@ void OutputCtdlMsgHeaders( int do_proto) /* do Citadel protocol responses? */ { int i; - int suppress_f = 0; char buf[SIZ]; char display_name[256]; @@ -1722,14 +1716,6 @@ void OutputCtdlMsgHeaders( } } - /* Don't show Internet address for users on the - * local Citadel network. - */ - suppress_f = 0; - if (!CM_IsEmpty(TheMessage, eNodeName) && (haschar(TheMessage->cm_fields[eNodeName], '.') == 0)) { - suppress_f = 1; - } - /* Now spew the header fields in the order we like them. */ for (i=0; i< NDiskFields; ++i) { eMsgField Field; @@ -1747,9 +1733,6 @@ void OutputCtdlMsgHeaders( msgkeys[Field], display_name); } - else if ((Field == erFc822Addr) && (suppress_f)) { - /* do nothing */ - } /* Masquerade display name if needed */ else { if (do_proto) { @@ -1764,7 +1747,7 @@ void OutputCtdlMsgHeaders( void OutputRFC822MsgHeaders( struct CtdlMessage *TheMessage, - int flags, /* should the bessage be exported clean */ + int flags, /* should the message be exported clean */ const char *nl, int nlen, char *mid, long sizeof_mid, char *suser, long sizeof_suser, @@ -1819,9 +1802,6 @@ void OutputRFC822MsgHeaders( break; case erFc822Addr: safestrncpy(fuser, mptr, sizeof_fuser); - case eNodeName: - safestrncpy(snode, mptr, sizeof_snode); - break; case eRecipient: if (haschar(mptr, '@') == 0) { sanitize_truncated_recipient(mptr); @@ -1863,15 +1843,11 @@ void OutputRFC822MsgHeaders( cprintf("Reply-To: %s%s", mptr, nl); break; - case eRemoteRoom: - case eDestination: case eExclusiveID: - case eHumanNode: case eJournal: case eMesageText: case eBig_message: case eOriginalRoom: - case eSpecialField: case eErrorMsg: case eSuppressIdx: case eExtnotify: @@ -2165,7 +2141,6 @@ int CtdlOutputPreLoadedMsg( strcpy(suser, ""); strcpy(luser, ""); strcpy(fuser, ""); - memcpy(snode, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")) + 1); if (mode == MT_RFC822) OutputRFC822MsgHeaders( TheMessage, @@ -2185,12 +2160,8 @@ int CtdlOutputPreLoadedMsg( } if (mode == MT_RFC822) { - if (!strcasecmp(snode, NODENAME)) { - safestrncpy(snode, FQDN, sizeof snode); - } - /* Construct a fun message id */ - cprintf("Message-ID: <%s", mid);/// todo: this possibly breaks threadding mails. + cprintf("Message-ID: <%s", mid); if (strchr(mid, '@')==NULL) { cprintf("@%s", snode); } @@ -2894,10 +2865,10 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ if ((recps != NULL) && (recps->bounce_to == NULL)) { if (CC->logged_in) { - snprintf(bounce_to, sizeof bounce_to, "%s@%s", CC->user.fullname, CtdlGetConfigStr("c_nodename")); + strcpy(bounce_to, CC->user.fullname); } else { - snprintf(bounce_to, sizeof bounce_to, "%s@%s", msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]); + strcpy(bounce_to, msg->cm_fields[eAuthor]); } recps->bounce_to = bounce_to; } @@ -3042,7 +3013,6 @@ long quickie_message(const char *from, if (!IsEmptyStr(fromaddr)) CM_SetField(msg, erFc822Addr, fromaddr, strlen(fromaddr)); if (!IsEmptyStr(room)) CM_SetField(msg, eOriginalRoom, room, strlen(room)); - CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); if (!IsEmptyStr(to)) { CM_SetField(msg, eRecipient, to, strlen(to)); recp = validate_recipients(to, NULL, 0); @@ -3268,9 +3238,6 @@ struct CtdlMessage *CtdlMakeMessageLen( } } - CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); - CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode"))); - if (rcplen > 0) { CM_SetField(msg, eRecipient, recipient, rcplen); } @@ -3638,8 +3605,6 @@ void CtdlWriteObject(char *req_room, /* Room to stuff it in */ msg->cm_format_type = 4; CM_SetField(msg, eAuthor, CC->user.fullname, strlen(CC->user.fullname)); CM_SetField(msg, eOriginalRoom, req_room, strlen(req_room)); - CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); - CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode"))); msg->cm_flags = flags; CM_SetAsFieldSB(msg, eMesageText, &encoded_message); diff --git a/citadel/msgbase.h b/citadel/msgbase.h index 6ba7603ef..308c3aa33 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -60,7 +60,6 @@ struct repl { /* Info for replication checking */ }; - /* * This is a list of "harvested" email addresses that we might want to * stick into someone's address book. But we defer this operaiton so diff --git a/citadel/server.h b/citadel/server.h index cc262d51d..e5e64539c 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -1,7 +1,7 @@ /* * Main declarations file for the Citadel server * - * Copyright (c) 1987-2018 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. @@ -309,21 +309,16 @@ struct UseTable { typedef enum _MsgField { eAuthor = 'A', eBig_message = 'B', - eRemoteRoom = 'C', - eDestination = 'D', eExclusiveID = 'E', erFc822Addr = 'F', - eHumanNode = 'H', emessageId = 'I', eJournal = 'J', eReplyTo = 'K', eListID = 'L', eMesageText = 'M', - eNodeName = 'N', eOriginalRoom = 'O', eMessagePath = 'P', eRecipient = 'R', - eSpecialField = 'S', eTimestamp = 'T', eMsgSubject = 'U', eenVelopeTo = 'V', -- 2.30.2