Commit 13acb5af authored by Philipp Hörist's avatar Philipp Hörist

MAM: Simplify _parse_chat_attrs()

This became more simple due to nbxmpp changes
parent 8409f5e7
Pipeline #4354 passed with stages
in 2 minutes and 42 seconds
...@@ -174,7 +174,7 @@ class MAM(BaseModule): ...@@ -174,7 +174,7 @@ class MAM(BaseModule):
if groupchat: if groupchat:
event_attrs.update(self._parse_gc_attrs(properties)) event_attrs.update(self._parse_gc_attrs(properties))
else: else:
event_attrs.update(self._parse_chat_attrs(stanza, properties)) event_attrs.update(self._parse_chat_attrs(properties))
stanza_id, message_id = self._get_unique_id(properties) stanza_id, message_id = self._get_unique_id(properties)
...@@ -243,17 +243,13 @@ class MAM(BaseModule): ...@@ -243,17 +243,13 @@ class MAM(BaseModule):
'real_jid': real_jid, 'real_jid': real_jid,
'kind': KindConstant.GC_MSG} 'kind': KindConstant.GC_MSG}
def _parse_chat_attrs(self, stanza, properties): def _parse_chat_attrs(self, properties):
frm = properties.jid if properties.from_.bareMatch(self._con.get_own_jid()):
to = stanza.getTo()
if frm.bareMatch(self._con.get_own_jid()):
with_ = to
kind = KindConstant.CHAT_MSG_SENT kind = KindConstant.CHAT_MSG_SENT
else: else:
with_ = frm
kind = KindConstant.CHAT_MSG_RECV kind = KindConstant.CHAT_MSG_RECV
return {'with_': with_, return {'with_': properties.jid,
'nick': None, 'nick': None,
'kind': kind} 'kind': kind}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment