MUC implementation: first draft

/!\ the experimental muc branche of wokkel must be used
- bridge: new roomJoined signal
- wix: contact list widget is now in a separate file, and manage different kinds of presentation
- wix: chat window now manage group chat (first draft, not working yet)
- wix: constants are now in a separate class, so then can be accessible from everywhere
- wix: new menu to join room (do nothing yet, except entering in a test room)
- new plugin for xep 0045 (MUC), use wokkel experimental MUC branch
- plugins: the profile is now given for get_handler, cause it can be used internally by a plugin (e.g.: xep-0045 plugin)
This commit is contained in:
Goffi 2010-03-21 10:28:55 +11:00
commit 724a97b14d

View file

@ -42,6 +42,7 @@ class QuickApp():
self.bridge.register("newContact", self.newContact)
self.bridge.register("newMessage", self.newMessage)
self.bridge.register("presenceUpdate", self.presenceUpdate)
self.bridge.register("roomJoined", self.roomJoined)
self.bridge.register("subscribe", self.subscribe)
self.bridge.register("paramUpdate", self.paramUpdate)
self.bridge.register("contactDeleted", self.contactDeleted)
@ -80,7 +81,7 @@ class QuickApp():
## misc ##
self.profiles[profile]['onlineContact'] = set() #FIXME: temporary
#TODO: managed multi-profiles here
#TODO: gof: managed multi-profiles here
if self.bridge.isConnected(profile):
self.setStatusOnline(True)
else:
@ -153,7 +154,7 @@ class QuickApp():
if not self.__check_profile(profile):
return
print "check ok"
debug (_("presence update for %(jid)s (show=%(show)s, statuses=%(statuses)s)") % {'jid':jabber_id, 'show':show, 'statuses':statuses});
debug (_("presence update for %(jid)s (show=%(show)s, priority=%(priority)s, statuses=%(statuses)s) [profile:%(profile)s]") % {'jid':jabber_id, 'show':show, 'priority':priority, 'statuses':statuses, 'profile':profile});
from_jid=JID(jabber_id)
debug ("from_jid.short=%(from_jid)s whoami.short=%(whoami)s" % {'from_jid':from_jid.short, 'whoami':self.profiles[profile]['whoami'].short})
@ -187,13 +188,19 @@ class QuickApp():
self.CM.update(from_jid, 'nick', cache['nick'])
if cache.has_key('avatar'):
self.CM.update(from_jid, 'avatar', self.bridge.getAvatarFile(cache['avatar']))
self.contactList.replace(from_jid)
self.contactList.replace(from_jid, self.CM.getAttr(from_jid, 'groups'))
if show=="unavailable" and from_jid in self.profiles[profile]['onlineContact']:
self.profiles[profile]['onlineContact'].remove(from_jid)
self.CM.remove(from_jid)
if not self.CM.isConnected(from_jid):
self.contactList.disconnect(from_jid)
def roomJoined(self, room_id, room_service, room_nicks, user_nick, profile):
"""Called when a MUC room is joined"""
debug (_("Room [%(room_name)s] joined by %(profile)s") % {'room_name':room_id+'@'+room_service, 'profile': profile})
def subscribe(self, type, raw_jid, profile):
"""Called when a subsciption maangement signal is received"""