[polari/wip/raresv/popoverRebasedOnTracker] Added the 'offline in another room' status and it is updated whenever the global status changes. Bot



commit 99e0b7251f620afef898b89d2a8cb44b10208b9f
Author: raresv <rares visalom gmail com>
Date:   Mon Jul 11 01:44:46 2016 +0300

    Added the 'offline in another room' status and it is updated whenever the global status changes. Both 
callbacks are connected in the setter for the nickname property (this might be a bit odd, maybe find another 
place to put those).

 src/userList.js |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index a843d57..33a3d53 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -362,7 +362,9 @@ const UserPopover = new Lang.Class({
 
         let baseNick = Polari.util_get_basenick(nickname);
 
+        /*TODO: these need to be disconnected when not used anymore*/
         this._userTracker.watchUser(this._room, this._nickname, Lang.bind(this, this._onNickStatusChanged));
+        this._userTracker.connect("status-changed::"+this._nickname, Lang.bind(this, this._updateContents));
 
         this._updateContents();
     },
@@ -375,7 +377,17 @@ const UserPopover = new Lang.Class({
         let bestMatchingContact = this._userTracker.getBestMatchingContactInRoom(this._room, this._nickname);
 
         this._nickLabel.set_label(this._nickname);
-        this._statusLabel.set_label(bestMatchingContact ? "Online" : "Offline");
+
+        let labelStatus = "";
+        if (bestMatchingContact)
+            labelStatus = "Online";
+        else
+            if (this._userTracker.getNickStatus(this._nickname) == Tp.ConnectionPresenceType.OFFLINE)
+                labelStatus = "Offline";
+            else
+                labelStatus = "Available in another room.";
+
+        this._statusLabel.set_label(labelStatus);
 
         if (bestMatchingContact) {
             this._userDetails.user = bestMatchingContact;


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