changeset 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
files src/plugins/plugin_misc_radiocol.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_misc_radiocol.py	Mon Jan 23 00:14:33 2012 +0100
+++ b/src/plugins/plugin_misc_radiocol.py	Tue Jan 24 00:22:11 2012 +0100
@@ -89,10 +89,10 @@
     def userJoinedTrigger(self, room, user, profile):
         """This trigger is used to check if we are waiting people in this room,
         and to create a game if everybody is here"""
-        room_jid = room.occupantJID.userhostJID()
-        if self.radios.has_key(room_jid):
+        room_jid = room.occupantJID.userhost()
+        if self.radios.has_key(room_jid) and self.radios[room_jid]["referee"] == room.occupantJID.full():
             #we are in a radiocol room, let's start the party !
-            mess = self.createRadiocolElt(jid.JID(room_jid.userhost()+'/'+occupant))
+            mess = self.createRadiocolElt(jid.JID(room_jid+'/'+user.nick))
             mess.firstChildElement().addChild(self.__create_started_elt())
             self.host.profiles[profile].xmlstream.send(mess)
         return True
@@ -109,9 +109,9 @@
         def radiocolRoomJoined(room):
             print "radiocolRoomJoined"
             _room_jid = room.occupantJID.userhostJID()
+            self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
             for occupant in occupants:
                 self.host.plugins["XEP-0249"].invite(jid.JID(occupant), room.occupantJID.userhostJID(), {"game":"Radiocol"}, profile)
-            self.radiocolCreate(_room_jid.userhost(), profile_key=profile)
         
         def after_init(ignore):
             room_name = "sat_radiocol_%s" % self.host.plugins["XEP-0045"].getUniqueName(profile_key)