Commit 5ea40d75 authored by Philipp Hörist's avatar Philipp Hörist

Refactor parsing attention

Adapt to nbxmpp changes
parent b443a39f
......@@ -31,7 +31,6 @@ from gajim.common.modules.util import get_eme_message
from gajim.common.modules.security_labels import parse_securitylabel
from gajim.common.modules.user_nickname import parse_nickname
from gajim.common.modules.misc import parse_correction
from gajim.common.modules.misc import parse_attention
from gajim.common.modules.misc import parse_form
from gajim.common.modules.misc import parse_oob
from gajim.common.modules.misc import parse_xhtml
......@@ -174,7 +173,8 @@ class Message(BaseModule):
'timestamp': properties.timestamp,
'delayed': properties.user_timestamp is not None,
'muc_pm': properties.is_muc_pm,
'gc_control': gc_control
'gc_control': gc_control,
'attention': properties.attention,
}
app.nec.push_incoming_event(NetworkEvent('update-client-info',
......@@ -210,7 +210,6 @@ class Message(BaseModule):
'msg_log_id': None,
'subject': subject,
'displaymarking': parse_securitylabel(event.stanza),
'attention': parse_attention(event.stanza),
'user_nick': '' if event.sent else parse_nickname(event.stanza),
'form_node': parse_form(event.stanza),
'xhtml': parse_xhtml(event.stanza),
......
......@@ -43,18 +43,6 @@ def parse_correction(properties):
return properties.correction.id
# XEP-0224: Attention
def parse_attention(stanza):
attention = stanza.getTag('attention', namespace=nbxmpp.NS_ATTENTION)
if attention is None:
return False
delayed = stanza.getTag('x', namespace=nbxmpp.NS_DELAY2)
if delayed is not None:
return False
return True
# XEP-0004: Data Forms
def parse_form(stanza):
......
......@@ -34,7 +34,6 @@ from gajim.common.const import KindConstant
from gajim.common.modules.user_nickname import parse_nickname
from gajim.common.modules.util import get_eme_message
from gajim.common.modules.misc import parse_correction
from gajim.common.modules.misc import parse_attention
from gajim.common.modules.misc import parse_oob
from gajim.common.modules.misc import parse_xhtml
from gajim.common.connection_handlers_events import MessageErrorEvent
......@@ -119,7 +118,9 @@ class ConnectionHandlersZeroconf(connection_handlers.ConnectionHandlersBase):
'session': session,
'self_message': False,
'muc_pm': False,
'gc_control': None}
'gc_control': None,
'attention': properties.attention,
}
event = ZeroconfMessageReceivedEvent(None, **event_attr)
app.nec.push_incoming_event(event)
......@@ -143,7 +144,6 @@ class ConnectionHandlersZeroconf(connection_handlers.ConnectionHandlersBase):
'subject': None,
'displaymarking': None,
'form_node': None,
'attention': parse_attention(event.stanza),
'user_nick': parse_nickname(event.stanza),
'xhtml': parse_xhtml(event.stanza),
'stanza_id': event.unique_id
......
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