[polari/wip/raresv/userTrackerAndPopoversRebase: 10/24] chatroomManager: added notification logic (will be replaced with GActions in the future).
- From: Rares Visalom <raresvisalom src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/raresv/userTrackerAndPopoversRebase: 10/24] chatroomManager: added notification logic (will be replaced with GActions in the future).
- Date: Fri, 5 Aug 2016 23:41:02 +0000 (UTC)
commit eabeb0f416c35359d9bf308ee6ffd4fba35cdfcb
Author: raresv <rares visalom gmail com>
Date: Thu Aug 4 01:00:20 2016 +0300
chatroomManager: added notification logic (will be replaced with GActions in the future).
src/chatroomManager.js | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/chatroomManager.js b/src/chatroomManager.js
index 7cddd98..d915967 100644
--- a/src/chatroomManager.js
+++ b/src/chatroomManager.js
@@ -162,6 +162,8 @@ const _ChatroomManager = new Lang.Class({
this._settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
this._lastActiveRoom = null;
+
+ this._watchlist = [];
},
_onPrepared: function(mon, am) {
@@ -509,6 +511,37 @@ const _ChatroomManager = new Lang.Class({
get roomCount() {
return Object.keys(this._rooms).length;
+ },
+
+ addToWatchlist: function(user, network) {
+ this._watchlist.push([user, network]);
+ },
+
+ isUserWatched: function (user, network) {
+ for (var i = 0; i < this._watchlist.length; i++) {
+ if (this._watchlist[i][0] == user && this._watchlist[i][1] == network) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ popUserFromWatchlist: function (user, network) {
+ let indexToDelete = -1;
+ for (var i = 0; i < this._watchlist.length; i++) {
+ if (this._watchlist[i][0] == user && this._watchlist[i][1] == network) {
+ indexToDelete = i;
+ }
+ }
+
+ if (indexToDelete != -1)
+ this._watchlist.splice(indexToDelete, 1);
+ },
+
+ emitWatchedUserNotification: function (notification) {
+ log("notification in chatroom manager");
+ this._app.send_notification('watched-user-notification', notification);
}
});
Signals.addSignalMethods(_ChatroomManager.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]