diff src/plugins/plugin_xep_0095.py @ 916:1a759096ccbd

core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 16:27:09 +0100
parents 1fe00f0c9a91
children c6d8fc63b1db
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0095.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_xep_0095.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, info, error
 from twisted.words.xish import domish
 from twisted.internet import protocol
@@ -86,7 +87,7 @@
             #We don't know this profile, we send an error
             self.sendBadProfileError(iq_el['id'], iq_el['from'], profile)
 
-    def sendRejectedError(self, iq_id, to_jid, reason='Offer Declined', profile='@NONE@'):
+    def sendRejectedError(self, iq_id, to_jid, reason='Offer Declined', profile=C.PROF_KEY_NONE):
         """Helper method to send when the stream is rejected
         @param iq_id: IQ id
         @param to_jid: recipient
@@ -115,7 +116,7 @@
         @param profile: %(doc_profile)s"""
         self.sendError(iq_id, to_jid, 500, 'cancel', {'custom': 'failed'}, profile=profile)  # as there is no error code for failed transfer, we use 500 (undefined-condition)
 
-    def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile='@NONE@'):
+    def sendError(self, iq_id, to_jid, err_code, err_type='cancel', data={}, profile=C.PROF_KEY_NONE):
         """Send IQ error as a result
         @param iq_id: IQ id
         @param to_jid: recipient
@@ -150,7 +151,7 @@
 
         _client.xmlstream.send(result)
 
-    def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile='@NONE@'):
+    def acceptStream(self, iq_id, to_jid, feature_elt, misc_elts=[], profile=C.PROF_KEY_NONE):
         """Send the accept stream initiation answer
         @param iq_id: IQ id
         @param feature_elt: domish element 'feature' containing stream method to use
@@ -169,7 +170,7 @@
             si.addChild(elt)
         _client.xmlstream.send(result)
 
-    def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key='@NONE@'):
+    def proposeStream(self, to_jid, si_profile, feature_elt, misc_elts, mime_type='application/octet-stream', profile_key=C.PROF_KEY_NONE):
         """Propose a stream initiation
         @param to_jid: recipient (JID)
         @param si_profile: Stream initiation profile (XEP-0095)