From b4b44c6aa59949fd5bf6a272d455b5bb45b6d250 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 12 Oct 2014 15:16:17 +0200
Subject: [PATCH] fix sending zeroconf messages

---
 src/common/zeroconf/connection_zeroconf.py | 36 +++++++++++-----------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py
index 80794c3faa..667817016b 100644
--- a/src/common/zeroconf/connection_zeroconf.py
+++ b/src/common/zeroconf/connection_zeroconf.py
@@ -338,26 +338,26 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
         if obj.account != self.name:
             return
 
-        def on_send_ok(msg_id):
-            gajim.nec.push_incoming_event(MessageSentEvent(None, conn=self,
-                jid=obj.jid, message=obj.message, keyID=obj.keyID,
-                chatstate=None))
-            if obj.callback:
-                obj.callback(obj.msg_id, *obj.callback_args)
-
-            if not obj.is_loggable:
-                return
-            self.log_message(obj.jid, obj.message, obj.forward_from,
-                obj.session, obj.original_message, obj.subject, obj.type_)
-
-        def on_send_not_ok(reason):
-            reason += ' ' + _('Your message could not be sent.')
-            gajim.nec.push_incoming_event(MessageErrorEvent(None, conn=self,
-                fjid=obj.jid, error_code=-1, error_msg=reason, msg=None,
-                time_=None, session=obj.session))
-
         def cb(jid, msg, keyID, forward_from, session, original_message, subject,
         type_, msg_iq, xhtml):
+            def on_send_ok(msg_id):
+                gajim.nec.push_incoming_event(MessageSentEvent(None, conn=self,
+                    jid=obj.jid, message=obj.message, keyID=obj.keyID,
+                    chatstate=None))
+                if obj.callback:
+                    obj.callback(msg_iq, *obj.callback_args)
+
+                if not obj.is_loggable:
+                    return
+                self.log_message(obj.jid, obj.message, obj.forward_from,
+                    obj.session, obj.original_message, obj.subject, obj.type_)
+
+            def on_send_not_ok(reason):
+                reason += ' ' + _('Your message could not be sent.')
+                gajim.nec.push_incoming_event(MessageErrorEvent(None, conn=self,
+                    fjid=obj.jid, error_code=-1, error_msg=reason, msg=None,
+                    time_=None, session=obj.session))
+
             ret = self.connection.send(msg_iq, msg is not None, on_ok=on_send_ok,
                     on_not_ok=on_send_not_ok)
 
-- 
GitLab