Commit 2e266601 authored by Philipp Hörist's avatar Philipp Hörist

Remove nick and nickname attribute from gc-message-received event

It's available via properties attribute
parent b4797d25
......@@ -423,7 +423,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
sound = msg_obj.gc_control.highlighting_for_message(
msg_obj.msgtxt, msg_obj.properties.timestamp)[1]
if msg_obj.nickname != msg_obj.gc_control.nick:
if msg_obj.properties.muc_nickname != msg_obj.gc_control.nick:
self.do_sound = True
if sound == 'received':
self.sound_event = 'muc_message_received'
......@@ -471,7 +471,7 @@ class NotificationEvent(nec.NetworkIncomingEvent):
self.popup_title = i18n.ngettext(
'New message from %(nickname)s',
'%(n_msgs)i unread messages in %(groupchat_name)s',
count) % {'nickname': msg_obj.nick,
count) % {'nickname': msg_obj.properties.muc_nickname,
'n_msgs': count,
'groupchat_name': contact.get_shown_name()}
......
......@@ -200,8 +200,6 @@ class Message(BaseModule):
event_attr.update({
'room_jid': jid,
'nickname': resource,
'nick': resource or '',
})
event = NetworkEvent('gc-message-received', **event_attr)
app.nec.push_incoming_event(event)
......@@ -236,19 +234,20 @@ class Message(BaseModule):
self._check_for_mam_compliance(event.room_jid, event.stanza_id)
if (app.config.should_log(self._account, event.jid) and
event.msgtxt and event.nick):
event.msgtxt and event.properties.muc_nickname):
# if not event.nick, it means message comes from room itself
# usually it hold description and can be send at each connection
# so don't store it in logs
app.logger.insert_into_logs(self._account,
event.jid,
event.properties.timestamp,
KindConstant.GC_MSG,
message=event.msgtxt,
contact_name=event.nick,
additional_data=event.additional_data,
stanza_id=event.stanza_id,
message_id=event.properties.id)
app.logger.insert_into_logs(
self._account,
event.jid,
event.properties.timestamp,
KindConstant.GC_MSG,
message=event.msgtxt,
contact_name=event.properties.muc_nickname,
additional_data=event.additional_data,
stanza_id=event.stanza_id,
message_id=event.properties.id)
def _check_for_mam_compliance(self, room_jid, stanza_id):
disco_info = app.logger.get_last_disco_info(room_jid)
......
......@@ -828,17 +828,17 @@ class GroupchatControl(ChatControlBase):
@event_filter(['account', 'room_jid'])
def _nec_gc_message_received(self, obj):
if not obj.nick:
if obj.properties.muc_nickname is None:
# message from server
self.add_message(obj.msgtxt,
tim=obj.properties.timestamp,
displaymarking=obj.displaymarking,
additional_data=obj.additional_data)
else:
if obj.nick == self.nick:
if obj.properties.muc_nickname == self.nick:
self.last_sent_txt = obj.msgtxt
self.add_message(obj.msgtxt,
contact=obj.nick,
contact=obj.properties.muc_nickname,
tim=obj.properties.timestamp,
displaymarking=obj.displaymarking,
correct_id=obj.correct_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