comparison 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
comparison
equal deleted inserted replaced
709:648511e42a69 710:3344f1d8a232
135 room = message.firstChildElement()['jid'] 135 room = message.firstChildElement()['jid']
136 info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile}) 136 info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile})
137 except: 137 except:
138 error(_('Error while parsing invitation')) 138 error(_('Error while parsing invitation'))
139 return 139 return
140 from_ = message["from"]
141 if room in self.host.plugins["XEP-0045"].clients[profile].joined_rooms:
142 info(_("Invitation silently discarded because user is already in the room."))
143 return
140 autojoin = self.host.memory.getParamA(AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=profile) 144 autojoin = self.host.memory.getParamA(AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=profile)
141 from_ = message["from"]
142 145
143 def accept_cb(conf_id, accepted, data, profile): 146 def accept_cb(conf_id, accepted, data, profile):
144 if conf_id == room and accepted: 147 if conf_id == room and accepted:
145 self._accept(room, profile) 148 self._accept(room, profile)
146 149