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.__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:
|
||||
|
|
Loading…
Reference in New Issue