Detect nbxmpp supported encryptions
- Better handle logging for gnupg
This commit is contained in:
parent
fa71052464
commit
fc8c056eff
|
@ -9,6 +9,8 @@ Option.__new__.__defaults__ = (None,) * len(Option._fields) # type: ignore
|
||||||
DialogButton = namedtuple('DialogButton', 'text callback action')
|
DialogButton = namedtuple('DialogButton', 'text callback action')
|
||||||
DialogButton.__new__.__defaults__ = (None, None) # type: ignore
|
DialogButton.__new__.__defaults__ = (None, None) # type: ignore
|
||||||
|
|
||||||
|
EncryptionData = namedtuple('EncryptionData', 'additional_data')
|
||||||
|
EncryptionData.__new__.__defaults__ = (None,) # type: ignore
|
||||||
|
|
||||||
@unique
|
@unique
|
||||||
class OptionKind(IntEnum):
|
class OptionKind(IntEnum):
|
||||||
|
|
|
@ -25,7 +25,6 @@ from gajim.common import app
|
||||||
|
|
||||||
if app.is_installed('GPG'):
|
if app.is_installed('GPG'):
|
||||||
import gnupg
|
import gnupg
|
||||||
gnupg.logger = logging.getLogger('gajim.c.gnupg')
|
|
||||||
|
|
||||||
class GnuPG(gnupg.GPG):
|
class GnuPG(gnupg.GPG):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -148,18 +148,21 @@ def init():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# fake the root logger so we have 'gajim' root name instead of 'root'
|
|
||||||
root_log = logging.getLogger('gajim')
|
root_log = logging.getLogger('gajim')
|
||||||
root_log.setLevel(logging.WARNING)
|
root_log.setLevel(logging.WARNING)
|
||||||
root_log.addHandler(consoleloghandler)
|
root_log.addHandler(consoleloghandler)
|
||||||
root_log.propagate = False
|
root_log.propagate = False
|
||||||
|
|
||||||
# handle nbxmpp logs too
|
|
||||||
root_log = logging.getLogger('nbxmpp')
|
root_log = logging.getLogger('nbxmpp')
|
||||||
root_log.setLevel(logging.WARNING)
|
root_log.setLevel(logging.WARNING)
|
||||||
root_log.addHandler(consoleloghandler)
|
root_log.addHandler(consoleloghandler)
|
||||||
root_log.propagate = False
|
root_log.propagate = False
|
||||||
|
|
||||||
|
root_log = logging.getLogger('gnupg')
|
||||||
|
root_log.setLevel(logging.WARNING)
|
||||||
|
root_log.addHandler(consoleloghandler)
|
||||||
|
root_log.propagate = False
|
||||||
|
|
||||||
def set_loglevels(loglevels_string):
|
def set_loglevels(loglevels_string):
|
||||||
parseAndSetLogLevels(loglevels_string)
|
parseAndSetLogLevels(loglevels_string)
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,10 @@ class Message:
|
||||||
event = MessageReceivedEvent(None, **event_attr)
|
event = MessageReceivedEvent(None, **event_attr)
|
||||||
app.nec.push_incoming_event(event)
|
app.nec.push_incoming_event(event)
|
||||||
|
|
||||||
|
if properties.is_encrypted:
|
||||||
|
event.additional_data['encrypted'] = properties.encrypted.additional_data
|
||||||
|
self._on_message_decrypted(event)
|
||||||
|
else:
|
||||||
app.plugin_manager.extension_point(
|
app.plugin_manager.extension_point(
|
||||||
'decrypt', self._con, event, self._on_message_decrypted)
|
'decrypt', self._con, event, self._on_message_decrypted)
|
||||||
if not event.encrypted:
|
if not event.encrypted:
|
||||||
|
|
Loading…
Reference in New Issue