core (memory/encryption): encryption session are now restored on client connection
This commit is contained in:
parent
e754d16000
commit
900daa7ad9
1 changed files with 61 additions and 34 deletions
|
|
@ -169,12 +169,12 @@ class Context(potr.context.Context):
|
|||
feedback = _("/!\\ conversation with %(other_jid)s is now UNENCRYPTED") % {
|
||||
"other_jid": self.peer.full()
|
||||
}
|
||||
d = client.encryption.stop(self.peer, NS_OTR)
|
||||
d = defer.ensureDeferred(client.encryption.stop(self.peer, NS_OTR))
|
||||
d.addCallback(self.stopCb, feedback=feedback)
|
||||
d.addErrback(self.stopEb)
|
||||
return
|
||||
elif state == potr.context.STATE_ENCRYPTED:
|
||||
client.encryption.start(self.peer, NS_OTR)
|
||||
defer.ensureDeferred(client.encryption.start(self.peer, NS_OTR))
|
||||
try:
|
||||
trusted = self.isTrusted()
|
||||
except TypeError:
|
||||
|
|
@ -201,7 +201,7 @@ class Context(potr.context.Context):
|
|||
feedback = D_("OTR conversation with {other_jid} is FINISHED").format(
|
||||
other_jid=self.peer.full()
|
||||
)
|
||||
d = client.encryption.stop(self.peer, NS_OTR)
|
||||
d = defer.ensureDeferred(client.encryption.stop(self.peer, NS_OTR))
|
||||
d.addCallback(self.stopCb, feedback=feedback)
|
||||
d.addErrback(self.stopEb)
|
||||
return
|
||||
|
|
@ -808,7 +808,7 @@ class OTR(object):
|
|||
otrctx = client._otr_context_manager.getContextForUser(to_jid)
|
||||
|
||||
if otrctx.state != potr.context.STATE_PLAINTEXT:
|
||||
client.encryption.start(to_jid, NS_OTR)
|
||||
defer.ensureDeferred(client.encryption.start(to_jid, NS_OTR))
|
||||
client.encryption.setEncryptionFlag(mess_data)
|
||||
if not mess_data["to"].resource:
|
||||
# if not resource was given, we force it here
|
||||
|
|
|
|||
Loading…
Reference in a new issue