Implemented 'Pause when user disconnects'
This commit is contained in:
parent
91a0998ee4
commit
c9c8d537b5
@ -33,6 +33,8 @@ class SyncClientFactory(ClientFactory):
|
|||||||
self._client.ui.showMessage(message)
|
self._client.ui.showMessage(message)
|
||||||
|
|
||||||
def clientConnectionLost(self, connector, reason):
|
def clientConnectionLost(self, connector, reason):
|
||||||
|
if self._timesTried == 0:
|
||||||
|
self._client.onDisconnect()
|
||||||
if self._timesTried < self.retry:
|
if self._timesTried < self.retry:
|
||||||
self._timesTried += 1
|
self._timesTried += 1
|
||||||
self._client.ui.showMessage(getMessage("en", "reconnection-attempt-notification"))
|
self._client.ui.showMessage(getMessage("en", "reconnection-attempt-notification"))
|
||||||
@ -249,6 +251,14 @@ class SyncplayClient(object):
|
|||||||
self.setPosition(self.getGlobalPosition())
|
self.setPosition(self.getGlobalPosition())
|
||||||
self.ui.showMessage(getMessage("en", "current-offset-notification").format(self._userOffset))
|
self.ui.showMessage(getMessage("en", "current-offset-notification").format(self._userOffset))
|
||||||
|
|
||||||
|
def onDisconnect(self):
|
||||||
|
if(self._config['pauseOnLeave']):
|
||||||
|
self.setPaused(True)
|
||||||
|
|
||||||
|
def removeUser(self, username):
|
||||||
|
self.onDisconnect()
|
||||||
|
self.userlist.removeUser(username)
|
||||||
|
|
||||||
def getPlayerPosition(self):
|
def getPlayerPosition(self):
|
||||||
if(not self._lastPlayerUpdate):
|
if(not self._lastPlayerUpdate):
|
||||||
if(self._lastGlobalUpdate):
|
if(self._lastGlobalUpdate):
|
||||||
|
|||||||
@ -119,7 +119,7 @@ class SyncClientProtocol(JSONCommandProtocol):
|
|||||||
if(settings["event"].has_key("joined")):
|
if(settings["event"].has_key("joined")):
|
||||||
self._client.userlist.addUser(username, room, file_)
|
self._client.userlist.addUser(username, room, file_)
|
||||||
elif(settings["event"].has_key("left")):
|
elif(settings["event"].has_key("left")):
|
||||||
self._client.userlist.removeUser(username)
|
self._client.removeUser(username)
|
||||||
else:
|
else:
|
||||||
self._client.userlist.modUser(username, room, file_)
|
self._client.userlist.modUser(username, room, file_)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user