comparison src/plugins/plugin_xep_0047.py @ 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 7fef6cdf5953
children e9936fcfaf91
comparison
equal deleted inserted replaced
1582:a41cc0849008 1583:d46aae87c03a
80 """Delete current_stream id, called after timeout 80 """Delete current_stream id, called after timeout
81 81
82 @param sid(unicode): session id of client.xep_0047_current_stream 82 @param sid(unicode): session id of client.xep_0047_current_stream
83 @param client: %(doc_client)s 83 @param client: %(doc_client)s
84 """ 84 """
85 log.info(_("In-Band Bytestream: TimeOut reached for id {sid} [{profile}]") 85 log.info(u"In-Band Bytestream: TimeOut reached for id {sid} [{profile}]"
86 .format(sid=sid, profile=client.profile)) 86 .format(sid=sid, profile=client.profile))
87 self._killSession(sid, client, "TIMEOUT") 87 self._killSession(sid, client, "TIMEOUT")
88 88
89 def _killSession(self, sid, client, failure_reason=None): 89 def _killSession(self, sid, client, failure_reason=None):
90 """Delete a current_stream id, clean up associated observers 90 """Delete a current_stream id, clean up associated observers
95 else, will be used to call failure_cb 95 else, will be used to call failure_cb
96 """ 96 """
97 try: 97 try:
98 session = client.xep_0047_current_stream[sid] 98 session = client.xep_0047_current_stream[sid]
99 except KeyError: 99 except KeyError:
100 log.warning(_("kill id called on a non existant id")) 100 log.warning(u"kill id called on a non existant id")
101 return 101 return
102 102
103 try: 103 try:
104 observer_cb = session['observer_cb'] 104 observer_cb = session['observer_cb']
105 except KeyError: 105 except KeyError:
329 else: 329 else:
330 self.terminateStream(session_data, client) 330 self.terminateStream(session_data, client)
331 331
332 def _IQDataStreamEb(self, failure, session_data, client): 332 def _IQDataStreamEb(self, failure, session_data, client):
333 if failure.check(error.StanzaError): 333 if failure.check(error.StanzaError):
334 log.warning(u"IBB transfer failed: {}".format(failure.condition)) 334 log.warning(u"IBB transfer failed: {}".format(failure.value))
335 else: 335 else:
336 log.error(u"IBB transfer failed: {}".format(failure.condition)) 336 log.error(u"IBB transfer failed: {}".format(failure.value))
337 self.terminateStream(session_data, client, "IQ_ERROR") 337 self.terminateStream(session_data, client, "IQ_ERROR")
338 338
339 def terminateStream(self, session_data, client, failure_reason=None): 339 def terminateStream(self, session_data, client, failure_reason=None):
340 """Terminate the stream session 340 """Terminate the stream session
341 341