comparison src/plugins/plugin_xep_0115.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
comparison
equal deleted inserted replaced
915:6f96ee4d8cc0 916:1a759096ccbd
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 _
21 from sat.core.constants import Const as C
21 from logging import debug, info, error, warning 22 from logging import debug, info, error, warning
22 from twisted.words.xish import domish 23 from twisted.words.xish import domish
23 from twisted.words.protocols.jabber import client, jid, xmlstream 24 from twisted.words.protocols.jabber import client, jid, xmlstream
24 from twisted.words.protocols.jabber import error as jab_error 25 from twisted.words.protocols.jabber import error as jab_error
25 from twisted.words.protocols.jabber.xmlstream import IQ 26 from twisted.words.protocols.jabber.xmlstream import IQ
114 self._legacy_send(obj) 115 self._legacy_send(obj)
115 new_send = types.MethodType(hacked_send, presenceInst, presenceInst.__class__) 116 new_send = types.MethodType(hacked_send, presenceInst, presenceInst.__class__)
116 presenceInst._legacy_send = presenceInst.send 117 presenceInst._legacy_send = presenceInst.send
117 presenceInst.send = new_send 118 presenceInst.send = new_send
118 119
119 def generateHash(self, profile_key="@DEFAULT@"): 120 def generateHash(self, profile_key=C.PROF_KEY_NONE):
120 """This method generate a sha1 hash as explained in xep-0115 #5.1 121 """This method generate a sha1 hash as explained in xep-0115 #5.1
121 it then store it in XEP_0115.cap_hash""" 122 it then store it in XEP_0115.cap_hash"""
122 profile = self.host.memory.getProfileName(profile_key) 123 profile = self.host.memory.getProfileName(profile_key)
123 if not profile: 124 if not profile:
124 error('Requesting hash for an inexistant profile') 125 error('Requesting hash for an inexistant profile')