[polari/wip/raresv/popoverRebasedOnTracker] userTracker: Simplify some more
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/raresv/popoverRebasedOnTracker] userTracker: Simplify some more
- Date: Tue, 19 Jul 2016 22:03:59 +0000 (UTC)
commit 4ca92765464bbd023bb527bb6d217b8d9a481e5e
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 14 04:29:36 2016 +0200
userTracker: Simplify some more
src/userTracker.js | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/src/userTracker.js b/src/userTracker.js
index d678fb3..da48d2d 100644
--- a/src/userTracker.js
+++ b/src/userTracker.js
@@ -151,13 +151,6 @@ const UserTracker = new Lang.Class({
/*TODO: is this needed here?*/
this._ensureRoomMappingForRoom(emittingRoom);
- /*if there is no map keeping track of the users in the emittingRoom
- create it*/
- this._ensureContactMappingForRoom(emittingRoom);
-
- /*if there is no map keeping track of the local status change handlers*/
- this._ensureHandlerMappingForRoom(emittingRoom);
-
/*keep track of initial members in the emittingRoom, both locally and
globally*/
members.forEach(m => { this._trackMember(m, emittingRoom); });
@@ -181,18 +174,8 @@ const UserTracker = new Lang.Class({
_ensureRoomMappingForRoom: function(room) {
if (!this._roomMapping.has(room))
- this._roomMapping.set(room, {});
- },
-
- _ensureContactMappingForRoom: function(room) {
- if (!this._roomMapping.get(room)._contactMapping)
- this._roomMapping.get(room)._contactMapping = new Map();
- },
-
- _ensureHandlerMappingForRoom: function(room) {
- /*if there is no map keeping track of the local status change handlers*/
- if (!this._roomMapping.get(room)._handlerMapping)
- this._roomMapping.get(room)._handlerMapping = new Map();
+ this._roomMapping.set(room, { _contactMapping: new Map(),
+ _handlerMapping: new Map() });
},
_onMemberRenamed: function(room, oldMember, newMember) {
@@ -308,7 +291,7 @@ const UserTracker = new Lang.Class({
getNickRoomStatus: function(nickName, room) {
let baseNick = Polari.util_get_basenick(nickName);
- this._ensureContactMappingForRoom(room);
+ this._ensureRoomMappingForRoom(room);
let contacts = this._roomMapping.get(room)._contactMapping.get(baseNick) || [];
return contacts.length == 0 ? Tp.ConnectionPresenceType.OFFLINE
@@ -317,7 +300,6 @@ const UserTracker = new Lang.Class({
watchUser: function(room, nick, callback) {
this._ensureRoomMappingForRoom(room);
- this._ensureHandlerMappingForRoom(room);
this._roomMapping.get(room)._handlerMapping.set(this._handlerCounter, {
nickName: Polari.util_get_basenick(nick),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]