changeset 1583:d46aae87c03a

plugins XEP-0047, XEP-0065, XEP-0096: fixed use of failure.condition insteand of failure.value + removed gettext use for local logs
author Goffi <goffi@goffi.org>
date Fri, 13 Nov 2015 16:46:31 +0100
parents a41cc0849008
children b57b4683dc33
files src/plugins/plugin_xep_0047.py src/plugins/plugin_xep_0065.py src/plugins/plugin_xep_0096.py
diffstat 3 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0047.py	Fri Nov 13 16:45:56 2015 +0100
+++ b/src/plugins/plugin_xep_0047.py	Fri Nov 13 16:46:31 2015 +0100
@@ -82,7 +82,7 @@
         @param sid(unicode): session id of client.xep_0047_current_stream
         @param client: %(doc_client)s
         """
-        log.info(_("In-Band Bytestream: TimeOut reached for id {sid} [{profile}]")
+        log.info(u"In-Band Bytestream: TimeOut reached for id {sid} [{profile}]"
                  .format(sid=sid, profile=client.profile))
         self._killSession(sid, client, "TIMEOUT")
 
@@ -97,7 +97,7 @@
         try:
             session = client.xep_0047_current_stream[sid]
         except KeyError:
-            log.warning(_("kill id called on a non existant id"))
+            log.warning(u"kill id called on a non existant id")
             return
 
         try:
@@ -331,9 +331,9 @@
 
     def _IQDataStreamEb(self, failure, session_data, client):
         if failure.check(error.StanzaError):
-            log.warning(u"IBB transfer failed: {}".format(failure.condition))
+            log.warning(u"IBB transfer failed: {}".format(failure.value))
         else:
-            log.error(u"IBB transfer failed: {}".format(failure.condition))
+            log.error(u"IBB transfer failed: {}".format(failure.value))
         self.terminateStream(session_data, client, "IQ_ERROR")
 
     def terminateStream(self, session_data, client, failure_reason=None):
--- a/src/plugins/plugin_xep_0065.py	Fri Nov 13 16:45:56 2015 +0100
+++ b/src/plugins/plugin_xep_0065.py	Fri Nov 13 16:46:31 2015 +0100
@@ -1062,7 +1062,7 @@
         log.warning(u"Proxy activation error: {}".format(failure.value))
 
     def _IQNegotiationEb(self, stanza_err, session_data, client):
-        log.warning(u"Socks5 transfer failed: {}".format(stanza_err.condition))
+        log.warning(u"Socks5 transfer failed: {}".format(stanza_err.value))
         # FIXME: must clean session
 
     def createSession(self, *args, **kwargs):
--- a/src/plugins/plugin_xep_0096.py	Fri Nov 13 16:45:56 2015 +0100
+++ b/src/plugins/plugin_xep_0096.py	Fri Nov 13 16:46:31 2015 +0100
@@ -158,9 +158,9 @@
             elif stream_method == self.host.plugins["XEP-0047"].NAMESPACE:
                 plugin = self.host.plugins["XEP-0047"]
             else:
-                log.error(_("Unknown stream method, this should not happen at this stage, cancelling transfer"))
+                log.error(u"Unknown stream method, this should not happen at this stage, cancelling transfer")
         else:
-            log.warning(_("Can't find a valid stream method"))
+            log.warning(u"Can't find a valid stream method")
             self._si.sendError(iq_elt, 'not-acceptable', profile)
             return
 
@@ -245,7 +245,7 @@
         @param data: session data
         @param profile: %(doc_profile)s
         """
-        log.warning(u'Transfer {si_id} failed: {reason}'.format(reason=unicode(failure.condition), **data))
+        log.warning(u'Transfer {si_id} failed: {reason}'.format(reason=unicode(failure.value), **data))
         data['file_obj'].close()
 
     def _sendFile(self, peer_jid_s, filepath, name, desc, profile=C.PROF_KEY_NONE):
@@ -333,7 +333,7 @@
                 self.host.bridge.newAlert(_("The contact {} has refused your file").format(from_s), _("File refused"), "INFO", client.profile)
             else:
                 log.warning(_(u"Error during file transfer"))
-                self.host.bridge.newAlert(_(u"Something went wrong during the file transfer session intialisation: {reason}").format(reason=unicode(stanza_err.condition)), _("File transfer error"), "ERROR", client.profile)
+                self.host.bridge.newAlert(_(u"Something went wrong during the file transfer session intialisation: {reason}").format(reason=unicode(stanza_err.value)), _("File transfer error"), "ERROR", client.profile)
         elif failure.check(exceptions.DataError):
             log.warning(u'Invalid stanza received')
         else:
@@ -349,6 +349,6 @@
         log.warning(_(u'transfer {sid} failed [{profile}]: {reason}').format(
             sid=sid,
             profile=profile,
-            reason=unicode(failure.condition),
+            reason=unicode(failure.value),
             ))
         file_obj.close()