Call notify check methods with JID arg

For subscription requests we dont have a contact obj
This commit is contained in:
Philipp Hörist 2018-06-30 11:02:30 +02:00
parent 7fa4c9e1c2
commit 5bc9822cec
4 changed files with 11 additions and 11 deletions

View File

@ -1022,9 +1022,9 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
event_type = events.PrintedPmEvent
event = 'message_received'
show_in_roster = notify.get_show_in_roster(event,
self.account, self.contact, self.session)
self.account, self.contact.jid, self.session)
show_in_systray = notify.get_show_in_systray(event,
self.account, self.contact, event_type.type_)
self.account, self.contact.jid, event_type.type_)
event = event_type(text, subject, self, msg_log_id,
show_in_roster=show_in_roster,

View File

@ -38,7 +38,7 @@ from gajim.common import helpers
from gajim.common import ged
def get_show_in_roster(event, account, contact, session=None):
def get_show_in_roster(event, account, jid, session=None):
"""
Return True if this event must be shown in roster, else False
"""
@ -50,14 +50,14 @@ def get_show_in_roster(event, account, contact, session=None):
return True
def get_show_in_systray(event, account, contact, type_=None):
def get_show_in_systray(event, account, jid, type_=None):
"""
Return True if this event must be shown in systray, else False
"""
notify = app.config.get('notify_on_all_muc_messages')
notify_for_jid = app.config.get_per(
'rooms', contact.jid, 'notify_on_all_messages')
'rooms', jid, 'notify_on_all_messages')
if type_ == 'printed_gc_msg' and not notify and not notify_for_jid:
# it's not an highlighted message, don't show in systray

View File

@ -280,9 +280,9 @@ class ChatControlSession(object):
else:
# Everything else
obj.show_in_roster = notify.get_show_in_roster(event_type,
self.conn.name, contact, self)
self.conn.name, contact.jid, self)
obj.show_in_systray = notify.get_show_in_systray(event_type,
self.conn.name, contact)
self.conn.name, contact.jid)
if obj.mtype == 'normal' and obj.popup:
do_event = False
else:
@ -388,9 +388,9 @@ class ChatControlSession(object):
event_type = 'single_message_received'
show_in_roster = notify.get_show_in_roster(event_type, self.conn.name,
contact, self)
contact.jid, self)
show_in_systray = notify.get_show_in_systray(event_type, self.conn.name,
contact)
contact.jid)
event = event_t(msg, subject, msg_type, tim, encrypted, resource,
msg_log_id, xhtml=xhtml, session=self, form_node=form_node,

View File

@ -27,8 +27,8 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
def get_advanced_notification(event, account, contact):
return None
def get_show_in_roster(event, account, contact, session = None):
def get_show_in_roster(event, account, jid, session=None):
return True
def get_show_in_systray(event, account, contact, type_ = None):
def get_show_in_systray(event, account, jid, type_=None):
return True