Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
2993:d58dccd9e4b4 | 2994:94708a7d3ecf |
---|---|
92 for e in message_elt.elements(C.NS_CLIENT, "body"): | 92 for e in message_elt.elements(C.NS_CLIENT, "body"): |
93 body = unicode(e) | 93 body = unicode(e) |
94 lang = e.getAttribute("lang") or "" | 94 lang = e.getAttribute("lang") or "" |
95 | 95 |
96 try: | 96 try: |
97 entity_type = self.host.memory.getEntityData(from_jid, ["type"], profile)[ | 97 entity_type = self.host.memory.getEntityData( |
98 "type" | 98 from_jid, [C.ENTITY_TYPE], profile)[C.ENTITY_TYPE] |
99 ] | |
100 except (UnknownEntityError, KeyError): | 99 except (UnknownEntityError, KeyError): |
101 entity_type = "contact" | 100 entity_type = "contact" |
102 if entity_type == "chatroom": | 101 if entity_type == C.ENTITY_TYPE_MUC: |
103 src_txt = from_jid.resource | 102 src_txt = from_jid.resource |
104 if src_txt == self.host.plugins["XEP-0045"].getRoomNick( | 103 if src_txt == self.host.plugins["XEP-0045"].getRoomNick( |
105 client, from_jid.userhostJID() | 104 client, from_jid.userhostJID() |
106 ): | 105 ): |
107 # we won't repeat our own messages | 106 # we won't repeat our own messages |