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