[polari] userTracker: Improve status tracking for private chats
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] userTracker: Improve status tracking for private chats
- Date: Mon, 10 Apr 2017 22:40:20 +0000 (UTC)
commit 295a5a0c8ee64948499e2c97fa5e45469d02f17a
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Oct 6 02:39:31 2016 +0200
userTracker: Improve status tracking for private chats
The ::group-contacts-changed signal is limited to channels implementing
the group interface, so we miss when the remote contact disconnects from
a private chat. Work around this by ignoring contacts from one-to-one
chats for the global status, and remove contacts from all rooms when their
global status becomes OFFLINE.
https://bugzilla.gnome.org/show_bug.cgi?id=712635
src/userTracker.js | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/src/userTracker.js b/src/userTracker.js
index b484ee4..bc97b19 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -205,14 +205,20 @@ const UserTracker = new Lang.Class({
if (this._pushMember(roomMap, baseNick, member) == 1)
this._runHandlers(room, member, status);
- let map = this._baseNickContacts;
- if (this._pushMember(map, baseNick, member) == 1) {
- this.emit("status-changed::" + baseNick, baseNick, status);
-
- if (this._shouldNotifyNick(member.alias))
- this._notifyNickAvailable(member, room);
-
- this._setNotifyActionEnabled(member.alias, false);
+ // HACK: Telepathy doesn't notify on member changes for private chats,
+ // so approximate the online status in this case by not adding
+ // the contact to the global map, and removing it from the room
+ // map when the global count drops to 0 (see _untrackMember)
+ if (room.type == Tp.HandleType.ROOM) {
+ let map = this._baseNickContacts;
+ if (this._pushMember(map, baseNick, member) == 1) {
+ this.emit("status-changed::" + baseNick, baseNick, status);
+
+ if (this._shouldNotifyNick(member.alias))
+ this._notifyNickAvailable(member, room);
+
+ this._setNotifyActionEnabled(member.alias, false);
+ }
}
this.emit("contacts-changed::" + baseNick, member.alias);
@@ -244,6 +250,12 @@ const UserTracker = new Lang.Class({
this._setNotifyActionEnabled(member.alias, true);
this._app.withdraw_notification(this._getNotifyActionNameInternal(member.alias));
+
+ // HACK: The member is no longer joined any public rooms, so
+ // assume they disconnected and remove them from all
+ // private chats as well
+ for (let r of this._roomData.keys())
+ this._untrackMember(member, r);
}
this.emit("contacts-changed::" + baseNick, member.alias);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]