Permalink
Browse files

Python moderator work #203

Moderator needs:
* CollabInterface like object
* Handle cases when client can't join/subscribe/post.
  • Loading branch information...
ccotter committed Nov 13, 2012
1 parent c26701c commit aa0cfaa452b47de5e948616df6523a9de328116b
@@ -42,8 +42,9 @@ def on_purging_client(self, cid, client):
# notify all bots of unsubscribing user
self._services.on_user_unsubscribe_all(client)
self._lateJoinHandler.removeUpdater(client)
- if self._lateJoinHandler.getUpdaterCount() == 0:
- # kill the session
+ self._manager._moderator.onCLientLeaveSession(client)
+ if 0 == self._lateJoinHandler.getUpdaterCount():
+ # Kill the session, because everyone has left.
self.end_session()
def onUpdaterSendState(self, updater, data):
@@ -24,9 +24,6 @@ def __init__(self, session):
# value is a BayeuxSession object associated with that token
self._updatees = {}
- # attendees
- self._attendees = []
-
# list that helps us assign the lowest available site id
self._siteids = ['reserved'] + [None] * 5
@@ -253,3 +250,9 @@ def onUpdaterSendState(self, updater, data):
'data': data['state']
})
+ def onEndSession(self):
+ self._lastState = None
+ self._updaters = {}
+ self._updatees = {}
+ self._siteids = None
+
@@ -82,6 +82,10 @@ def start_session(self):
def end_session(self):
'''Unregister session and service handlers.'''
+ self._manager._moderator.endSession()
+ self._manager._lateJoinHandler.endSession()
+ self._manager._lateJoinHandler = None
+ self._manager._moderator = None
self._application.remove_session_handler(self)
# delegate to service manager
self._services.end_services()

0 comments on commit aa0cfaa

Please sign in to comment.