comparison frontends/src/quick_frontend/quick_app.py @ 405:10b4f577d0c0

MUC update to follow wokkel's MUC branch update - bridge methods have been updated (API change) - plugin XEP-0045 has been updated
author Goffi <goffi@goffi.org>
date Sat, 08 Oct 2011 18:43:17 +0200
parents f964dcec1611
children f6f94e21c642
comparison
equal deleted inserted replaced
404:6a1c6c41b91b 405:10b4f577d0c0
158 waitingSub = self.bridge.getWaitingSub(profile) 158 waitingSub = self.bridge.getWaitingSub(profile)
159 for sub in waitingSub: 159 for sub in waitingSub:
160 self.subscribe(waitingSub[sub], sub, profile) 160 self.subscribe(waitingSub[sub], sub, profile)
161 161
162 #Now we open the MUC window where we already are: 162 #Now we open the MUC window where we already are:
163 for room_args in self.bridge.getRoomJoined(profile): 163 for room_args in self.bridge.getRoomsJoined(profile):
164 self.roomJoined(*room_args, profile=profile) 164 self.roomJoined(*room_args, profile=profile)
165 165
166 for subject_args in self.bridge.getRoomSubjects(profile): 166 for subject_args in self.bridge.getRoomsSubjectss(profile):
167 self.roomNewSubject(*subject_args, profile=profile) 167 self.roomNewSubject(*subject_args, profile=profile)
168 168
169 if autoconnect and not self.bridge.isConnected(profile_key): 169 if autoconnect and not self.bridge.isConnected(profile_key):
170 #Does the user want autoconnection ? 170 #Does the user want autoconnection ?
171 self.bridge.connect(profile_key) 171 self.bridge.connect(profile_key)
281 self.profiles[profile]['onlineContact'].remove(from_jid) 281 self.profiles[profile]['onlineContact'].remove(from_jid)
282 self.CM.remove(from_jid) 282 self.CM.remove(from_jid)
283 if not self.CM.isConnected(from_jid): 283 if not self.CM.isConnected(from_jid):
284 self.contactList.disconnect(from_jid) 284 self.contactList.disconnect(from_jid)
285 285
286 def roomJoined(self, room_id, room_service, room_nicks, user_nick, profile): 286 def roomJoined(self, room_jid, room_nicks, user_nick, profile):
287 """Called when a MUC room is joined""" 287 """Called when a MUC room is joined"""
288 if not self.check_profile(profile): 288 if not self.check_profile(profile):
289 return 289 return
290 debug (_("Room [%(room_name)s] joined by %(profile)s, users presents:%(users)s") % {'room_name':room_id+'@'+room_service, 'profile': profile, 'users':room_nicks}) 290 debug (_("Room [%(room_jid)s] joined by %(profile)s, users presents:%(users)s") % {'room_jid':room_jid, 'profile': profile, 'users':room_nicks})
291 room_jid=room_id+'@'+room_service
292 self.chat_wins[room_jid].setUserNick(user_nick) 291 self.chat_wins[room_jid].setUserNick(user_nick)
293 self.chat_wins[room_jid].setType("group") 292 self.chat_wins[room_jid].setType("group")
294 self.chat_wins[room_jid].id = room_jid 293 self.chat_wins[room_jid].id = room_jid
295 self.chat_wins[room_jid].setPresents(list(set([user_nick]+room_nicks))) 294 self.chat_wins[room_jid].setPresents(list(set([user_nick]+room_nicks)))
296 295
297 296
298 def roomUserJoined(self, room_id, room_service, user_nick, user_data, profile): 297 def roomUserJoined(self, room_jid, user_nick, user_data, profile):
299 """Called when an user joined a MUC room""" 298 """Called when an user joined a MUC room"""
300 if not self.check_profile(profile): 299 if not self.check_profile(profile):
301 return 300 return
302 room_jid=room_id+'@'+room_service
303 if self.chat_wins.has_key(room_jid): 301 if self.chat_wins.has_key(room_jid):
304 self.chat_wins[room_jid].replaceUser(user_nick) 302 self.chat_wins[room_jid].replaceUser(user_nick)
305 debug (_("user [%(user_nick)s] joined room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid}) 303 debug (_("user [%(user_nick)s] joined room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid})
306 304
307 def roomUserLeft(self, room_id, room_service, user_nick, user_data, profile): 305 def roomUserLeft(self, room_jid, user_nick, user_data, profile):
308 """Called when an user joined a MUC room""" 306 """Called when an user joined a MUC room"""
309 if not self.check_profile(profile): 307 if not self.check_profile(profile):
310 return 308 return
311 room_jid=room_id+'@'+room_service
312 if self.chat_wins.has_key(room_jid): 309 if self.chat_wins.has_key(room_jid):
313 self.chat_wins[room_jid].removeUser(user_nick) 310 self.chat_wins[room_jid].removeUser(user_nick)
314 debug (_("user [%(user_nick)s] left room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid}) 311 debug (_("user [%(user_nick)s] left room [%(room_jid)s]") % {'user_nick':user_nick, 'room_jid':room_jid})
315 312
316 def roomNewSubject(self, room_id, room_service, subject, profile): 313 def roomNewSubject(self, room_jid, subject, profile):
317 """Called when subject of MUC room change""" 314 """Called when subject of MUC room change"""
318 if not self.check_profile(profile): 315 if not self.check_profile(profile):
319 return 316 return
320 room_jid=room_id+'@'+room_service
321 if self.chat_wins.has_key(room_jid): 317 if self.chat_wins.has_key(room_jid):
322 self.chat_wins[room_jid].setSubject(subject) 318 self.chat_wins[room_jid].setSubject(subject)
323 debug (_("new subject for room [%(room_jid)s]: %(subject)s") % {'room_jid':room_jid, "subject":subject}) 319 debug (_("new subject for room [%(room_jid)s]: %(subject)s") % {'room_jid':room_jid, "subject":subject})
324 320
325 def tarotGameStarted(self, room_jid, referee, players, profile): 321 def tarotGameStarted(self, room_jid, referee, players, profile):