empathy r1193 - trunk/libempathy-gtk



Author: xclaesse
Date: Fri Jul  4 14:49:20 2008
New Revision: 1193
URL: http://svn.gnome.org/viewvc/empathy?rev=1193&view=rev

Log:
Automatically add default account domain where appropriate. Fixes bug #534425 (Jonny Lamb)

Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>


Modified:
   trunk/libempathy-gtk/empathy-account-widget.c

Modified: trunk/libempathy-gtk/empathy-account-widget.c
==============================================================================
--- trunk/libempathy-gtk/empathy-account-widget.c	(original)
+++ trunk/libempathy-gtk/empathy-account-widget.c	Fri Jul  4 14:49:20 2008
@@ -60,9 +60,31 @@
 		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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]