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
This commit is contained in:
parent
90fcacd4bd
commit
5e43c6c98c
2 changed files with 39 additions and 29 deletions
|
|
@ -94,7 +94,8 @@ class Const(object):
|
|||
ENTITY_ALL_RESOURCES = "@ALL_RESOURCES@"
|
||||
ENTITY_MAIN_RESOURCE = "@MAIN_RESOURCE@"
|
||||
ENTITY_CAP_HASH = "CAP_HASH"
|
||||
ENTITY_TYPE = "TYPE"
|
||||
ENTITY_TYPE = "type"
|
||||
ENTITY_TYPE_MUC = "MUC"
|
||||
|
||||
## Roster jids selection ##
|
||||
PUBLIC = "PUBLIC"
|
||||
|
|
|
|||
|
|
@ -566,14 +566,14 @@ class SatXMPPEntity(object):
|
|||
# the type is not 'groupchat'
|
||||
# we may have a groupchat message, we check if the we know this jid
|
||||
try:
|
||||
entity_type = self.host_app.memory.getEntityData(
|
||||
data["to"], ["type"], self.profile
|
||||
)["type"]
|
||||
entity_type = self.host_app.memory.getEntityDatum(
|
||||
data["to"], C.ENTITY_TYPE, self.profile
|
||||
)
|
||||
# FIXME: should entity_type manage resources ?
|
||||
except (exceptions.UnknownEntityError, KeyError):
|
||||
entity_type = "contact"
|
||||
|
||||
if entity_type == "chatroom":
|
||||
if entity_type == C.ENTITY_TYPE_MUC:
|
||||
data["type"] = C.MESS_TYPE_GROUPCHAT
|
||||
else:
|
||||
data["type"] = C.MESS_TYPE_CHAT
|
||||
|
|
|
|||
Loading…
Reference in a new issue