[pgp] Fix filetransfer
This commit is contained in:
@@ -27,12 +27,15 @@ import queue
|
|||||||
import nbxmpp
|
import nbxmpp
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
from gajim import dialogs
|
|
||||||
from gajim.common import app
|
from gajim.common import app
|
||||||
from gajim.common.connection_handlers_events import MessageNotSentEvent
|
from gajim.common.connection_handlers_events import MessageNotSentEvent
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
from gajim.plugins.plugins_i18n import _
|
from gajim.plugins.plugins_i18n import _
|
||||||
|
|
||||||
|
from gajim.gtk.dialogs import ErrorDialog
|
||||||
|
from gajim.gtk.dialogs import InformationDialog
|
||||||
|
from gajim.gtk.dialogs import YesNoDialog
|
||||||
|
|
||||||
log = logging.getLogger('gajim.plugin_system.oldpgp')
|
log = logging.getLogger('gajim.plugin_system.oldpgp')
|
||||||
|
|
||||||
ERROR_MSG = ''
|
ERROR_MSG = ''
|
||||||
@@ -108,19 +111,19 @@ class OldPGPPlugin(GajimPlugin):
|
|||||||
key_id = chat_control.contact.keyID
|
key_id = chat_control.contact.keyID
|
||||||
transient = chat_control.parent_win.window
|
transient = chat_control.parent_win.window
|
||||||
authenticated, info = check_state(key_id, account)
|
authenticated, info = check_state(key_id, account)
|
||||||
dialogs.InformationDialog(authenticated, info, transient)
|
InformationDialog(authenticated, info, transient)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _before_sendmessage(chat_control):
|
def _before_sendmessage(chat_control):
|
||||||
account = chat_control.account
|
account = chat_control.account
|
||||||
if not chat_control.contact.keyID:
|
if not chat_control.contact.keyID:
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_('No OpenPGP key assigned'),
|
_('No OpenPGP key assigned'),
|
||||||
_('No OpenPGP key is assigned to this contact. So you cannot '
|
_('No OpenPGP key is assigned to this contact. So you cannot '
|
||||||
'encrypt messages with OpenPGP.'))
|
'encrypt messages with OpenPGP.'))
|
||||||
chat_control.sendmessage = False
|
chat_control.sendmessage = False
|
||||||
elif not app.config.get_per('accounts', account, 'keyid'):
|
elif not app.config.get_per('accounts', account, 'keyid'):
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(
|
||||||
_('No OpenPGP key assigned'),
|
_('No OpenPGP key assigned'),
|
||||||
_('No OpenPGP key is assigned to your account. So you cannot '
|
_('No OpenPGP key is assigned to your account. So you cannot '
|
||||||
'encrypt messages with OpenPGP.'))
|
'encrypt messages with OpenPGP.'))
|
||||||
@@ -213,7 +216,7 @@ class OldPGPPlugin(GajimPlugin):
|
|||||||
self._finished_encrypt(
|
self._finished_encrypt(
|
||||||
obj, msgenc=msgenc, error=error, conn=conn)
|
obj, msgenc=msgenc, error=error, conn=conn)
|
||||||
|
|
||||||
dialogs.YesNoDialog(
|
YesNoDialog(
|
||||||
_('Untrusted OpenPGP key'),
|
_('Untrusted OpenPGP key'),
|
||||||
_('The OpenPGP key used to encrypt this chat is not '
|
_('The OpenPGP key used to encrypt this chat is not '
|
||||||
'trusted. Do you really want to encrypt this '
|
'trusted. Do you really want to encrypt this '
|
||||||
@@ -269,7 +272,7 @@ class OldPGPPlugin(GajimPlugin):
|
|||||||
|
|
||||||
def _encrypt_file_thread(self, file, account, callback):
|
def _encrypt_file_thread(self, file, account, callback):
|
||||||
my_key_id = app.config.get_per('accounts', account, 'keyid')
|
my_key_id = app.config.get_per('accounts', account, 'keyid')
|
||||||
key_list = [file.control.contact.keyID, my_key_id]
|
key_list = [file.contact.keyID, my_key_id]
|
||||||
|
|
||||||
encrypted = self.get_gpg(account).encrypt_file(file.get_data(), key_list)
|
encrypted = self.get_gpg(account).encrypt_file(file.get_data(), key_list)
|
||||||
if not encrypted:
|
if not encrypted:
|
||||||
@@ -286,8 +289,7 @@ class OldPGPPlugin(GajimPlugin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _on_file_encryption_error(file, error):
|
def _on_file_encryption_error(file, error):
|
||||||
dialogs.ErrorDialog(
|
ErrorDialog(_('Error'), error)
|
||||||
_('Error'), error, transient_for=file.control.parent_win.window)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cleanup_stanza(obj):
|
def cleanup_stanza(obj):
|
||||||
|
|||||||
Reference in New Issue
Block a user