Commit fc8c056e authored by Philipp Hörist's avatar Philipp Hörist

Detect nbxmpp supported encryptions

- Better handle logging for gnupg
parent fa710524
Pipeline #3032 failed with stages
in 3 minutes and 33 seconds
......@@ -9,6 +9,8 @@ Option.__new__.__defaults__ = (None,) * len(Option._fields) # type: ignore
DialogButton = namedtuple('DialogButton', 'text callback action')
DialogButton.__new__.__defaults__ = (None, None) # type: ignore
EncryptionData = namedtuple('EncryptionData', 'additional_data')
EncryptionData.__new__.__defaults__ = (None,) # type: ignore
@unique
class OptionKind(IntEnum):
......
......@@ -25,7 +25,6 @@ from gajim.common import app
if app.is_installed('GPG'):
import gnupg
gnupg.logger = logging.getLogger('gajim.c.gnupg')
class GnuPG(gnupg.GPG):
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.setLevel(logging.WARNING)
root_log.addHandler(consoleloghandler)
root_log.propagate = False
# handle nbxmpp logs too
root_log = logging.getLogger('nbxmpp')
root_log.setLevel(logging.WARNING)
root_log.addHandler(consoleloghandler)
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):
parseAndSetLogLevels(loglevels_string)
......
......@@ -175,13 +175,17 @@ class Message:
event = MessageReceivedEvent(None, **event_attr)
app.nec.push_incoming_event(event)
app.plugin_manager.extension_point(
'decrypt', self._con, event, self._on_message_decrypted)
if not event.encrypted:
eme = parse_eme(event.stanza)
if eme is not None:
event.msgtxt = eme
if properties.is_encrypted:
event.additional_data['encrypted'] = properties.encrypted.additional_data
self._on_message_decrypted(event)
else:
app.plugin_manager.extension_point(
'decrypt', self._con, event, self._on_message_decrypted)
if not event.encrypted:
eme = parse_eme(event.stanza)
if eme is not None:
event.msgtxt = eme
self._on_message_decrypted(event)
def _on_message_decrypted(self, event):
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment