From 96c3d84cddb861956cfbc719d694eb972343f1c3 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Sat, 02 Apr 2016 04:35:17 -0400 Subject: [PATCH] Enigma: Varius fixes and cleanup in code for attaching pubkeys --- plugins/enigma/lib/enigma_ui.php | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-) diff --git a/plugins/enigma/lib/enigma_ui.php b/plugins/enigma/lib/enigma_ui.php index 3ccacd4..37c1d41 100644 --- a/plugins/enigma/lib/enigma_ui.php +++ b/plugins/enigma/lib/enigma_ui.php @@ -941,7 +941,8 @@ $savedraft = !empty($_POST['_draft']) && empty($_GET['_saveonly']); if (!$savedraft && rcube_utils::get_input_value('_enigma_attachpubkey', rcube_utils::INPUT_POST)) { - $p = $this->attach_public($p); + $this->enigma->load_engine(); + $this->enigma->engine->attach_public_key($p['message']); } if (!$savedraft && rcube_utils::get_input_value('_enigma_sign', rcube_utils::INPUT_POST)) { @@ -975,24 +976,6 @@ } $this->rc->output->send('iframe'); - } - - return $p; - } - - /** - * Add sender's public key (PGP). - */ - function attach_public($p) - { - // get sender's PGP pubkey for attachment - $this->enigma->load_engine(); - $key = $this->enigma->engine->list_keys($p['message']->headers()['From']); - $keyID = $key[0]->subkeys[0]->get_short_id(); - $pubkey_armor = $this->enigma->engine->get_gpg_pubkey_for_attach($p['message']->headers()['From']); - - if(!$pubkey_armor instanceof enigma_error) { - $p['message']->addAttachment($pubkey_armor, 'application/pgp-keys', "0x$keyID.asc", false); } return $p; -- Gitblit v1.9.1