diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/mail-send-recv.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c index 35da6b3e59..a8bade95a1 100644 --- a/mail/mail-send-recv.c +++ b/mail/mail-send-recv.c @@ -369,8 +369,9 @@ format_service_name (CamelService *service) const gchar *display_name; const gchar *host = NULL; const gchar *path = NULL; - const gchar *user = NULL; gchar *pretty_url = NULL; + gchar *user = NULL; + gchar *cp; gboolean have_host = FALSE; gboolean have_path = FALSE; gboolean have_user = FALSE; @@ -384,7 +385,7 @@ format_service_name (CamelService *service) CAMEL_NETWORK_SETTINGS (settings)); have_host = (host != NULL) && (*host != '\0'); - user = camel_network_settings_get_user ( + user = camel_network_settings_dup_user ( CAMEL_NETWORK_SETTINGS (settings)); have_user = (user != NULL) && (*user != '\0'); } @@ -395,6 +396,13 @@ format_service_name (CamelService *service) have_path = (path != NULL) && (*path != '\0'); } + /* Shorten user names with '@', since multiple '@' in a + * 'user@host' label look weird. This is just supposed + * to be a hint anyway so it doesn't matter if it's not + * strictly correct. */ + if (have_user && (cp = strchr (user, '@')) != NULL) + *cp = '\0'; + g_return_val_if_fail (provider != NULL, NULL); /* This should never happen, but if the service has no @@ -422,6 +430,7 @@ format_service_name (CamelService *service) } g_free (service_name); + g_free (user); return pretty_url; } |