core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
This commit is contained in:
parent
2a40da1664
commit
005ec59a8a
1 changed files with 123 additions and 101 deletions
|
|
@ -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 @@ class XEP_0095(object):
|
|||
#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 @@ class XEP_0095(object):
|
|||
@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 @@ class XEP_0095(object):
|
|||
|
||||
_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 @@ class XEP_0095(object):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue