Improvements in userlist handling

This commit is contained in:
Uriziel 2012-10-16 17:11:24 +02:00
parent 957f5498a4
commit e5dc3135aa
2 changed files with 8 additions and 4 deletions

View File

@ -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
@ -427,6 +427,9 @@ class SyncplayUserlist(object):
self.__createListOfPeople(rooms)
self.__displayListOfPeople(rooms)
def clearList(self):
self._users = {}
class UiManager(object):
def __init__(self, client, ui):
self._client = client

View File

@ -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,7 +276,6 @@ class SyncServerProtocol(JSONCommandProtocol):
self._factory.addWatcher(self, username, roomName, roomPassword)
self._logged = True
self.sendHello()
self.sendList()
def sendHello(self):
hello = {}