Use MessageSentEvent to print to ChatControl
Its later than StanzaMessageOutgoingEvent, this allows encryption Plugins to not return the encrypted payload immediatly. For example encrypting may take some time because a password is needed or the load has to be encrypted in another Thread.
This commit is contained in:
parent
77be67f6a8
commit
c6e39309cf
2 changed files with 3 additions and 6 deletions
|
@ -238,7 +238,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._nec_chatstate_received)
|
self._nec_chatstate_received)
|
||||||
app.ged.register_event_handler('caps-received', ged.GUI1,
|
app.ged.register_event_handler('caps-received', ged.GUI1,
|
||||||
self._nec_caps_received)
|
self._nec_caps_received)
|
||||||
app.ged.register_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
|
app.ged.register_event_handler('message-sent', ged.OUT_POSTCORE,
|
||||||
self._message_sent)
|
self._message_sent)
|
||||||
app.ged.register_event_handler(
|
app.ged.register_event_handler(
|
||||||
'mam-decrypted-message-received',
|
'mam-decrypted-message-received',
|
||||||
|
@ -1160,7 +1160,7 @@ class ChatControl(ChatControlBase):
|
||||||
self._nec_chatstate_received)
|
self._nec_chatstate_received)
|
||||||
app.ged.remove_event_handler('caps-received', ged.GUI1,
|
app.ged.remove_event_handler('caps-received', ged.GUI1,
|
||||||
self._nec_caps_received)
|
self._nec_caps_received)
|
||||||
app.ged.remove_event_handler('stanza-message-outgoing', ged.OUT_POSTCORE,
|
app.ged.remove_event_handler('message-sent', ged.OUT_POSTCORE,
|
||||||
self._message_sent)
|
self._message_sent)
|
||||||
|
|
||||||
self.unsubscribe_events()
|
self.unsubscribe_events()
|
||||||
|
|
|
@ -2075,10 +2075,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
obj.timestamp = time.time()
|
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)
|
||||||
|
|
||||||
app.nec.push_incoming_event(MessageSentEvent(
|
app.nec.push_incoming_event(MessageSentEvent(None, **vars(obj)))
|
||||||
None, conn=self, jid=obj.jid, message=obj.message, keyID=obj.keyID,
|
|
||||||
chatstate=obj.chatstate, automatic_message=obj.automatic_message,
|
|
||||||
stanza_id=obj.stanza_id, additional_data=obj.additional_data))
|
|
||||||
|
|
||||||
if isinstance(obj.jid, list):
|
if isinstance(obj.jid, list):
|
||||||
for j in obj.jid:
|
for j in obj.jid:
|
||||||
|
|
Loading…
Add table
Reference in a new issue