[gnome-contacts] Some nicer chat identifier names



commit 2f13a06e70e338a8698262ed75c5ca8ed28c6d2b
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Jun 8 22:20:48 2011 +0200

    Some nicer chat identifier names

 src/contacts-contact.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-contact.vala b/src/contacts-contact.vala
index 92551ce..1c126f7 100644
--- a/src/contacts-contact.vala
+++ b/src/contacts-contact.vala
@@ -183,8 +183,8 @@ public class Contacts.Contact : GLib.Object  {
   }
 
   public Tpf.Persona? find_im_persona (string protocol, string im_address) {
+    var iid = protocol + ":" + im_address;
     foreach (var p in individual.personas) {
-      var iid = protocol + ":" + im_address;
       var tp = p as Tpf.Persona;
       if (tp != null && tp.iid == iid) {
 	return tp;
@@ -194,6 +194,14 @@ public class Contacts.Contact : GLib.Object  {
   }
 
   public string format_im_name (string protocol, string id) {
+    string? service = null;
+    var persona = find_im_persona (protocol, id);
+    if (persona != null) {
+      var account = (persona.store as Tpf.PersonaStore).account;
+      service = account.service;
+    }
+    if (service != null)
+      return id + " (" + service + ")";
     return id + " (" + protocol + ")";
   }
 



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