diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2008-07-04 22:49:20 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-07-04 22:49:20 +0800 |
commit | 1f4625e9634adb6bd6c03c9890e0f9b2fb898bce (patch) | |
tree | 1aad32fe158937c0103df0223717aaede8e95034 | |
parent | 1b35f6aa52f764c40c1fb603d8ca9e6622d12f02 (diff) | |
download | gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar.gz gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar.bz2 gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar.lz gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar.xz gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.tar.zst gsoc2013-empathy-1f4625e9634adb6bd6c03c9890e0f9b2fb898bce.zip |
Automatically add default account domain where appropriate. Fixes bug #534425 (Jonny Lamb)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1193
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 5116841c1..044e4f7e0 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -60,9 +60,31 @@ account_widget_entry_focus_cb (GtkWidget *widget, gtk_entry_set_text (GTK_ENTRY (widget), value ? value : ""); g_free (value); } else { + McProfile *profile; + const gchar *default_account_domain = NULL; + gchar *value = NULL; + + profile = mc_account_get_profile (account); + if (mc_profile_get_capabilities (profile) & + MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) { + + default_account_domain = mc_profile_get_default_account_domain (profile); + } + + if ((strcmp (param_name, "account") == 0) && default_account_domain && + !strstr (str, "@")) { + + DEBUG ("Adding @%s suffix to account", + default_account_domain); + value = g_strconcat (str, "@", default_account_domain, NULL); + gtk_entry_set_text (GTK_ENTRY (widget), value); + } else { + value = g_strdup (str); + } DEBUG ("Setting %s to %s", param_name, - strstr (param_name, "password") ? "***" : str); - mc_account_set_param_string (account, param_name, str); + strstr (param_name, "password") ? "***" : value); + mc_account_set_param_string (account, param_name, value); + g_free (value); } return FALSE; |