Mercurial > libervia-backend
comparison src/plugins/plugin_misc_tarot.py @ 1970:200cd707a46d
plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass):
- bridge methods/signals now all start with "muc" to follow new convention
- internal method use client instead of profile to follow new convention
- removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added
- cleaned/simplified several part of the code. checkClient removed as it is not needed anymore
- self.clients map removed, muc data are now stored directly in client
- getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane.
/!\ This break all room game plugins for the moment
- use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 27 Jun 2016 21:45:11 +0200 |
parents | 2daf7b4c6756 |
children | 33c8c4973743 |
comparison
equal
deleted
inserted
replaced
1969:5fbe09b9b568 | 1970:200cd707a46d |
---|---|
475 | 475 |
476 def room_game_cmd(self, mess_elt, profile): | 476 def room_game_cmd(self, mess_elt, profile): |
477 """ | 477 """ |
478 @param mess_elt: instance of twisted.words.xish.domish.Element | 478 @param mess_elt: instance of twisted.words.xish.domish.Element |
479 """ | 479 """ |
480 client = self.host.getClient(profile) | |
480 from_jid = jid.JID(mess_elt['from']) | 481 from_jid = jid.JID(mess_elt['from']) |
481 room_jid = jid.JID(from_jid.userhost()) | 482 room_jid = jid.JID(from_jid.userhost()) |
482 nick = self.host.plugins["XEP-0045"].getRoomNick(room_jid, profile) | 483 nick = self.host.plugins["XEP-0045"].getRoomNick(client, room_jid) |
483 | 484 |
484 game_elt = mess_elt.firstChildElement() | 485 game_elt = mess_elt.firstChildElement() |
485 game_data = self.games[room_jid] | 486 game_data = self.games[room_jid] |
486 is_player = self.isPlayer(room_jid, nick) | 487 is_player = self.isPlayer(room_jid, nick) |
487 if 'players_data' in game_data: | 488 if 'players_data' in game_data: |
520 elif elt.name == 'contrat_choosed': | 521 elif elt.name == 'contrat_choosed': |
521 # TODO: check we receive the contrat from the right person | 522 # TODO: check we receive the contrat from the right person |
522 # TODO: use proper XEP-0004 way for answering form | 523 # TODO: use proper XEP-0004 way for answering form |
523 player = elt['player'] | 524 player = elt['player'] |
524 players_data[player]['contrat'] = unicode(elt) | 525 players_data[player]['contrat'] = unicode(elt) |
525 contrats = [players_data[player]['contrat'] for player in game_data['players']] | 526 contrats = [players_data[p]['contrat'] for p in game_data['players']] |
526 if contrats.count(None): | 527 if contrats.count(None): |
527 # not everybody has choosed his contrat, it's next one turn | 528 # not everybody has choosed his contrat, it's next one turn |
528 player = self.__next_player(game_data) | 529 player = self.__next_player(game_data) |
529 to_jid = jid.JID(room_jid.userhost() + "/" + player) # FIXME: gof: | 530 to_jid = jid.JID(room_jid.userhost() + "/" + player) # FIXME: gof: |
530 self.send(to_jid, self.__ask_contrat(), profile=profile) | 531 self.send(to_jid, self.__ask_contrat(), profile=profile) |