Log sent messages with new logger method
- also save stanza id to the DB
This commit is contained in:
parent
a01611178d
commit
9d2898bb35
3 changed files with 14 additions and 10 deletions
|
@ -927,7 +927,7 @@ class ChatControl(ChatControlBase):
|
||||||
gtkgui_helpers.remove_css_class(
|
gtkgui_helpers.remove_css_class(
|
||||||
self.msg_textview, 'msgcorrectingcolor')
|
self.msg_textview, 'msgcorrectingcolor')
|
||||||
|
|
||||||
self.print_conversation(message, self.contact.jid,
|
self.print_conversation(message, self.contact.jid, tim=obj.timestamp,
|
||||||
encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,
|
encrypted=encrypted, xep0184_id=xep0184_id, xhtml=xhtml,
|
||||||
displaymarking=displaymarking, msg_stanza_id=id_,
|
displaymarking=displaymarking, msg_stanza_id=id_,
|
||||||
correct_id=obj.correct_id,
|
correct_id=obj.correct_id,
|
||||||
|
|
|
@ -433,14 +433,11 @@ class CommonConnection:
|
||||||
if not message:
|
if not message:
|
||||||
return
|
return
|
||||||
|
|
||||||
if obj.type_ == 'chat':
|
gajim.logger.insert_into_logs(jid, obj.timestamp, obj.kind,
|
||||||
kind = 'chat_msg_sent'
|
message=message,
|
||||||
else:
|
subject=obj.subject,
|
||||||
kind = 'single_msg_sent'
|
additional_data=obj.additional_data,
|
||||||
|
stanza_id=obj.stanza_id)
|
||||||
gajim.logger.write(
|
|
||||||
kind, jid, message, subject=obj.subject,
|
|
||||||
additional_data=obj.additional_data)
|
|
||||||
|
|
||||||
def ack_subscribed(self, jid):
|
def ack_subscribed(self, jid):
|
||||||
"""
|
"""
|
||||||
|
@ -2051,6 +2048,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
self.send_message(obj)
|
self.send_message(obj)
|
||||||
|
|
||||||
def send_message(self, obj):
|
def send_message(self, obj):
|
||||||
|
obj.timestamp = time.time()
|
||||||
obj.stanza_id = self.connection.send(obj.msg_iq, now=obj.now)
|
obj.stanza_id = self.connection.send(obj.msg_iq, now=obj.now)
|
||||||
|
|
||||||
gajim.nec.push_incoming_event(MessageSentEvent(
|
gajim.nec.push_incoming_event(MessageSentEvent(
|
||||||
|
|
|
@ -2707,10 +2707,12 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
|
||||||
base_network_events = []
|
base_network_events = []
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
self.additional_data = {}
|
self.additional_data = None
|
||||||
self.message = ''
|
self.message = ''
|
||||||
self.keyID = None
|
self.keyID = None
|
||||||
self.type_ = 'chat'
|
self.type_ = 'chat'
|
||||||
|
self.kind = None
|
||||||
|
self.timestamp = None
|
||||||
self.subject = ''
|
self.subject = ''
|
||||||
self.chatstate = None
|
self.chatstate = None
|
||||||
self.stanza_id = None
|
self.stanza_id = None
|
||||||
|
@ -2741,6 +2743,10 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
|
||||||
return self.jid
|
return self.jid
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
if self.type_ == 'chat':
|
||||||
|
self.kind = KindConstant.CHAT_MSG_SENT
|
||||||
|
else:
|
||||||
|
self.kind = KindConstant.SINGLE_MSG_SENT
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
|
class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
|
||||||
|
|
Loading…
Add table
Reference in a new issue