};
-/*
- * 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, "\033[36mAliasing <%s> to <%s>\033[0m", 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];
safestrncpy(original_name, name, sizeof original_name);
#define CFG_SMTP_FROM_NOFILTER 1
#define CFG_SMTP_FROM_CORRECT 2
#define CFG_SMTP_FROM_REJECT 3
+
/*
- * MIME types used in Citadel for configuration stuff
+ * object types used in Citadel for configuration stuff (some of these are obsolete)
*/
#define SPOOLMIME "application/x-citadel-delivery-list"
#define INTERNETCFG "application/x-citadel-internet-config"
#define FILTERLIST "application/x-citadel-filter-list"
#define SIEVECONFIG "application/x-citadel-sieve-config"
#define XMPPMORTUARY "application/x-citadel-xmpp-mortuary"
+#define GLOBAL_ALIASES "global_alias_table"
#define FILE_MAILALIAS "__MAIL_ALIAS__"