summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-12 17:43:25 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-12 17:43:35 +0200
commit3ed39ad20e20556ce8f103d2187a5699ceac95f9 (patch)
treeec22792c12d9395046abc90da57e73dd9165e918 /webclient/components
parentRetry sending events that fail to send. (diff)
downloadsynapse-3ed39ad20e20556ce8f103d2187a5699ceac95f9.tar.xz
Clean data when user logs out
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/event-handler-service.js24
1 files changed, 18 insertions, 6 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index 1f32289bdf..705a5a07f2 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -36,13 +36,19 @@ angular.module('eventHandlerService', [])
     var CALL_EVENT = "CALL_EVENT";
     var NAME_EVENT = "NAME_EVENT";
     var TOPIC_EVENT = "TOPIC_EVENT";
+    var RESET_EVENT = "RESET_EVENT";    // eventHandlerService has been resetted
+
+    var initialSyncDeferred;
+
+    var reset = function() {
+        initialSyncDeferred = $q.defer();
+
+        $rootScope.events = {
+            rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
+        };
+    }
+    reset();
 
-    var initialSyncDeferred = $q.defer();
-    
-    $rootScope.events = {
-        rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
-    };
-    
     // used for dedupping events - could be expanded in future...
     // FIXME: means that we leak memory over time (along with lots of the rest
     // of the app, given we never try to reap memory yet)
@@ -236,6 +242,12 @@ angular.module('eventHandlerService', [])
         CALL_EVENT: CALL_EVENT,
         NAME_EVENT: NAME_EVENT,
         TOPIC_EVENT: TOPIC_EVENT,
+        RESET_EVENT: RESET_EVENT,
+        
+        reset: function() {
+            reset();
+            $rootScope.$broadcast(RESET_EVENT);
+        },
     
         handleEvent: function(event, isLiveEvent, isStateEvent) {