changeset 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 526e4145253c
children bf7e468fe440
files src/plugins/plugin_xep_0045.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
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: