mirror of
https://github.com/Syncplay/syncplay
synced 2024-12-23 23:32:55 +00:00
Improvements in userlist handling
This commit is contained in:
parent
957f5498a4
commit
e5dc3135aa
@ -396,7 +396,7 @@ class SyncplayUserlist(object):
|
||||
|
||||
def __addDifferentFileMessageIfNecessary(self, user, message):
|
||||
if(self.currentUser.file):
|
||||
fileHasSameSizeAsYour = user.file['size'] != self.currentUser.file['size']
|
||||
fileHasSameSizeAsYour = user.file['size'] == self.currentUser.file['size']
|
||||
differentFileMessage = " (but their file size is different from yours!)"
|
||||
message += differentFileMessage if not fileHasSameSizeAsYour else ""
|
||||
return message
|
||||
@ -426,7 +426,10 @@ class SyncplayUserlist(object):
|
||||
rooms = {}
|
||||
self.__createListOfPeople(rooms)
|
||||
self.__displayListOfPeople(rooms)
|
||||
|
||||
|
||||
def clearList(self):
|
||||
self._users = {}
|
||||
|
||||
class UiManager(object):
|
||||
def __init__(self, client, ui):
|
||||
self._client = client
|
||||
|
@ -89,6 +89,7 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||
self._client.setRoom(roomName)
|
||||
self.logged = True
|
||||
self._client.sendFile()
|
||||
self.sendList()
|
||||
|
||||
def sendHello(self):
|
||||
hello = {}
|
||||
@ -136,6 +137,7 @@ class SyncClientProtocol(JSONCommandProtocol):
|
||||
self.sendSet({"file": file_})
|
||||
|
||||
def handleList(self, userList):
|
||||
self._client.userlist.clearList()
|
||||
for room in userList.iteritems():
|
||||
roomName = room[0]
|
||||
for user in room[1].iteritems():
|
||||
@ -274,8 +276,7 @@ class SyncServerProtocol(JSONCommandProtocol):
|
||||
self._factory.addWatcher(self, username, roomName, roomPassword)
|
||||
self._logged = True
|
||||
self.sendHello()
|
||||
self.sendList()
|
||||
|
||||
|
||||
def sendHello(self):
|
||||
hello = {}
|
||||
hello["username"] = self._factory.watcherGetUsername(self)
|
||||
|
Loading…
Reference in New Issue
Block a user