MUC update to follow wokkel's MUC branch update

- bridge methods have been updated (API change)
- plugin XEP-0045 has been updated
This commit is contained in:
Goffi 2011-10-08 18:43:17 +02:00
commit b7b7c60e33

View file

@ -160,10 +160,10 @@ class QuickApp():
self.subscribe(waitingSub[sub], sub, profile)
#Now we open the MUC window where we already are:
for room_args in self.bridge.getRoomJoined(profile):
for room_args in self.bridge.getRoomsJoined(profile):
self.roomJoined(*room_args, profile=profile)
for subject_args in self.bridge.getRoomSubjects(profile):
for subject_args in self.bridge.getRoomsSubjectss(profile):
self.roomNewSubject(*subject_args, profile=profile)
if autoconnect and not self.bridge.isConnected(profile_key):
@ -283,41 +283,37 @@ class QuickApp():
if not self.CM.isConnected(from_jid):
self.contactList.disconnect(from_jid)
def roomJoined(self, room_id, room_service, room_nicks, user_nick, profile):
def roomJoined(self, room_jid, room_nicks, user_nick, profile):
"""Called when a MUC room is joined"""
if not self.check_profile(profile):
return
debug (_("Room [%(room_name)s] joined by %(profile)s, users presents:%(users)s") % {'room_name':room_id+'@'+room_service, 'profile': profile, 'users':room_nicks})
room_jid=room_id+'@'+room_service
debug (_("Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s") % {'room_jid':room_jid, 'profile': profile, 'users':room_nicks})
self.chat_wins[room_jid].setUserNick(user_nick)
self.chat_wins[room_jid].setType("group")
self.chat_wins[room_jid].id = room_jid
self.chat_wins[room_jid].setPresents(list(set([user_nick]+room_nicks)))
def roomUserJoined(self, room_id, room_service, user_nick, user_data, profile):
def roomUserJoined(self, room_jid, user_nick, user_data, profile):
"""Called when an user joined a MUC room"""
if not self.check_profile(profile):
return
room_jid=room_id+'@'+room_service
if self.chat_wins.has_key(room_jid):
self.chat_wins[room_jid].replaceUser(user_nick)
debug (_("user [%(user_nick)s] joined room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid})
def roomUserLeft(self, room_id, room_service, user_nick, user_data, profile):
def roomUserLeft(self, room_jid, user_nick, user_data, profile):
"""Called when an user joined a MUC room"""
if not self.check_profile(profile):
return
room_jid=room_id+'@'+room_service
if self.chat_wins.has_key(room_jid):
self.chat_wins[room_jid].removeUser(user_nick)
debug (_("user [%(user_nick)s] left room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid})
def roomNewSubject(self, room_id, room_service, subject, profile):
def roomNewSubject(self, room_jid, subject, profile):
"""Called when subject of MUC room change"""
if not self.check_profile(profile):
return
room_jid=room_id+'@'+room_service
if self.chat_wins.has_key(room_jid):
self.chat_wins[room_jid].setSubject(subject)
debug (_("new subject for room [%(room_jid)s]: %(subject)s") % {'room_jid':room_jid, "subject":subject})