diff src/plugins/plugin_xep_0045.py @ 1789:8e2c831073a6

plugin XEP-0045: raise a special error when the room has already been joined
author souliane <souliane@mailoo.org>
date Wed, 13 Jan 2016 13:07:36 +0100
parents d17772b0fe22
children 0a45bc8e7cf4
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Wed Jan 13 08:50:40 2016 +0100
+++ b/src/plugins/plugin_xep_0045.py	Wed Jan 13 13:07:36 2016 +0100
@@ -60,6 +60,9 @@
     pass
 
 
+class AlreadyJoinedRoom(Exception):
+    pass
+
 class NotReadyYet(Exception):
     pass
 
@@ -363,7 +366,7 @@
             return _errDeferred()
         if room_jid in self.clients[profile].joined_rooms:
             log.warning(_(u'%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()})
-            return _errDeferred()
+            return _errDeferred(AlreadyJoinedRoom, D_(u"The room has already been joined"))
         log.info(_(u"[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick})
 
         if "history" in options: