diff 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
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0096.py	Sun Aug 28 18:18:10 2016 +0200
+++ b/src/plugins/plugin_xep_0096.py	Sun Aug 28 18:20:55 2016 +0200
@@ -17,11 +17,12 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-from sat.core.i18n import _
+from sat.core.i18n import _, D_
 from sat.core.constants import Const as C
 from sat.core.log import getLogger
 log = getLogger(__name__)
 from sat.core import exceptions
+from sat.tools import xml_tools
 from twisted.words.xish import domish
 from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber import error
@@ -333,10 +334,14 @@
             if stanza_err.code == '403' and stanza_err.condition == 'forbidden':
                 from_s = stanza_err.stanza['from']
                 log.info(u"File transfer refused by {}".format(from_s))
-                self.host.bridge.newAlert(_("The contact {} has refused your file").format(from_s), _("File refused"), "INFO", client.profile)
+                msg = D_(u"The contact {} has refused your file").format(from_s)
+                title = D_(u"File refused")
+                xml_tools.quickNote(self.host, client, msg, title, C.XMLUI_DATA_LVL_INFO)
             else:
                 log.warning(_(u"Error during file transfer"))
-                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)
+                msg = D_(u"Something went wrong during the file transfer session initialisation: {reason}").format(reason=unicode(stanza_err))
+                title = D_(u"File transfer error")
+                xml_tools.quickNote(self.host, client, msg, title, C.XMLUI_DATA_LVL_ERROR)
         elif failure.check(exceptions.DataError):
             log.warning(u'Invalid stanza received')
         else: