[polari/wip/raresv/popoverRebasedOnTracker] userTracker: Split out some code
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/raresv/popoverRebasedOnTracker] userTracker: Split out some code
- Date: Tue, 19 Jul 2016 22:03:13 +0000 (UTC)
commit 015e55d870017e65e117e1ea9bdac2fcf5074794
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 14 02:21:22 2016 +0200
userTracker: Split out some code
src/userTracker.js | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/userTracker.js b/src/userTracker.js
index 4e4ef51..7ef53ae 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -255,15 +255,17 @@ const UserTracker = new Lang.Class({
this._untrackMember(this._globalContactMapping, member, room);
},
+ _pushMember: function(map, baseNick, member) {
+ if (!map.has(baseNick))
+ map.set(baseNick, []);
+ let contacts = map.get(baseNick);
+ return contacts.push(member);
+ },
+
_trackMember: function(map, member, room) {
let baseNick = Polari.util_get_basenick(member.alias);
- if (map.has(baseNick))
- map.get(baseNick).push(member);
- else
- map.set(baseNick, [member]);
-
- if (map.get(baseNick).length == 1) {
+ if (this._pushMember(map, baseNick, member) == 1) {
if (map == this._globalContactMapping) {
this.emit("status-changed::" + baseNick, member.alias, Tp.ConnectionPresenceType.AVAILABLE);
//log("[global status] user " + member.alias + " is globally online");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]