comparison src/plugins/plugin_misc_radiocol.py @ 456:ba6e1feda03e

plugin radiocol: fixed autocreation of radiocol for new comers
author Goffi <goffi@goffi.org>
date Tue, 24 Jan 2012 00:22:11 +0100
parents 72522263cbc9
children fbe7c9118ce4
comparison
equal deleted inserted replaced
455:72522263cbc9 456:ba6e1feda03e
87 return started_elt 87 return started_elt
88 88
89 def userJoinedTrigger(self, room, user, profile): 89 def userJoinedTrigger(self, room, user, profile):
90 """This trigger is used to check if we are waiting people in this room, 90 """This trigger is used to check if we are waiting people in this room,
91 and to create a game if everybody is here""" 91 and to create a game if everybody is here"""
92 room_jid = room.occupantJID.userhostJID() 92 room_jid = room.occupantJID.userhost()
93 if self.radios.has_key(room_jid): 93 if self.radios.has_key(room_jid) and self.radios[room_jid]["referee"] == room.occupantJID.full():
94 #we are in a radiocol room, let's start the party ! 94 #we are in a radiocol room, let's start the party !
95 mess = self.createRadiocolElt(jid.JID(room_jid.userhost()+'/'+occupant)) 95 mess = self.createRadiocolElt(jid.JID(room_jid+'/'+user.nick))
96 mess.firstChildElement().addChild(self.__create_started_elt()) 96 mess.firstChildElement().addChild(self.__create_started_elt())
97 self.host.profiles[profile].xmlstream.send(mess) 97 self.host.profiles[profile].xmlstream.send(mess)
98 return True 98 return True
99 99
100 def radiocolLaunch(self, occupants, profile_key='@DEFAULT@'): 100 def radiocolLaunch(self, occupants, profile_key='@DEFAULT@'):
107 return 107 return
108 108
109 def radiocolRoomJoined(room): 109 def radiocolRoomJoined(room):
110 print "radiocolRoomJoined" 110 print "radiocolRoomJoined"
111 _room_jid = room.occupantJID.userhostJID() 111 _room_jid = room.occupantJID.userhostJID()
112 self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
112 for occupant in occupants: 113 for occupant in occupants:
113 self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile) 114 self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile)
114 self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
115 115
116 def after_init(ignore): 116 def after_init(ignore):
117 room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key) 117 room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)
118 print "\n\n===> room_name:", room_name 118 print "\n\n===> room_name:", room_name
119 muc_service = None 119 muc_service = None