comparison src/plugins/plugin_sec_otr.py @ 1147:736f1dd6e142

plugin OTR: two small fixes
author souliane <souliane@mailoo.org>
date Mon, 01 Sep 2014 16:11:45 +0200
parents 1ac5ea74dbdf
children 652cd93dfdb4
comparison
equal deleted inserted replaced
1146:1ac5ea74dbdf 1147:736f1dd6e142
312 else: 312 else:
313 otrctx.setCurrentTrust('') 313 otrctx.setCurrentTrust('')
314 note_msg = _("Your correspondant {correspondent} is now UNTRUSTED") 314 note_msg = _("Your correspondant {correspondent} is now UNTRUSTED")
315 note = xml_tools.XMLUI(C.XMLUI_DIALOG, dialog_opt = { 315 note = xml_tools.XMLUI(C.XMLUI_DIALOG, dialog_opt = {
316 C.XMLUI_DATA_TYPE: C.XMLUI_DIALOG_NOTE, 316 C.XMLUI_DATA_TYPE: C.XMLUI_DIALOG_NOTE,
317 C.XMLUI_DATA_MESS: note_msg.format(correspondent=otrctx.user.name)} 317 C.XMLUI_DATA_MESS: note_msg.format(correspondent=otrctx.peer)}
318 ) 318 )
319 return {'xmlui': note.toXml()} 319 return {'xmlui': note.toXml()}
320 320
321 submit_id = self.host.registerCallback(setTrust, with_data=True, one_shot=True) 321 submit_id = self.host.registerCallback(setTrust, with_data=True, one_shot=True)
322 trusted = bool(otrctx.getCurrentTrust()) 322 trusted = bool(otrctx.getCurrentTrust())
354 if C.bool(data['answer']): 354 if C.bool(data['answer']):
355 # we end all sessions 355 # we end all sessions
356 for context in ctxMng.contexts.values(): 356 for context in ctxMng.contexts.values():
357 if context.state not in (potr.context.STATE_FINISHED, potr.context.STATE_PLAINTEXT): 357 if context.state not in (potr.context.STATE_FINISHED, potr.context.STATE_PLAINTEXT):
358 context.disconnect() 358 context.disconnect()
359 ctxMng.account.privkey = None 359 ctxMng.account.privkey = None
360 ctxMng.account.getPrivkey() # as account.privkey is None, getPrivkey will generate a new key, and save it 360 ctxMng.account.getPrivkey() # as account.privkey is None, getPrivkey will generate a new key, and save it
361 return {'xmlui': xml_tools.note(_("Your private key has been dropped")).toXml()} 361 return {'xmlui': xml_tools.note(_("Your private key has been dropped")).toXml()}
362 return {} 362 return {}
363 363
364 submit_id = self.host.registerCallback(dropKey, with_data=True, one_shot=True) 364 submit_id = self.host.registerCallback(dropKey, with_data=True, one_shot=True)
365 365