fix logging single messages. Fixes #8640

This commit is contained in:
Yann Leboulanger 2017-06-14 15:29:19 +02:00
parent 4f7b72883d
commit 388acfca5a
2 changed files with 6 additions and 6 deletions

View File

@ -413,14 +413,14 @@ class CommonConnection:
gajim.nec.push_incoming_event(
StanzaMessageOutgoingEvent(None, **vars(obj)))
def log_message(self, obj):
def log_message(self, obj, jid):
if not obj.is_loggable:
return
if obj.forward_from or not obj.session or not obj.session.is_loggable():
return
if not gajim.config.should_log(self.name, obj.jid):
if not gajim.config.should_log(self.name, jid):
return
if obj.xhtml and gajim.config.get('log_xhtml_messages'):
@ -437,7 +437,7 @@ class CommonConnection:
kind = 'single_msg_sent'
gajim.logger.write(
kind, obj.jid, message, subject=obj.subject,
kind, jid, message, subject=obj.subject,
additional_data=obj.additional_data)
def ack_subscribed(self, jid):
@ -2058,9 +2058,9 @@ class Connection(CommonConnection, ConnectionHandlers):
for j in obj.jid:
if obj.session is None:
obj.session = self.get_or_create_session(j, '')
self.log_message(obj)
self.log_message(obj, j)
else:
self.log_message(obj)
self.log_message(obj, obj.jid)
def send_contacts(self, contacts, fjid, type_='message'):
"""

View File

@ -342,7 +342,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
if obj.callback:
obj.callback(obj.msg_iq, *obj.callback_args)
self.log_message(obj)
self.log_message(obj, obj.jid)
def on_send_not_ok(reason):
reason += ' ' + _('Your message could not be sent.')