Adapt to nbxmpp changes
This commit is contained in:
@@ -106,7 +106,7 @@ class AntiSpam(BaseModule):
|
|||||||
properties.is_mam_message):
|
properties.is_mam_message):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
msg_from = properties.jid if is_muc_pm else properties.jid.getBare()
|
msg_from = properties.jid if is_muc_pm else properties.jid.bare
|
||||||
|
|
||||||
if msg_from in self._contacted_jids:
|
if msg_from in self._contacted_jids:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ class LengthNotifierPlugin(GajimPlugin):
|
|||||||
except Exception as error:
|
except Exception as error:
|
||||||
log.debug('Error parsing JID: %s (%s)' % (error, allowed_jid))
|
log.debug('Error parsing JID: %s (%s)' % (error, allowed_jid))
|
||||||
continue
|
continue
|
||||||
if address.isDomain:
|
if address.is_domain:
|
||||||
if current_jid.getDomain() == address:
|
if current_jid.domain == address:
|
||||||
log.debug('Add counter for Domain %s' % address)
|
log.debug('Add counter for Domain %s' % address)
|
||||||
return True
|
return True
|
||||||
if current_jid == address:
|
if current_jid == address:
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class OMEMO(BaseModule):
|
|||||||
|
|
||||||
self.available = True
|
self.available = True
|
||||||
|
|
||||||
self._own_jid = self._con.get_own_jid().getStripped()
|
self._own_jid = self._con.get_own_jid().bare
|
||||||
self._backend = self._get_backend()
|
self._backend = self._get_backend()
|
||||||
|
|
||||||
self._omemo_groupchats = set()
|
self._omemo_groupchats = set()
|
||||||
@@ -114,7 +114,7 @@ class OMEMO(BaseModule):
|
|||||||
|
|
||||||
def get_own_jid(self, stripped=False):
|
def get_own_jid(self, stripped=False):
|
||||||
if stripped:
|
if stripped:
|
||||||
return self._con.get_own_jid().getStripped()
|
return self._con.get_own_jid().bare
|
||||||
return self._con.get_own_jid()
|
return self._con.get_own_jid()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -211,7 +211,7 @@ class OMEMO(BaseModule):
|
|||||||
from_jid = self._process_muc_message(properties)
|
from_jid = self._process_muc_message(properties)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
from_jid = properties.jid.getBare()
|
from_jid = properties.jid.bare
|
||||||
|
|
||||||
if from_jid is None:
|
if from_jid is None:
|
||||||
return
|
return
|
||||||
@@ -259,15 +259,15 @@ class OMEMO(BaseModule):
|
|||||||
'trust': GajimTrust[trust.name]})
|
'trust': GajimTrust[trust.name]})
|
||||||
|
|
||||||
def _process_muc_message(self, properties):
|
def _process_muc_message(self, properties):
|
||||||
room_jid = properties.jid.getBare()
|
room_jid = properties.jid.bare
|
||||||
resource = properties.jid.getResource()
|
resource = properties.jid.resource()
|
||||||
if properties.muc_ofrom is not None:
|
if properties.muc_ofrom is not None:
|
||||||
# History Message from MUC
|
# History Message from MUC
|
||||||
return properties.muc_ofrom.getBare()
|
return properties.muc_ofrom.bare
|
||||||
|
|
||||||
contact = app.contacts.get_gc_contact(self._account, room_jid, resource)
|
contact = app.contacts.get_gc_contact(self._account, room_jid, resource)
|
||||||
if contact is not None:
|
if contact is not None:
|
||||||
return JID(contact.jid).getBare()
|
return JID(contact.jid).bare
|
||||||
|
|
||||||
self._log.info('Groupchat: Last resort trying to find SID in DB')
|
self._log.info('Groupchat: Last resort trying to find SID in DB')
|
||||||
from_jid = self.backend.storage.getJidFromDevice(properties.omemo.sid)
|
from_jid = self.backend.storage.getJidFromDevice(properties.omemo.sid)
|
||||||
@@ -284,8 +284,8 @@ class OMEMO(BaseModule):
|
|||||||
self._log.warning('Received MAM Message which can '
|
self._log.warning('Received MAM Message which can '
|
||||||
'not be mapped to a real jid')
|
'not be mapped to a real jid')
|
||||||
return
|
return
|
||||||
return properties.muc_user.jid.getBare()
|
return properties.muc_user.jid.bare
|
||||||
return properties.from_.getBare()
|
return properties.from_.bare
|
||||||
|
|
||||||
def _on_muc_user_presence(self, _con, _stanza, properties):
|
def _on_muc_user_presence(self, _con, _stanza, properties):
|
||||||
if properties.type == PresenceType.ERROR:
|
if properties.type == PresenceType.ERROR:
|
||||||
@@ -294,13 +294,13 @@ class OMEMO(BaseModule):
|
|||||||
if properties.is_muc_destroyed:
|
if properties.is_muc_destroyed:
|
||||||
return
|
return
|
||||||
|
|
||||||
room = properties.jid.getBare()
|
room = properties.jid.bare
|
||||||
|
|
||||||
if properties.muc_user is None or properties.muc_user.jid is None:
|
if properties.muc_user is None or properties.muc_user.jid is None:
|
||||||
# No real jid found
|
# No real jid found
|
||||||
return
|
return
|
||||||
|
|
||||||
jid = properties.muc_user.jid.getBare()
|
jid = properties.muc_user.jid.bare
|
||||||
if properties.muc_user.affiliation in (Affiliation.OUTCAST,
|
if properties.muc_user.affiliation in (Affiliation.OUTCAST,
|
||||||
Affiliation.NONE):
|
Affiliation.NONE):
|
||||||
self.backend.remove_muc_member(room, jid)
|
self.backend.remove_muc_member(room, jid)
|
||||||
@@ -486,7 +486,7 @@ class OMEMO(BaseModule):
|
|||||||
self._process_devicelist_update(str(properties.jid), devicelist)
|
self._process_devicelist_update(str(properties.jid), devicelist)
|
||||||
|
|
||||||
def _process_devicelist_update(self, jid, devicelist):
|
def _process_devicelist_update(self, jid, devicelist):
|
||||||
own_devices = jid is None or self._con.get_own_jid().bareMatch(jid)
|
own_devices = jid is None or self._con.get_own_jid().bare_match(jid)
|
||||||
if own_devices:
|
if own_devices:
|
||||||
jid = self._own_jid
|
jid = self._own_jid
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class PythonGnuPG(gnupg.GPG):
|
|||||||
def __init__(self, jid, gnupghome):
|
def __init__(self, jid, gnupghome):
|
||||||
gnupg.GPG.__init__(self, gpgbinary='gpg', gnupghome=str(gnupghome))
|
gnupg.GPG.__init__(self, gpgbinary='gpg', gnupghome=str(gnupghome))
|
||||||
|
|
||||||
self._jid = jid.getBare()
|
self._jid = jid.bare
|
||||||
self._own_fingerprint = None
|
self._own_fingerprint = None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class OpenPGP(BaseModule):
|
|||||||
|
|
||||||
self.own_jid = self._con.get_own_jid()
|
self.own_jid = self._con.get_own_jid()
|
||||||
|
|
||||||
own_bare_jid = self.own_jid.getBare()
|
own_bare_jid = self.own_jid.bare
|
||||||
path = Path(configpaths.get('MY_DATA')) / 'openpgp' / own_bare_jid
|
path = Path(configpaths.get('MY_DATA')) / 'openpgp' / own_bare_jid
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
path.mkdir(mode=0o700, parents=True)
|
path.mkdir(mode=0o700, parents=True)
|
||||||
@@ -168,7 +168,7 @@ class OpenPGP(BaseModule):
|
|||||||
except (StanzaError, MalformedStanzaError) as error:
|
except (StanzaError, MalformedStanzaError) as error:
|
||||||
log.error('%s => Keylist query failed: %s',
|
log.error('%s => Keylist query failed: %s',
|
||||||
self._account, error)
|
self._account, error)
|
||||||
if self.own_jid.bareMatch(jid) and self._fingerprint is not None:
|
if self.own_jid.bare_match(jid) and self._fingerprint is not None:
|
||||||
self.set_keylist()
|
self.set_keylist()
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -180,11 +180,11 @@ class OpenPGP(BaseModule):
|
|||||||
log.warning('%s => Empty keylist received from %s',
|
log.warning('%s => Empty keylist received from %s',
|
||||||
self._account, from_jid)
|
self._account, from_jid)
|
||||||
self._contacts.process_keylist(self.own_jid, keylist)
|
self._contacts.process_keylist(self.own_jid, keylist)
|
||||||
if self.own_jid.bareMatch(from_jid) and self._fingerprint is not None:
|
if self.own_jid.bare_match(from_jid) and self._fingerprint is not None:
|
||||||
self.set_keylist()
|
self.set_keylist()
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.own_jid.bareMatch(from_jid):
|
if self.own_jid.bare_match(from_jid):
|
||||||
log.info('Received own keylist')
|
log.info('Received own keylist')
|
||||||
for key in keylist:
|
for key in keylist:
|
||||||
log.info(key.fingerprint)
|
log.info(key.fingerprint)
|
||||||
@@ -226,7 +226,7 @@ class OpenPGP(BaseModule):
|
|||||||
log.warning(payload)
|
log.warning(payload)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not any(map(self.own_jid.bareMatch, recipients)):
|
if not any(map(self.own_jid.bare_match, recipients)):
|
||||||
log.warning('to attr not valid')
|
log.warning('to attr not valid')
|
||||||
log.warning(signcrypt)
|
log.warning(signcrypt)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class KeyStore:
|
|||||||
self._log = log
|
self._log = log
|
||||||
self._account = account
|
self._account = account
|
||||||
|
|
||||||
own_bare_jid = own_jid.getBare()
|
own_bare_jid = own_jid.bare
|
||||||
path = Path(configpaths.get('PLUGINS_DATA')) / 'pgplegacy' / own_bare_jid
|
path = Path(configpaths.get('PLUGINS_DATA')) / 'pgplegacy' / own_bare_jid
|
||||||
if not path.exists():
|
if not path.exists():
|
||||||
path.mkdir(parents=True)
|
path.mkdir(parents=True)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class PGPLegacy(BaseModule):
|
|||||||
def _on_presence_received(self, _con, _stanza, properties):
|
def _on_presence_received(self, _con, _stanza, properties):
|
||||||
if properties.signed is None:
|
if properties.signed is None:
|
||||||
return
|
return
|
||||||
jid = properties.jid.getBare()
|
jid = properties.jid.bare
|
||||||
|
|
||||||
fingerprint = self._pgp.verify(properties.status, properties.signed)
|
fingerprint = self._pgp.verify(properties.status, properties.signed)
|
||||||
if fingerprint is None:
|
if fingerprint is None:
|
||||||
@@ -142,7 +142,7 @@ class PGPLegacy(BaseModule):
|
|||||||
if not properties.is_pgp_legacy or properties.from_muc:
|
if not properties.is_pgp_legacy or properties.from_muc:
|
||||||
return
|
return
|
||||||
|
|
||||||
from_jid = properties.jid.getBare()
|
from_jid = properties.jid.bare
|
||||||
self._log.info('Message received from: %s', from_jid)
|
self._log.info('Message received from: %s', from_jid)
|
||||||
|
|
||||||
payload = self._pgp.decrypt(properties.pgp_legacy)
|
payload = self._pgp.decrypt(properties.pgp_legacy)
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class TicTacToeSession():
|
|||||||
self.conn = conn
|
self.conn = conn
|
||||||
self.jid = jid
|
self.jid = jid
|
||||||
self.type_ = type_
|
self.type_ = type_
|
||||||
self.resource = jid.getResource()
|
self.resource = jid.resource()
|
||||||
|
|
||||||
if thread_id:
|
if thread_id:
|
||||||
self.received_thread_id = True
|
self.received_thread_id = True
|
||||||
|
|||||||
Reference in New Issue
Block a user