changeset 816a2688be12 in /home/hg/repos/gajim-plugins
author: lovetox <forenjunkie(a)chello.at>
branches:
details:gajim-plugins?cmd=changeset;node=816a2688be12
description: Replace deprecated log.warn methode
diffstat:
omemo/__init__.py | 4 ++--
omemo/omemo/state.py | 6 +++---
omemo/xmpp.py | 50 +++++++++++++++++++++++++-------------------------
3 files changed, 30 insertions(+), 30 deletions(-)
diffs (228 lines):
diff -r ea2d19f314b2 -r 816a2688be12 omemo/__init__.py
--- a/omemo/__init__.py Sat Aug 20 20:19:55 2016 +0200
+++ b/omemo/__init__.py Sat Aug 20 20:22:10 2016 +0200
@@ -412,7 +412,7 @@
omemo_enabled, state)
self.ui_list[account][contact_jid].new_fingerprints_available()
else:
- log.warn(account + " => No devices for " + contact_jid)
+ log.warning(account + " => No devices for " + contact_jid)
@log_calls('OmemoPlugin')
def disconnect_ui(self, chat_control):
@@ -537,7 +537,7 @@
"""
bundle_dict = unpack_device_bundle(stanza, device_id)
if not bundle_dict:
- log.warn('Failed requesting a bundle')
+ log.warning('Failed requesting a bundle')
return
if state.build_session(recipient_id, device_id, bundle_dict):
diff -r ea2d19f314b2 -r 816a2688be12 omemo/omemo/state.py
--- a/omemo/omemo/state.py Sat Aug 20 20:19:55 2016 +0200
+++ b/omemo/omemo/state.py Sat Aug 20 20:22:10 2016 +0200
@@ -230,7 +230,7 @@
self.get_session_cipher(jid, dev)
session_ciphers = self.session_ciphers[jid]
if not session_ciphers:
- log.warn('No session ciphers for ' + jid)
+ log.warning('No session ciphers for ' + jid)
return
# Encrypt the message key with for each of receivers devices
@@ -242,7 +242,7 @@
log.debug('Skipped Device because Trust is: ' +
str(self.isTrusted(cipher)))
except:
- log.warn('Failed to find key for device ' + str(rid))
+ log.warning('Failed to find key for device ' + str(rid))
if len(encrypted_keys) == 0:
log_msg = 'Encrypted keys empty'
@@ -260,7 +260,7 @@
log.debug('Skipped own Device because Trust is: ' +
str(self.isTrusted(cipher)))
except:
- log.warn('Failed to find key for device ' + str(dev))
+ log.warning('Failed to find key for device ' + str(dev))
payload = encrypt(key, iv, plaintext)
diff -r ea2d19f314b2 -r 816a2688be12 omemo/xmpp.py
--- a/omemo/xmpp.py Sat Aug 20 20:19:55 2016 +0200
+++ b/omemo/xmpp.py Sat Aug 20 20:22:10 2016 +0200
@@ -150,37 +150,37 @@
def unpack_device_bundle(bundle, device_id):
pubsub = bundle.getTag('pubsub', namespace=NS_PUBSUB)
if not pubsub:
- log.warn('OMEMO device bundle has no pubsub node')
+ log.warning('OMEMO device bundle has no pubsub node')
return
items = pubsub.getTag('items', attrs={'node': NS_BUNDLES + str(device_id)})
if not items:
- log.warn('OMEMO device bundle has no items node')
+ log.warning('OMEMO device bundle has no items node')
return
item = items.getTag('item', namespace=NS_PUBSUB)
if not item:
- log.warn('OMEMO device bundle has no item node')
+ log.warning('OMEMO device bundle has no item node')
return
bundle = item.getTag('bundle', namespace=NS_OMEMO)
if not bundle:
- log.warn('OMEMO device bundle has no bundle node')
+ log.warning('OMEMO device bundle has no bundle node')
return
signed_prekey_node = bundle.getTag('signedPreKeyPublic',
namespace=NS_OMEMO)
if not signed_prekey_node:
- log.warn('OMEMO device bundle has no signedPreKeyPublic node')
+ log.warning('OMEMO device bundle has no signedPreKeyPublic node')
return
result = {}
result['signedPreKeyPublic'] = decode_data(signed_prekey_node)
if not result['signedPreKeyPublic']:
- log.warn('OMEMO device bundle has no signedPreKeyPublic data')
+ log.warning('OMEMO device bundle has no signedPreKeyPublic data')
return
if not signed_prekey_node.getAttr('signedPreKeyId'):
- log.warn('OMEMO device bundle has no signedPreKeyId')
+ log.warning('OMEMO device bundle has no signedPreKeyId')
return
result['signedPreKeyId'] = int(signed_prekey_node.getAttr(
'signedPreKeyId'))
@@ -188,33 +188,33 @@
signed_signature_node = bundle.getTag('signedPreKeySignature',
namespace=NS_OMEMO)
if not signed_signature_node:
- log.warn('OMEMO device bundle has no signedPreKeySignature node')
+ log.warning('OMEMO device bundle has no signedPreKeySignature node')
return
result['signedPreKeySignature'] = decode_data(signed_signature_node)
if not result['signedPreKeySignature']:
- log.warn('OMEMO device bundle has no signedPreKeySignature data')
+ log.warning('OMEMO device bundle has no signedPreKeySignature data')
return
identity_key_node = bundle.getTag('identityKey', namespace=NS_OMEMO)
if not identity_key_node:
- log.warn('OMEMO device bundle has no identityKey node')
+ log.warning('OMEMO device bundle has no identityKey node')
return
result['identityKey'] = decode_data(identity_key_node)
if not result['identityKey']:
- log.warn('OMEMO device bundle has no identityKey data')
+ log.warning('OMEMO device bundle has no identityKey data')
return
prekeys = bundle.getTag('prekeys', namespace=NS_OMEMO)
if not prekeys or len(prekeys.getChildren()) == 0:
- log.warn('OMEMO device bundle has no prekys')
+ log.warning('OMEMO device bundle has no prekys')
return
picked_key_node = random.SystemRandom().choice(prekeys.getChildren())
if not picked_key_node.getAttr('preKeyId'):
- log.warn('OMEMO PreKey has no id set')
+ log.warning('OMEMO PreKey has no id set')
return
result['preKeyId'] = int(picked_key_node.getAttr('preKeyId'))
@@ -229,28 +229,28 @@
""" Unpacks the encrypted node, decodes the data and returns a msg_dict.
"""
if not encrypted_node.getNamespace() == NS_OMEMO:
- log.warn("Encrypted node with wrong NS")
+ log.warning("Encrypted node with wrong NS")
return
header_node = encrypted_node.getTag('header', namespace=NS_OMEMO)
if not header_node:
- log.warn("OMEMO message without header")
+ log.warning("OMEMO message without header")
return
if not header_node.getAttr('sid'):
- log.warn("OMEMO message without sid in header")
+ log.warning("OMEMO message without sid in header")
return
sid = int(header_node.getAttr('sid'))
iv_node = header_node.getTag('iv', namespace=NS_OMEMO)
if not iv_node:
- log.warn("OMEMO message without iv")
+ log.warning("OMEMO message without iv")
return
iv = decode_data(iv_node)
if not iv:
- log.warn("OMEMO message without iv data")
+ log.warning("OMEMO message without iv data")
payload_node = encrypted_node.getTag('payload', namespace=NS_OMEMO)
payload = None
@@ -259,18 +259,18 @@
key_nodes = header_node.getTags('key')
if len(key_nodes) < 1:
- log.warn("OMEMO message without keys")
+ log.warning("OMEMO message without keys")
return
keys = {}
for kn in key_nodes:
rid = kn.getAttr('rid')
if not rid:
- log.warn('Omemo key without rid')
+ log.warning('Omemo key without rid')
continue
if not kn.getData():
- log.warn('Omemo key without data')
+ log.warning('Omemo key without data')
continue
keys[int(rid)] = decode_data(kn)
@@ -297,7 +297,7 @@
result = []
if not event_node:
- log.warn(account + ' => Device list update event node empty!')
+ log.warning(account + ' => Device list update event node empty!')
return result
items = event_node.getTag('items', {'node': NS_DEVICE_LIST})
@@ -309,7 +309,7 @@
list_node = items.getChildren()[0].getTag('list')
if not list_node or len(list_node.getChildren()) == 0:
- log.warn(account + ' => Device list update list node empty!')
+ log.warning(account + ' => Device list update list node empty!')
return result
devices_nodes = list_node.getChildren()
@@ -327,12 +327,12 @@
data = node.getData()
if not data:
- log.warn("No node data")
+ log.warning("No node data")
return
try:
return b64decode(data)
except:
- log.warn('b64decode broken')
+ log.warning('b64decode broken')
return