Skip to content
This repository
Browse code

Python moderator work #203

Moderator needs:
* CollabInterface like object
* Handle cases when client can't join/subscribe/post.
  • Loading branch information...
commit aa0cfaa452b47de5e948616df6523a9de328116b 1 parent c26701c
Chris Cotter authored November 13, 2012
5  servers/python/coweb/session/collab.py
@@ -42,8 +42,9 @@ def on_purging_client(self, cid, client):
42 42
         # notify all bots of unsubscribing user
43 43
         self._services.on_user_unsubscribe_all(client)
44 44
         self._lateJoinHandler.removeUpdater(client)
45  
-        if self._lateJoinHandler.getUpdaterCount() == 0:
46  
-            # kill the session
  45
+        self._manager._moderator.onCLientLeaveSession(client)
  46
+        if 0 == self._lateJoinHandler.getUpdaterCount():
  47
+            # Kill the session, because everyone has left.
47 48
             self.end_session()
48 49
 
49 50
     def onUpdaterSendState(self, updater, data):
9  servers/python/coweb/session/late_join_handler.py
@@ -24,9 +24,6 @@ def __init__(self, session):
24 24
         # value is a BayeuxSession object associated with that token
25 25
         self._updatees = {}
26 26
 
27  
-        # attendees
28  
-        self._attendees = []
29  
-
30 27
         # list that helps us assign the lowest available site id
31 28
         self._siteids = ['reserved'] + [None] * 5
32 29
 
@@ -253,3 +250,9 @@ def onUpdaterSendState(self, updater, data):
253 250
             'data': data['state']
254 251
         })
255 252
 
  253
+    def onEndSession(self):
  254
+        self._lastState = None
  255
+        self._updaters = {}
  256
+        self._updatees = {}
  257
+        self._siteids = None
  258
+
4  servers/python/coweb/session/session.py
@@ -82,6 +82,10 @@ def start_session(self):
82 82
 
83 83
     def end_session(self):
84 84
         '''Unregister session and service handlers.'''
  85
+        self._manager._moderator.endSession()
  86
+        self._manager._lateJoinHandler.endSession()
  87
+        self._manager._lateJoinHandler = None
  88
+        self._manager._moderator = None
85 89
         self._application.remove_session_handler(self)
86 90
         # delegate to service manager
87 91
         self._services.end_services()

0 notes on commit aa0cfaa

Please sign in to comment.
Something went wrong with that request. Please try again.