From ec3c756b9c7657dee552ef196aa492df3db57fdd Mon Sep 17 00:00:00 2001 From: lovetox Date: Thu, 9 Apr 2020 23:42:06 +0200 Subject: TCP: Pass Node objects instead of actual data on data-sent - Use for logging the actual data passed to GLib - Pass a Node object on data-sent so applications don't have to reparse it --- nbxmpp/tcp.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'nbxmpp/tcp.py') diff --git a/nbxmpp/tcp.py b/nbxmpp/tcp.py index 9668a0a..7a07002 100644 --- a/nbxmpp/tcp.py +++ b/nbxmpp/tcp.py @@ -289,14 +289,13 @@ class TCPConnection(Connection): self._write_stanzas() return - for stanza in self._write_stanza_buffer: - self._log_stanza(stanza, received=False) - self._write_stanza_buffer = None + self._log_stanza(data, received=False) - try: - self.notify('data-sent', data) - except Exception: - self._log.exception('Error while executing data-sent:') + for stanza in self._write_stanza_buffer: + try: + self.notify('data-sent', stanza) + except Exception: + self._log.exception('Error while executing data-sent:') if self._output_closed and not self._write_queue: self._check_for_shutdown() -- cgit v1.2.3