]> git.0d.be Git - empathy.git/commitdiff
import-widget: use the server in IRC account display name
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 16 Dec 2011 11:52:44 +0000 (12:52 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 16 Dec 2011 11:53:31 +0000 (12:53 +0100)
User generally use the same nick on different servers so just displaying the
nick isn't very useful.

https://bugzilla.gnome.org/show_bug.cgi?id=654171

src/empathy-import-widget.c

index 9a8917ffceca000738cf597f3987811112ee550c..aaf20d5c59e7ef949f21d51c42a2ce136392db97 100644 (file)
@@ -200,7 +200,7 @@ import_widget_add_account (EmpathyImportWidget *self,
     EmpathyImportAccountData *data)
 {
   TpAccountManager *account_manager;
-  gchar *display_name;
+  gchar *display_name = NULL;
   GHashTable *properties;
   GValue *username;
 
@@ -210,9 +210,23 @@ import_widget_add_account (EmpathyImportWidget *self,
 
   /* Set the display name of the account */
   username = g_hash_table_lookup (data->settings, "account");
-  display_name = g_strdup_printf ("%s (%s)",
-      data->protocol,
-      g_value_get_string (username));
+
+  if (!tp_strdiff (data->protocol, "irc"))
+    {
+      const gchar *server;
+
+      server = tp_asv_get_string (data->settings, "server");
+
+      if (server != NULL)
+        display_name = g_strdup_printf ("%s on %s",
+            g_value_get_string (username), server);
+    }
+
+  if (display_name == NULL)
+    {
+      display_name = g_strdup_printf ("%s (%s)",
+          data->protocol, g_value_get_string (username));
+    }
 
   DEBUG ("display name: %s\n", display_name);