]> code.citadel.org Git - citadel.git/blobdiff - citadel/internet_addressing.c
Removed a bit of diagnostic code no longer needed
[citadel.git] / citadel / internet_addressing.c
index a38601d957903e5d46c7adb34dbe592ad9b15048..abbd376aef718a8c5c15cdf8f78f7de1ee1487c1 100644 (file)
@@ -390,44 +390,38 @@ enum {
        EA_LOCAL,               // Local message, do no network processing
        EA_INTERNET             // Convert msg and send as Internet mail
 };
-char *killo[] = {              // FIXME remove this when diags are complete
-       "error",
-       "multiple",
-       "local",
-       "internet"
-};
 
 
-/*
- * Aliasing for network mail.
- */
-int expand_aliases(char *name) {                               /* process alias and routing info for mail */
+// Process alias and routing info for email addresses
+int expand_aliases(char *name) {
        int a;
        char aaa[SIZ];
        int at = 0;
        char node[64];
+       char *t;
 
+       char *aliases = CtdlGetSysConfig(GLOBAL_ALIASES);       // First hit the Global Alias Table
+       if (aliases) {
+               char *aptr = aliases;
+               while ((t = strtok_r(aptr, "\n", &aptr))) {
+                       char *bar = strchr(t, '|');
+                       if (bar) {
+                               bar[0] = 0;
+                               ++bar;
+                               if (!strcasecmp(name, t)) {
+                                       syslog(LOG_DEBUG, "internet_addressing: global alias <%s> to <%s>", name, bar);
+                                       strcpy(name, bar);
+                               }
+                       }
+               }
 
-
-
-       // FIXME write a "real" alias table here
-
-
-       // temporary test of expansion
-       if (!strcasecmp(name, "root")) {
-               strcpy(name, "root");
-               return(EA_MULTIPLE);
-       }
-       if (!strcasecmp(name, "qux")) {
-               strcpy(name, "eggroll,blat,fun@eek.boop");
-               return(EA_MULTIPLE);
+               free(aliases);
+               if (strchr(name, ',')) {
+                       return(EA_MULTIPLE);
+               }
        }
 
-
-
-
-
-       char original_name[256];
+       char original_name[256];                                // Now go for the regular aliases
        safestrncpy(original_name, name, sizeof original_name);
 
        // should these checks still be here, or maybe move them to split_recps() ?
@@ -441,7 +435,7 @@ int expand_aliases(char *name) {                            /* process alias and routing info for mail *
        }
 
        if (strcasecmp(original_name, name)) {
-               syslog(LOG_INFO, "internet_addressing: %s is being forwarded to %s", original_name, name);
+               syslog(LOG_INFO, "internet_addressing: directory alias <%s> to <%s>", original_name, name);
        }
 
        /* Change "user @ xxx" to "user" if xxx is an alias for this host */
@@ -449,7 +443,7 @@ int expand_aliases(char *name) {                            /* process alias and routing info for mail *
                if (name[a] == '@') {
                        if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
                                name[a] = 0;
-                               syslog(LOG_DEBUG, "internet_addressing: changed to <%s>", name);
+                               syslog(LOG_DEBUG, "internet_addressing: host is local, recipient is <%s>", name);
                                break;
                        }
                }
@@ -722,7 +716,6 @@ struct recptypes *validate_recipients(char *supplied_recipients, const char *Rem
                                strcat(ret->display_recp, append);
                        }
                }
-               syslog(LOG_DEBUG, "org_recp: \033[31m%-30s\033[0m   this_recp: \033[32m%-30s\033[0m   mailtype: %s", org_recp, this_recp, killo[mailtype]);
        }
 
        if ( (ret->num_local + ret->num_internet + ret->num_room + ret->num_error) == 0) {