Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0096.py @ 2046:b99bd02ea643
plugin XEP-0045, XEP-0054, XEP-0096: deprecated bridge method are not used anymore
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 18:20:55 +0200 |
parents | 2daf7b4c6756 |
children | 33c8c4973743 |
comparison
equal
deleted
inserted
replaced
2045:48536a22b599 | 2046:b99bd02ea643 |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _ | 20 from sat.core.i18n import _, D_ |
21 from sat.core.constants import Const as C | 21 from sat.core.constants import Const as C |
22 from sat.core.log import getLogger | 22 from sat.core.log import getLogger |
23 log = getLogger(__name__) | 23 log = getLogger(__name__) |
24 from sat.core import exceptions | 24 from sat.core import exceptions |
25 from sat.tools import xml_tools | |
25 from twisted.words.xish import domish | 26 from twisted.words.xish import domish |
26 from twisted.words.protocols.jabber import jid | 27 from twisted.words.protocols.jabber import jid |
27 from twisted.words.protocols.jabber import error | 28 from twisted.words.protocols.jabber import error |
28 import os | 29 import os |
29 | 30 |
331 if failure.check(error.StanzaError): | 332 if failure.check(error.StanzaError): |
332 stanza_err = failure.value | 333 stanza_err = failure.value |
333 if stanza_err.code == '403' and stanza_err.condition == 'forbidden': | 334 if stanza_err.code == '403' and stanza_err.condition == 'forbidden': |
334 from_s = stanza_err.stanza['from'] | 335 from_s = stanza_err.stanza['from'] |
335 log.info(u"File transfer refused by {}".format(from_s)) | 336 log.info(u"File transfer refused by {}".format(from_s)) |
336 self.host.bridge.newAlert(_("The contact {} has refused your file").format(from_s), _("File refused"), "INFO", client.profile) | 337 msg = D_(u"The contact {} has refused your file").format(from_s) |
338 title = D_(u"File refused") | |
339 xml_tools.quickNote(self.host, client, msg, title, C.XMLUI_DATA_LVL_INFO) | |
337 else: | 340 else: |
338 log.warning(_(u"Error during file transfer")) | 341 log.warning(_(u"Error during file transfer")) |
339 self.host.bridge.newAlert(_(u"Something went wrong during the file transfer session initialisation: {reason}").format(reason=unicode(stanza_err)), _("File transfer error"), "ERROR", client.profile) | 342 msg = D_(u"Something went wrong during the file transfer session initialisation: {reason}").format(reason=unicode(stanza_err)) |
343 title = D_(u"File transfer error") | |
344 xml_tools.quickNote(self.host, client, msg, title, C.XMLUI_DATA_LVL_ERROR) | |
340 elif failure.check(exceptions.DataError): | 345 elif failure.check(exceptions.DataError): |
341 log.warning(u'Invalid stanza received') | 346 log.warning(u'Invalid stanza received') |
342 else: | 347 else: |
343 log.error(u'Error while proposing stream: {}'.format(failure)) | 348 log.error(u'Error while proposing stream: {}'.format(failure)) |
344 | 349 |