plugins radiocol_tarot: do not process received messages for MUC users that are actually not playing the game + fix for testing purpose
This commit is contained in:
parent
9e6845472d
commit
8b700a6d48
1 changed files with 20 additions and 5 deletions
|
|
@ -447,14 +447,19 @@ class Tarot(object):
|
|||
"""
|
||||
from_jid = jid.JID(mess_elt['from'])
|
||||
room_jid = jid.JID(from_jid.userhost())
|
||||
nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid.userhost(), profile)
|
||||
|
||||
game_elt = mess_elt.firstChildElement()
|
||||
game_data = self.games[room_jid.userhost()]
|
||||
is_player = self.isPlayer(room_jid.userhost(), nick)
|
||||
if 'players_data' in game_data:
|
||||
players_data = game_data['players_data']
|
||||
|
||||
for elt in game_elt.elements():
|
||||
if not is_player and (elt.name not in ('started', 'players')):
|
||||
continue # user is in the room but not playing
|
||||
|
||||
if elt.name == 'started' or elt.name == 'players': # new game created
|
||||
if elt.name in ('started', 'players'): # new game created and/or players list updated
|
||||
players = []
|
||||
for player in elt.elements():
|
||||
players.append(unicode(player))
|
||||
|
|
|
|||
Loading…
Reference in a new issue