plugins room_games, radiocol: better synchronization after a user joins a running game
This commit is contained in:
parent
2b51a340d4
commit
9e6845472d
1 changed files with 62 additions and 30 deletions
|
|
@ -224,8 +224,16 @@ class Radiocol(object):
|
|||
else:
|
||||
error(_('Unmanaged game element: %s') % elt.name)
|
||||
|
||||
def getSyncData(self, room_jid_s):
|
||||
data = self.games[room_jid_s]['queue']
|
||||
if len(data) == QUEUE_LIMIT:
|
||||
data.append(domish.Element((None, 'no_upload')))
|
||||
def getSyncData(self, room_jid_s, force_nicks=[]):
|
||||
data = {}
|
||||
status = self.games[room_jid_s]['status']
|
||||
nicks = [nick for nick in status if status[nick] == 'desync']
|
||||
for nick in force_nicks:
|
||||
if nick not in nicks:
|
||||
nicks.append(nick)
|
||||
for nick in nicks:
|
||||
if len(self.games[room_jid_s]['queue']) > 0:
|
||||
data[nick] = copy.deepcopy(self.games[room_jid_s]['queue'])
|
||||
if len(self.games[room_jid_s]['queue']) == QUEUE_LIMIT:
|
||||
data[nick].append(domish.Element(('', 'no_upload')))
|
||||
return data
|
||||
|
|
|
|||
Loading…
Reference in a new issue