comparison sat/plugins/plugin_xep_0085.py @ 2994:94708a7d3ecf

core, plugin XEP-0045: fixed message type autodetection + ENTITY_TYPE_MUC constant: an old hardcoded value was used in several places to detect if an entity is a MUC, but this value was not valid anymore. This has been fixed, and ENTITY_TYPE_MUC constant is now used instead. This fixes message type autodetection for "groupchat" messages. fixes 300
author Goffi <goffi@goffi.org>
date Tue, 09 Jul 2019 09:06:45 +0200
parents 56f94936df1e
children ab2696e34d29
comparison
equal deleted inserted replaced
2993:d58dccd9e4b4 2994:94708a7d3ecf
255 @param to_jid (JID): full or bare JID to check 255 @param to_jid (JID): full or bare JID to check
256 @param profile (str): %(doc_profile)s 256 @param profile (str): %(doc_profile)s
257 @return: bool 257 @return: bool
258 """ 258 """
259 try: 259 try:
260 type_ = self.host.memory.getEntityDatum(to_jid.userhostJID(), "type", profile) 260 type_ = self.host.memory.getEntityDatum(
261 if type_ == "chatroom": # FIXME: should not use disco instead ? 261 to_jid.userhostJID(), C.ENTITY_TYPE, profile)
262 if type_ == C.ENTITY_TYPE_MUC:
262 return True 263 return True
263 except (exceptions.UnknownEntityError, KeyError): 264 except (exceptions.UnknownEntityError, KeyError):
264 pass 265 pass
265 return False 266 return False
266 267