WebCit now handles the 'local message' flag correctly.
authorArt Cancro <ajc@citadel.org>
Mon, 14 Dec 2020 14:24:45 +0000 (09:24 -0500)
committerArt Cancro <ajc@citadel.org>
Mon, 14 Dec 2020 14:24:45 +0000 (09:24 -0500)
webcit/messages.h
webcit/msg_renderers.c

index 872063170affd92ae37b48e0644ee3620f8701d2..d53b039598104d8d15680e863942220c3210e7be 100644 (file)
@@ -67,6 +67,7 @@ typedef struct _message_summary {
        HashList *AttachLinks;
        HashList *AllAttach;
        int hasattachments;
+       int is_local;                           // nonzero if the message originated on the local system
        wc_mime_attachment *MsgBody;            // the MIME part of the message
 } message_summary;
 
index 7cb990271d2140f0ef5428a44d94ff9b94f8457b..3ba80c97f628550c90114eb4711e4ff4317597d8 100644 (file)
@@ -377,19 +377,7 @@ int Conditional_MAIL_SUMM_SUBJECT(StrBuf *Target, WCTemplputParams *TP) {
  */
 int Conditional_MAIL_LOCAL(StrBuf *Target, WCTemplputParams *TP) {
        message_summary *Msg = (message_summary*) CTX(CTX_MAILSUM);
-
-       char *at = strchr(ChrPtr(Msg->Rfca), '@');
-       if (at == NULL) {
-               return 1;                                               // If there is no "@" in the address, it's got to be local.
-       }
-       ++at;
-
-       if (!strcasecmp(at, ChrPtr(WC->serv_info->serv_fqdn))) {        // is this from our local domain?
-               return 1;                                               // if yes, then the message originated locally.
-       }
-       else {
-               return 0;                                               // otherwise it probably didn't.
-       }
+       return (Msg->is_local ? 1 : 0);
 }
 
 
@@ -513,6 +501,8 @@ void examine_room(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
                Msg->Room = NewStrBufDup(HdrLine);              
        }
 }
+
+
 void tmplput_MAIL_SUMM_ORGROOM(StrBuf *Target, WCTemplputParams *TP)
 {
        message_summary *Msg = (message_summary*) CTX(CTX_MAILSUM);
@@ -525,6 +515,14 @@ void examine_rfca(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
        FreeStrBuf(&Msg->Rfca);
        Msg->Rfca = NewStrBufDup(HdrLine);
 }
+
+
+void examine_locl(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
+{
+       Msg->is_local = 1;
+}
+
+
 void tmplput_MAIL_SUMM_RFCA(StrBuf *Target, WCTemplputParams *TP)
 {
        message_summary *Msg = (message_summary*) CTX(CTX_MAILSUM);
@@ -1378,8 +1376,9 @@ const char* fieldMnemonics[] = {
        "nhdr", /* % -> eHeaderOnly   */
        "type", /* % -> eFormatType   */
        "part", /* % -> eMessagePart  */
-       "suff", /* % -> eSubFolder    */
-       "pref"  /* % -> ePevious      */
+       "suff", /*      eSubFolder    */
+       "pref", /*      ePrefix       */
+       "locl"  /*      eIsLocal      */
 };
 HashList *msgKeyLookup = NULL;
 
@@ -1527,6 +1526,7 @@ InitModule_MSGRENDERERS
        RegisterMsgHdr(HKEY("nvto"), examine_nvto, 0);
        RegisterMsgHdr(HKEY("time"), examine_time, 0);
        RegisterMsgHdr(HKEY("part"), examine_mime_part, 0);
+       RegisterMsgHdr(HKEY("locl"), examine_locl, 0);
        RegisterMsgHdr(HKEY("text"), examine_text, 1);
 
        /* these are the content-type headers we get in front of a message; put it into the same hash since it doesn't clash. */