diff sat/plugins/plugin_exp_parrot.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 003b8b4b56a7
children ab2696e34d29
line wrap: on
line diff
--- a/sat/plugins/plugin_exp_parrot.py	Mon Jul 08 19:11:29 2019 +0200
+++ b/sat/plugins/plugin_exp_parrot.py	Tue Jul 09 09:06:45 2019 +0200
@@ -94,12 +94,11 @@
             lang = e.getAttribute("lang") or ""
 
             try:
-                entity_type = self.host.memory.getEntityData(from_jid, ["type"], profile)[
-                    "type"
-                ]
+                entity_type = self.host.memory.getEntityData(
+                    from_jid, [C.ENTITY_TYPE], profile)[C.ENTITY_TYPE]
             except (UnknownEntityError, KeyError):
                 entity_type = "contact"
-            if entity_type == "chatroom":
+            if entity_type == C.ENTITY_TYPE_MUC:
                 src_txt = from_jid.resource
                 if src_txt == self.host.plugins["XEP-0045"].getRoomNick(
                     client, from_jid.userhostJID()