changeset 220:c5274bf5e18b

plugin xep 0045: workaround for MUCClient exceptions
author Goffi <goffi@goffi.org>
date Mon, 27 Dec 2010 21:36:02 +0100
parents 782319a64ac6
children 96186f36d8cb
files plugins/plugin_xep_0045.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/plugin_xep_0045.py	Mon Dec 27 21:14:09 2010 +0100
+++ b/plugins/plugin_xep_0045.py	Mon Dec 27 21:36:02 2010 +0100
@@ -137,7 +137,12 @@
             warning(_('%(profile)s is already in room %(room_jid)s') % {'profile':profile, 'room_jid':room_jid})
             return
         info (_("[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile':profile,'room':roomId+'@'+service, 'nick':nick})
-        self.clients[profile].join(service, roomId, nick).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackKeywords={'profile':profile})
+        try:
+            self.clients[profile].join(service, roomId, nick).addCallbacks(self.__room_joined, self.__err_joining_room, callbackKeywords={'profile':profile}, errbackKeywords={'profile':profile})
+        except:
+            #XXX: this is a ugly workaround as MUCClient thrown an error if there is invalid chars in the room jid (like with the default string)
+            #FIXME: must be removed when MUCClient manage this better
+            self.__err_joining_room(None, profile)
 
     def getHandler(self, profile):
         #reactor.callLater(15,self.join,"conference.necton2.int", "test", "Goffi \o/", profile)