comparison src/browser/sat_browser/plugin_sec_otr.py @ 662:ebb602d8b3f2 frontends_multi_profiles

browser_side: replace all instances of 'str' with 'unicode'
author souliane <souliane@mailoo.org>
date Tue, 03 Mar 2015 06:51:13 +0100
parents 9092e624bb27
children 423182fea41c
comparison
equal deleted inserted replaced
661:2664fe93ceb3 662:ebb602d8b3f2
133 self.host = host 133 self.host = host
134 134
135 def getPolicy(self, key): 135 def getPolicy(self, key):
136 """Get the value of the specified policy 136 """Get the value of the specified policy
137 137
138 @param key (str): a value in: 138 @param key (unicode): a value in:
139 - ALLOW_V1 (apriori removed from otr.js) 139 - ALLOW_V1 (apriori removed from otr.js)
140 - ALLOW_V2 140 - ALLOW_V2
141 - ALLOW_V3 141 - ALLOW_V3
142 - REQUIRE_ENCRYPTION 142 - REQUIRE_ENCRYPTION
143 - SEND_WHITESPACE_TAG 143 - SEND_WHITESPACE_TAG
144 - WHITESPACE_START_AKE 144 - WHITESPACE_START_AKE
145 - ERROR_START_AKE 145 - ERROR_START_AKE
146 @return: str 146 @return: unicode
147 """ 147 """
148 if key in DEFAULT_POLICY_FLAGS: 148 if key in DEFAULT_POLICY_FLAGS:
149 return DEFAULT_POLICY_FLAGS[key] 149 return DEFAULT_POLICY_FLAGS[key]
150 else: 150 else:
151 return False 151 return False
240 dialog.ConfirmDialog(setTrust, text, title, AddStyleName="maxWidthLimit").show() 240 dialog.ConfirmDialog(setTrust, text, title, AddStyleName="maxWidthLimit").show()
241 241
242 def smpAuthCb(self, type_, data, act=None): 242 def smpAuthCb(self, type_, data, act=None):
243 """OTR v3 authentication using the socialist millionaire protocol. 243 """OTR v3 authentication using the socialist millionaire protocol.
244 244
245 @param type_ (str): a value in ('question', 'trust', 'abort') 245 @param type_ (unicode): a value in ('question', 'trust', 'abort')
246 @param data (str, bool): this could be: 246 @param data (unicode, bool): this could be:
247 - a string containing the question if type_ is 'question' 247 - a string containing the question if type_ is 'question'
248 - a boolean value telling if the authentication succeed when type_ is 'trust' 248 - a boolean value telling if the authentication succeed when type_ is 'trust'
249 @param act (str): a value in ('asked', 'answered') 249 @param act (unicode): a value in ('asked', 'answered')
250 """ 250 """
251 log.debug("smpAuthCb: type={type}, data={data}, act={act}".format(type=type_, data=data, act=act)) 251 log.debug("smpAuthCb: type={type}, data={data}, act={act}".format(type=type_, data=data, act=act))
252 if act is None: 252 if act is None:
253 if type_ == 'question': 253 if type_ == 'question':
254 act = 'answered' # OTR._authenticate calls this method with act="asked" 254 act = 'answered' # OTR._authenticate calls this method with act="asked"
367 367
368 @classmethod 368 @classmethod
369 def getInfoText(self, state=otr.context.STATE_PLAINTEXT, trust=''): 369 def getInfoText(self, state=otr.context.STATE_PLAINTEXT, trust=''):
370 """Get the widget info text for a certain message state and trust. 370 """Get the widget info text for a certain message state and trust.
371 371
372 @param state (str): message state 372 @param state (unicode): message state
373 @param trust (str): trust 373 @param trust (unicode): trust
374 @return: str 374 @return: unicode
375 """ 375 """
376 if not state: 376 if not state:
377 state = OTR_MSG_STATES.keys()[0] 377 state = OTR_MSG_STATES.keys()[0]
378 return OTR_MSG_STATES[state][1 if trust else 0] 378 return OTR_MSG_STATES[state][1 if trust else 0]
379 379
490 return True 490 return True
491 491
492 def endSession(self, other_jid, profile, finish=False): 492 def endSession(self, other_jid, profile, finish=False):
493 """Finish or disconnect an OTR session 493 """Finish or disconnect an OTR session
494 494
495 @param other_jid (jid.JID): str 495 @param other_jid (jid.JID): contact JID
496 @param finish: if True, finish the session but do not disconnect it 496 @param finish: if True, finish the session but do not disconnect it
497 @return: True if the session has been finished or disconnected, False if there was nothing to do 497 @return: True if the session has been finished or disconnected, False if there was nothing to do
498 """ 498 """
499 def cb(other_jid): 499 def cb(other_jid):
500 def not_available(): 500 def not_available():