remove event for full jid and bar jid when we scroll conversation window. Fixes #4243
This commit is contained in:
parent
6df6e9ddf1
commit
c71269c9ec
1 changed files with 18 additions and 22 deletions
|
@ -73,20 +73,20 @@ class StanzaSession(object):
|
||||||
def remove_events(self, types):
|
def remove_events(self, types):
|
||||||
any_removed = False
|
any_removed = False
|
||||||
|
|
||||||
for event in gajim.events.get_events(self.conn.name, self.jid,
|
for j in (self.jid, self.jid.getStripped()):
|
||||||
types=types):
|
for event in gajim.events.get_events(self.conn.name, j, types=types):
|
||||||
# the event wasn't in this session
|
# the event wasn't in this session
|
||||||
if (event.type_ == 'chat' and event.parameters[8] != self) or \
|
if (event.type_ == 'chat' and event.parameters[8] != self) or \
|
||||||
(event.type_ == 'printed_chat' and event.parameters[0].session != \
|
(event.type_ == 'printed_chat' and event.parameters[0].session != \
|
||||||
self):
|
self):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# events.remove_events returns True when there were no events
|
# events.remove_events returns True when there were no events
|
||||||
# for some reason
|
# for some reason
|
||||||
r = gajim.events.remove_events(self.conn.name, self.jid, event)
|
r = gajim.events.remove_events(self.conn.name, j, event)
|
||||||
|
|
||||||
if not r:
|
if not r:
|
||||||
any_removed = True
|
any_removed = True
|
||||||
|
|
||||||
return any_removed
|
return any_removed
|
||||||
|
|
||||||
|
@ -340,8 +340,7 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
try:
|
try:
|
||||||
parsed = xmpp.Node(node='<node>' + plaintext + '</node>')
|
parsed = xmpp.Node(node='<node>' + plaintext + '</node>')
|
||||||
except:
|
except:
|
||||||
raise exceptions.DecryptionError,
|
raise exceptions.DecryptionError, 'decrypted <data/> not parseable as XML'
|
||||||
'decrypted <data/> not parseable as XML'
|
|
||||||
|
|
||||||
for child in parsed.getChildren():
|
for child in parsed.getChildren():
|
||||||
stanza.addChild(node=child)
|
stanza.addChild(node=child)
|
||||||
|
@ -375,8 +374,7 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
m_o_calculated = self.hmac(self.km_o, crypto.encode_mpi(self.c_o) + id_o)
|
m_o_calculated = self.hmac(self.km_o, crypto.encode_mpi(self.c_o) + id_o)
|
||||||
|
|
||||||
if m_o_calculated != m_o:
|
if m_o_calculated != m_o:
|
||||||
raise exceptions.NegotiationError,
|
raise exceptions.NegotiationError, 'calculated m_%s differs from received m_%s' % (i_o, i_o)
|
||||||
'calculated m_%s differs from received m_%s' % (i_o, i_o)
|
|
||||||
|
|
||||||
if i_o == 'a' and self.sas_algs == 'sas28x5':
|
if i_o == 'a' and self.sas_algs == 'sas28x5':
|
||||||
# we don't need to calculate this if there's a verified retained secret
|
# we don't need to calculate this if there's a verified retained secret
|
||||||
|
@ -429,12 +427,10 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
hash = crypto.sha256(mac_o_calculated)
|
hash = crypto.sha256(mac_o_calculated)
|
||||||
|
|
||||||
if not eir_pubkey.verify(hash, signature):
|
if not eir_pubkey.verify(hash, signature):
|
||||||
raise exceptions.NegotiationError,
|
raise exceptions.NegotiationError, 'public key signature verification failed!'
|
||||||
'public key signature verification failed!'
|
|
||||||
|
|
||||||
elif mac_o_calculated != mac_o:
|
elif mac_o_calculated != mac_o:
|
||||||
raise exceptions.NegotiationError,
|
raise exceptions.NegotiationError, 'calculated mac_%s differs from received mac_%s' % (i_o, i_o)
|
||||||
'calculated mac_%s differs from received mac_%s' % (i_o, i_o)
|
|
||||||
|
|
||||||
def make_identity(self, form, dh_i):
|
def make_identity(self, form, dh_i):
|
||||||
if self.negotiated['send_pubkey']:
|
if self.negotiated['send_pubkey']:
|
||||||
|
@ -446,7 +442,7 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
fields)
|
fields)
|
||||||
|
|
||||||
pubkey_s = '<RSAKeyValue xmlns="http://www.w3.org/2000/09/xmldsig#"'
|
pubkey_s = '<RSAKeyValue xmlns="http://www.w3.org/2000/09/xmldsig#"'
|
||||||
'><Modulus>%s</Modulus><Exponent>%s</Exponent></RSAKeyValue>' % \
|
'><Modulus>%s</Modulus><Exponent>%s</Exponent></RSAKeyValue>' % \
|
||||||
tuple(cb_fields)
|
tuple(cb_fields)
|
||||||
else:
|
else:
|
||||||
pubkey_s = ''
|
pubkey_s = ''
|
||||||
|
@ -463,7 +459,7 @@ class EncryptedStanzaSession(StanzaSession):
|
||||||
signature = self.sign(mac_s)
|
signature = self.sign(mac_s)
|
||||||
|
|
||||||
sign_s = '<SignatureValue xmlns="http://www.w3.org/2000/09/xmldsig#">'
|
sign_s = '<SignatureValue xmlns="http://www.w3.org/2000/09/xmldsig#">'
|
||||||
'%s</SignatureValue>' % base64.b64encode(signature)
|
'%s</SignatureValue>' % base64.b64encode(signature)
|
||||||
|
|
||||||
if self.negotiated['send_pubkey'] == 'hash':
|
if self.negotiated['send_pubkey'] == 'hash':
|
||||||
b64ed = base64.b64encode(self.hash(pubkey_s))
|
b64ed = base64.b64encode(self.hash(pubkey_s))
|
||||||
|
|
Loading…
Add table
Reference in a new issue