GPG -> OpenPGP. Fixes #7312

This commit is contained in:
Yann Leboulanger 2013-03-09 17:49:22 +01:00
parent 8b3b276e08
commit 77cd0f3310
6 changed files with 40 additions and 38 deletions

View File

@ -1644,7 +1644,7 @@ class ChatControl(ChatControlBase):
gajim.connections[self.account].USE_GPG: gajim.connections[self.account].USE_GPG:
self.gpg_is_active = True self.gpg_is_active = True
gajim.encrypted_chats[self.account].append(contact.jid) gajim.encrypted_chats[self.account].append(contact.jid)
msg = _('GPG encryption enabled') msg = _('OpenPGP encryption enabled')
ChatControlBase.print_conversation_line(self, msg, 'status', '', ChatControlBase.print_conversation_line(self, msg, 'status', '',
None) None)
@ -1652,8 +1652,9 @@ class ChatControl(ChatControlBase):
self.session.loggable = gajim.config.get_per('accounts', self.session.loggable = gajim.config.get_per('accounts',
self.account, 'log_encrypted_sessions') self.account, 'log_encrypted_sessions')
# GPG is always authenticated as we use GPG's WoT # GPG is always authenticated as we use GPG's WoT
self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active, self._show_lock_image(self.gpg_is_active, 'OpenPGP',
self.session and self.session.is_loggable(), True) self.gpg_is_active, self.session and self.session.is_loggable()
True)
self.update_ui() self.update_ui()
# restore previous conversation # restore previous conversation
@ -2186,9 +2187,9 @@ class ChatControl(ChatControlBase):
def _toggle_gpg(self): def _toggle_gpg(self):
if not self.gpg_is_active and not self.contact.keyID: if not self.gpg_is_active and not self.contact.keyID:
dialogs.ErrorDialog(_('No GPG key assigned'), dialogs.ErrorDialog(_('No OpenPGP key assigned'),
_('No GPG key is assigned to this contact. So you cannot ' _('No OpenPGP key is assigned to this contact. So you cannot '
'encrypt messages with GPG.')) 'encrypt messages with OpenPGP.'))
return return
ec = gajim.encrypted_chats[self.account] ec = gajim.encrypted_chats[self.account]
if self.gpg_is_active: if self.gpg_is_active:
@ -2196,9 +2197,9 @@ class ChatControl(ChatControlBase):
ec.remove(self.contact.jid) ec.remove(self.contact.jid)
self.gpg_is_active = False self.gpg_is_active = False
loggable = False loggable = False
msg = _('GPG encryption disabled') msg = _('OpenPGP encryption disabled')
ChatControlBase.print_conversation_line(self, msg, ChatControlBase.print_conversation_line(self, msg, 'status', '',
'status', '', None) None)
if self.session: if self.session:
self.session.loggable = True self.session.loggable = True
@ -2206,9 +2207,9 @@ class ChatControl(ChatControlBase):
# Enable encryption # Enable encryption
ec.append(self.contact.jid) ec.append(self.contact.jid)
self.gpg_is_active = True self.gpg_is_active = True
msg = _('GPG encryption enabled') msg = _('OpenPGP encryption enabled')
ChatControlBase.print_conversation_line(self, msg, ChatControlBase.print_conversation_line(self, msg, 'status', '',
'status', '', None) None)
loggable = gajim.config.get_per('accounts', self.account, loggable = gajim.config.get_per('accounts', self.account,
'log_encrypted_sessions') 'log_encrypted_sessions')
@ -2232,7 +2233,7 @@ class ChatControl(ChatControlBase):
gajim.config.set_per('contacts', self.contact.jid, gajim.config.set_per('contacts', self.contact.jid,
'gpg_enabled', self.gpg_is_active) 'gpg_enabled', self.gpg_is_active)
self._show_lock_image(self.gpg_is_active, 'GPG', self._show_lock_image(self.gpg_is_active, 'OpenPGP',
self.gpg_is_active, loggable, True) self.gpg_is_active, loggable, True)
def _show_lock_image(self, visible, enc_type='', enc_enabled=False, def _show_lock_image(self, visible, enc_type='', enc_enabled=False,

View File

@ -186,7 +186,7 @@ class StandardCommonChatCommands(CommandContainer):
self.conv_textview.clear() self.conv_textview.clear()
@command @command
@doc(_("Toggle the GPG encryption")) @doc(_("Toggle the OpenPGP encryption"))
def gpg(self): def gpg(self):
self._toggle_gpg() self._toggle_gpg()

View File

@ -5091,22 +5091,22 @@ class GPGInfoWindow:
image = 'gajim-security_low' image = 'gajim-security_low'
elif not keyID: elif not keyID:
# No key assigned nor a key is used by remote contact # No key assigned nor a key is used by remote contact
verification_status = _('No GPG key assigned') verification_status = _('No OpenPGP key assigned')
info = _('No GPG key is assigned to this contact. So you cannot ' info = _('No OpenPGP key is assigned to this contact. So you cannot'
' encrypt messages.') ' encrypt messages.')
image = 'gajim-security_low' image = 'gajim-security_low'
else: else:
error = gajim.connections[account].gpg.encrypt('test', [keyID])[1] error = gajim.connections[account].gpg.encrypt('test', [keyID])[1]
if error: if error:
verification_status = _('''Contact's identity NOT verified''') verification_status = _('''Contact's identity NOT verified''')
info = _('GPG key is assigned to this contact, but <b>you do not ' info = _('OpenPGP key is assigned to this contact, but <b>you '
'trust his key</b>, so message <b>cannot</b> be encrypted. Use ' 'do not trust his key</b>, so message <b>cannot</b> be '
'your GPG client to trust this key.') 'encrypted. Use your OpenPGP client to trust this key.')
image = 'gajim-security_low' image = 'gajim-security_low'
else: else:
verification_status = _('''Contact's identity verified''') verification_status = _('''Contact's identity verified''')
info = _('GPG Key is assigned to this contact, and you trust his ' info = _('OpenPGP Key is assigned to this contact, and you '
'key, so messages will be encrypted.') 'trust his key, so messages will be encrypted.')
image = 'gajim-security_high' image = 'gajim-security_high'
status_label.set_markup('<b><span size="x-large">%s</span></b>' % \ status_label.set_markup('<b><span size="x-large">%s</span></b>' % \

View File

@ -59,8 +59,8 @@ class FeaturesWindow:
_('A script to control Gajim via commandline.'), _('A script to control Gajim via commandline.'),
_('Requires python-dbus.'), _('Requires python-dbus.'),
_('Feature not available under Windows.')), _('Feature not available under Windows.')),
_('OpenGPG message encryption'): (self.gpg_available, _('OpenPGP message encryption'): (self.gpg_available,
_('Encrypting chat messages with gpg keys.'), _('Encrypting chat messages with OpenPGP keys.'),
_('Requires gpg and python-gnupg (http://code.google.com/p/python-gnupg/).'), _('Requires gpg and python-gnupg (http://code.google.com/p/python-gnupg/).'),
_('Requires gpg.exe in PATH.')), _('Requires gpg.exe in PATH.')),
_('Network-manager'): (self.network_manager_available, _('Network-manager'): (self.network_manager_available,

View File

@ -654,8 +654,9 @@ class Interface:
def handle_event_bad_gpg_passphrase(self, obj): def handle_event_bad_gpg_passphrase(self, obj):
#('BAD_PASSPHRASE', account, ()) #('BAD_PASSPHRASE', account, ())
if obj.use_gpg_agent: if obj.use_gpg_agent:
sectext = _('You configured Gajim to use GPG agent, but there is no' sectext = _('You configured Gajim to use OpenPGP agent, but there '
' GPG agent running or it returned a wrong passphrase.\n') 'is no OpenPGP agent running or it returned a wrong passphrase.'
'\n')
sectext += _('You are currently connected without your OpenPGP ' sectext += _('You are currently connected without your OpenPGP '
'key.') 'key.')
dialogs.WarningDialog(_('Your passphrase is incorrect'), sectext) dialogs.WarningDialog(_('Your passphrase is incorrect'), sectext)
@ -663,7 +664,7 @@ class Interface:
path = gtkgui_helpers.get_icon_path('gajim-warning', 48) path = gtkgui_helpers.get_icon_path('gajim-warning', 48)
account = obj.conn.name account = obj.conn.name
notify.popup('warning', account, account, 'warning', path, notify.popup('warning', account, account, 'warning', path,
_('OpenGPG Passphrase Incorrect'), _('OpenPGP Passphrase Incorrect'),
_('You are currently connected without your OpenPGP key.')) _('You are currently connected without your OpenPGP key.'))
self.forget_gpg_passphrase(obj.keyID) self.forget_gpg_passphrase(obj.keyID)
@ -699,9 +700,9 @@ class Interface:
def on_no(): def on_no():
obj.callback(False) obj.callback(False)
dialogs.YesNoDialog(_('GPG key not trusted'), _('The GPG key used to ' dialogs.YesNoDialog(_('OpenPGP key not trusted'), _('The OpenPGP key '
'encrypt this chat is not trusted. Do you really want to encrypt ' 'used to encrypt this chat is not trusted. Do you really want to '
'this message?'), checktext=_('_Do not ask me again'), 'encrypt this message?'), checktext=_('_Do not ask me again'),
on_response_yes=on_yes, on_response_no=on_no) on_response_yes=on_yes, on_response_no=on_no)
def handle_event_password_required(self, obj): def handle_event_password_required(self, obj):
@ -3006,7 +3007,7 @@ class PassphraseRequest:
def create_dialog(self, account): def create_dialog(self, account):
title = _('Passphrase Required') title = _('Passphrase Required')
second = _('Enter GPG key passphrase for key %(keyid)s (account ' second = _('Enter OpenPGP key passphrase for key %(keyid)s (account '
'%(account)s).') % {'keyid': self.keyid, 'account': account} '%(account)s).') % {'keyid': self.keyid, 'account': account}
def _cancel(): def _cancel():
@ -3020,9 +3021,9 @@ class PassphraseRequest:
self.complete(passphrase) self.complete(passphrase)
return return
elif result == 'expired': elif result == 'expired':
dialogs.ErrorDialog(_('GPG key expired'), dialogs.ErrorDialog(_('OpenPGP key expired'),
_('Your GPG key has expired, you will be connected to %s ' _('Your OpenPGP key has expired, you will be connected to '
'without OpenPGP.') % account) '%s without OpenPGP.') % account)
# Don't try to connect with GPG # Don't try to connect with GPG
gajim.connections[account].continue_connect_info[2] = False gajim.connections[account].continue_connect_info[2] = False
self.complete(None) self.complete(None)
@ -3031,7 +3032,7 @@ class PassphraseRequest:
if count < 3: if count < 3:
# ask again # ask again
dialogs.PassphraseDialog(_('Wrong Passphrase'), dialogs.PassphraseDialog(_('Wrong Passphrase'),
_('Please retype your GPG passphrase or press Cancel.'), _('Please retype your OpenPGP passphrase or press Cancel.'),
ok_handler=(_ok, count + 1), cancel_handler=_cancel) ok_handler=(_ok, count + 1), cancel_handler=_cancel)
else: else:
# user failed 3 times, continue without GPG # user failed 3 times, continue without GPG

View File

@ -2117,7 +2117,7 @@ class RosterWindow:
keyid = gajim.config.get_per('accounts', account, 'keyid') keyid = gajim.config.get_per('accounts', account, 'keyid')
if keyid and not gajim.connections[account].gpg: if keyid and not gajim.connections[account].gpg:
dialogs.WarningDialog(_('GPG is not usable'), dialogs.WarningDialog(_('OpenPGP is not usable'),
_('You will be connected to %s without OpenPGP.') % \ _('You will be connected to %s without OpenPGP.') % \
account) account)