diff src/plugins/plugin_xep_0249.py @ 710:3344f1d8a232

plugin XEP-0249: silently discard MUC invitation if user is already in
author souliane <souliane@mailoo.org>
date Sun, 17 Nov 2013 16:23:29 +0100
parents 78bf4ed37574
children bfabeedbf32e
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0249.py	Sun Nov 17 16:11:55 2013 +0100
+++ b/src/plugins/plugin_xep_0249.py	Sun Nov 17 16:23:29 2013 +0100
@@ -137,8 +137,11 @@
         except:
             error(_('Error while parsing invitation'))
             return
+        from_ = message["from"]
+        if room in self.host.plugins["XEP-0045"].clients[profile].joined_rooms:
+            info(_("Invitation silently discarded because user is already in the room."))
+            return
         autojoin = self.host.memory.getParamA(AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=profile)
-        from_ = message["from"]
 
         def accept_cb(conf_id, accepted, data, profile):
             if conf_id == room and accepted: