The server now uses its own knowledge of local domains to set or clear the 'locl...
[citadel.git] / citadel / msgbase.c
index bf18da7447b0e2323e4cfbc74aad76235ad4f876..0447013393225ae078ac147cc035b5748ad2278e 100644 (file)
@@ -61,7 +61,7 @@ char *msgkeys[] = {
        "rep2", // K -> eReplyTo
        "list", // L -> eListID
        "text", // M -> eMesageText
-       "locl", // N -> eOrigLocal
+       NULL,   // N (formerly used as eNodename)
        "room", // O -> eOriginalRoom
        "path", // P -> eMessagePath
        NULL,   // Q
@@ -113,7 +113,6 @@ eMsgField FieldOrder[]  = {
        eOriginalRoom,
        eRecipient   ,
 /* Semi-important fields */
-       eOrigLocal   ,
        eBig_message ,
        eExclusiveID ,
        eWeferences  ,
@@ -1690,10 +1689,7 @@ int CtdlOutputMsg(long msg_num,          /* message number (local) to fetch */
 }
 
 
-void OutputCtdlMsgHeaders(
-       struct CtdlMessage *TheMessage,
-       int do_proto)           /* do Citadel protocol responses? */
-{
+void OutputCtdlMsgHeaders(struct CtdlMessage *TheMessage, int do_proto) {
        int i;
        char buf[SIZ];
        char display_name[256];
@@ -1726,23 +1722,29 @@ void OutputCtdlMsgHeaders(
                eMsgField Field;
                Field = FieldOrder[i];
                if (Field != eMesageText) {
-                       if ( (!CM_IsEmpty(TheMessage, Field))
-                            && (msgkeys[Field] != NULL) ) {
-                               if ((Field == eenVelopeTo) ||
-                                   (Field == eRecipient) ||
-                                   (Field == eCarbonCopY)) {
+                       if ( (!CM_IsEmpty(TheMessage, Field)) && (msgkeys[Field] != NULL) ) {
+                               if ((Field == eenVelopeTo) || (Field == eRecipient) || (Field == eCarbonCopY)) {
                                        sanitize_truncated_recipient(TheMessage->cm_fields[Field]);
                                }
                                if (Field == eAuthor) {
-                                       if (do_proto) cprintf("%s=%s\n",
-                                                             msgkeys[Field],
-                                                             display_name);
+                                       if (do_proto) {
+                                               cprintf("%s=%s\n", msgkeys[Field], display_name);
+                                       }
                                }
                                /* Masquerade display name if needed */
                                else {
                                        if (do_proto) {
                                                cprintf("%s=%s\n", msgkeys[Field], TheMessage->cm_fields[Field]);
                                        }
+                               }
+                               /* Give the client a hint about whether the message originated locally */
+                               if (Field == erFc822Addr) {
+                                       if (IsDirectory(TheMessage->cm_fields[Field] ,0)) {
+                                               cprintf("locl=yes\n");                          // message originated locally.
+                                       }
+
+
+
                                }
                        }
                }
@@ -1857,7 +1859,6 @@ void OutputRFC822MsgHeaders(
                        case eSuppressIdx:
                        case eExtnotify:
                        case eVltMsgNum:
-                       case eOrigLocal:
                                /* these don't map to mime message headers. */
                                break;
                        }
@@ -2128,7 +2129,7 @@ int CtdlOutputPreLoadedMsg(
 
        /* Tell the client which format type we're using. */
        if ( (mode == MT_CITADEL) && (do_proto) ) {
-               cprintf("type=%d\n", TheMessage->cm_format_type);
+               cprintf("type=%d\n", TheMessage->cm_format_type);       // Tell the client which format type we're using.
        }
 
        /* nhdr=yes means that we're only displaying headers, no body */
@@ -2139,9 +2140,9 @@ int CtdlOutputPreLoadedMsg(
                cprintf("nhdr=yes\n");
        }
 
-       if ((mode == MT_CITADEL) || (mode == MT_MIME)) 
+       if ((mode == MT_CITADEL) || (mode == MT_MIME)) {
                OutputCtdlMsgHeaders(TheMessage, do_proto);
-
+       }
 
        /* begin header processing loop for RFC822 transfer format */
        strcpy(suser, "");