comparison src/plugins/plugin_misc_room_game.py @ 1257:83ed877541e3

plugin misc_room_game, radiocol, tarot: fixes bridge method "prepareRoom" declaration (add "async=True")
author souliane <souliane@mailoo.org>
date Wed, 22 Oct 2014 14:38:20 +0200
parents 301b342c697a
children 83127a4c89ce
comparison
equal deleted inserted replaced
1256:4b27b9bf31b0 1257:83ed877541e3
405 """ 405 """
406 log.debug(_('Preparing room for %s game') % self.name) 406 log.debug(_('Preparing room for %s game') % self.name)
407 profile = self.host.memory.getProfileName(profile_key) 407 profile = self.host.memory.getProfileName(profile_key)
408 if not profile: 408 if not profile:
409 log.error(_("Unknown profile")) 409 log.error(_("Unknown profile"))
410 return 410 return defer.succeed(None)
411 if other_players is None: 411 if other_players is None:
412 other_players = [] 412 other_players = []
413 413
414 def roomJoined(room): 414 def roomJoined(room):
415 """@param room: instance of wokkel.muc.Room""" 415 """@param room: instance of wokkel.muc.Room"""
417 417
418 # Create/join the given room, or a unique generated one if no room is specified. 418 # Create/join the given room, or a unique generated one if no room is specified.
419 if room_jid_s is not None and room_jid_s != "": # a room name has been specified 419 if room_jid_s is not None and room_jid_s != "": # a room name has been specified
420 if room_jid_s in self.host.plugins["XEP-0045"].clients[profile].joined_rooms: 420 if room_jid_s in self.host.plugins["XEP-0045"].clients[profile].joined_rooms:
421 roomJoined(self.host.plugins["XEP-0045"].clients[profile].joined_rooms[room_jid_s]) 421 roomJoined(self.host.plugins["XEP-0045"].clients[profile].joined_rooms[room_jid_s])
422 return 422 return defer.succeed(None)
423 else: 423 else:
424 room_jid_s = self.getUniqueName(profile_key=profile_key) 424 room_jid_s = self.getUniqueName(profile_key=profile_key)
425 if room_jid_s == "": 425 if room_jid_s == "":
426 return 426 return defer.succeed(None)
427 user_jid = self.host.getJidNStream(profile)[0] 427 user_jid = self.host.getJidNStream(profile)[0]
428 d = self.host.plugins["XEP-0045"].join(JID(room_jid_s), user_jid.user, {}, profile) 428 d = self.host.plugins["XEP-0045"].join(JID(room_jid_s), user_jid.user, {}, profile)
429 return d.addCallback(roomJoined) 429 return d.addCallback(roomJoined)
430 430
431 def userJoinedTrigger(self, room, user, profile): 431 def userJoinedTrigger(self, room, user, profile):