From 5323f6009289b38b28527af6fd97d1de26b6effa Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 5 Apr 2011 20:59:10 +0200 Subject: [PATCH] Only include the local domain in the Message-ID if neither the "include account address" or the "domain name" options are set If the "include account address" and the "domain name" options are both set, only include the account address. Remove the code to prevent multiple @ signs in the Message-ID. They can now only be caused by invalid input in which case all bets are off anyway. --- src/common/utils.c | 23 ++++++----------------- 1 files changed, 6 insertions(+), 17 deletions(-) diff --git src/common/utils.c src/common/utils.c index 93907ea..1d9b618 100644 --- src/common/utils.c +++ src/common/utils.c @@ -3839,23 +3839,12 @@ gchar *generate_msgid(gchar *buf, gint len, gchar *user_addr) t = time(NULL); lt = localtime_r(&t, &buft); - if (strcmp(buf, "") == 0) { - if (user_addr != NULL) - addr = g_strconcat(".", user_addr, "@", get_domain_name(), NULL); - else - addr = g_strconcat("@", get_domain_name(), NULL); - } else { - if (user_addr != NULL) - addr = g_strconcat(".", user_addr, "@", buf, NULL); - else - addr = g_strconcat("@", buf, NULL); - } - - /* Replace all @ but the last one in addr, with underscores. - * RFC 2822 States that msg-id syntax only allows one @. - */ - while (strchr(addr, '@') != NULL && strchr(addr, '@') != strrchr(addr, '@')) - *(strchr(addr, '@')) = '_'; + if (user_addr != NULL) + addr = g_strdup_printf(".%s", user_addr); + else if (strlen(buf) != 0) + addr = g_strdup_printf("@%s", buf); + else + addr = g_strdup_printf("@%s", get_domain_name()); g_snprintf(buf, len, "%04d%02d%02d%02d%02d%02d.%08x%s", lt->tm_year + 1900, lt->tm_mon + 1, -- 1.7.4.5