diff src/plugins/plugin_xep_0045.py @ 1384:73f8582c7c99

plugins XEP-0045, XEP-0249: allow to join / invite without specifying the JID's host part (use client's values)
author souliane <souliane@mailoo.org>
date Tue, 24 Mar 2015 07:34:32 +0100
parents 0d12d4e32664
children c7082457d03f
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0045.py	Mon Mar 23 09:34:23 2015 +0100
+++ b/src/plugins/plugin_xep_0045.py	Tue Mar 24 07:34:32 2015 +0100
@@ -363,13 +363,13 @@
         if not self.checkClient(profile):
             return
         if room_jid_s:
+            muc_service = self.host.getClient(profile).muc_service
             try:
                 room_jid = jid.JID(room_jid_s)
             except (RuntimeError, jid.InvalidFormat, AttributeError):
-                mess = _("Invalid room JID: %s") % room_jid_s
-                log.warning(mess)
-                self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile)
-                return defer.succeed(None)
+                return defer.fail(jid.InvalidFormat(_(u"Invalid room identifier: '%s'. Please give a room short or full identifier like 'room' or 'room@%s'.") % (room_jid_s, unicode(muc_service))))
+            if not room_jid.user:
+                room_jid.user, room_jid.host = room_jid.host, muc_service
         else:
             room_jid = self.getUniqueName(profile_key=profile_key)
         # TODO: error management + signal in bridge