[polari] chatView: Color contact availability in PM rooms



commit 75ae34c78dcf5f70fc9a2d99147d588d458a1fe3
Author: Bastian Ilsø <bastianilso src gnome org>
Date:   Thu May 28 16:23:12 2015 +0200

    chatView: Color contact availability in PM rooms
    
    Commit c96929c uses an API which is only available in group
    chat rooms, resulting in errors in private message rooms.
    We currently don't have a way to check the actual online
    status of a PM message, so always mark it as available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748703

 src/chatView.js |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 50611c8..ba3e6b6 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -318,11 +318,19 @@ const ChatView = new Lang.Class({
                 this._view.buffer.insert(iter, '\n', -1);
         }
 
-        if (this._channel != null) {
+        if (!this._channel)
+            return;
+
+        if (this._room.type == Tp.HandleType.ROOM) {
             let members = this._channel.group_dup_members_contacts();
             for (let j = 0; j < members.length; j++)
                 this._setNickStatus(members[j].get_alias(),
                                     Tp.ConnectionPresenceType.AVAILABLE);
+        } else {
+                this._setNickStatus(this._channel.connection.self_contact.get_alias(),
+                                    Tp.ConnectionPresenceType.AVAILABLE);
+                this._setNickStatus(this._channel.target_contact.get_alias(),
+                                    Tp.ConnectionPresenceType.AVAILABLE);
         }
     },
 
@@ -603,9 +611,17 @@ const ChatView = new Lang.Class({
             }));
         this._checkMessages();
 
-        let members = this._channel.group_dup_members_contacts();
-        for (let j = 0; j < members.length; j++)
-            this._setNickStatus(members[j].get_alias(), Tp.ConnectionPresenceType.AVAILABLE);
+        if (this._room.type == Tp.HandleType.ROOM) {
+            let members = this._channel.group_dup_members_contacts();
+            for (let j = 0; j < members.length; j++)
+                this._setNickStatus(members[j].get_alias(),
+                                    Tp.ConnectionPresenceType.AVAILABLE);
+        } else {
+                this._setNickStatus(this._channel.connection.self_contact.get_alias(),
+                                    Tp.ConnectionPresenceType.AVAILABLE);
+                this._setNickStatus(this._channel.target_contact.get_alias(),
+                                    Tp.ConnectionPresenceType.AVAILABLE);
+        }
     },
 
     _onMemberRenamed: function(room, oldMember, newMember) {


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