Remove unused functions.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 19 Nov 2008 03:30:25 +0000 (20:30 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 19 Nov 2008 03:30:25 +0000 (20:30 -0700)
imp/lib/Crypt/pgp.php

index 2b44829..9711845 100644 (file)
@@ -248,153 +248,6 @@ class IMP_Horde_Crypt_pgp extends Horde_Crypt_pgp
     }
 
     /**
-     * Parse a message into its PGP components.
-     *
-     * @param string $text  See Horde_Crypt_pgp::parsePGPData()
-     *
-     * @return array  Returns an array of Horde_Mime_Part objects.
-     *                If there was no PGP data, returns false.
-     */
-    public function &parseMessage($text)
-    {
-        $result = $this->parsePGPData($text);
-        if (empty($result) ||
-            ((count($result) == 1) && ($result[0]['type'] == self::ARMOR_TEXT))) {
-            $result = false;
-            return $result;
-        }
-
-        $return_array = array();
-
-        reset($result);
-        do {
-            $block = current($result);
-            $temp_part = new Horde_Mime_Part();
-            $temp_part->setContents(implode("\n", $block['data']));
-
-            /* Since private keys should NEVER be sent across email (in fact,
-               there is no MIME type to handle them) we will render them, if
-               someone is foolish enough to send one, in simple text. */
-            if (($block['type'] == self::ARMOR_TEXT) ||
-                ($block['type'] == self::ARMOR_PRIVATE_KEY)) {
-                $temp_part->setType('text/plain');
-            } elseif ($block['type'] == self::ARMOR_PUBLIC_KEY) {
-                $temp_part->setType('application/pgp-keys');
-            } elseif ($block['type'] == self::ARMOR_MESSAGE) {
-                $temp_part->setType('application/pgp-encrypted');
-            } elseif ($block['type'] == self::ARMOR_SIGNED_MESSAGE) {
-                $temp_part->setType('application/pgp-signature');
-                if (($block = next($result))) {
-                    if (!empty($block) && ($block['type'] == self::ARMOR_SIGNATURE)) {
-                        $temp_part->appendContents("\n" . implode("\n", $block['data']));
-                    }
-                }
-            } elseif ($block['type'] == self::ARMOR_SIGNATURE) {
-                continue;
-            }
-
-            $return_array[] = $temp_part;
-        } while (next($result));
-
-        return $return_array;
-    }
-
-    /**
-     * Renders a text message with PGP components.
-     *
-     * @param Horde_Mime_Part &$part    The part containing the data to
-     *                                  render.
-     * @param IMP_Contents &$contents  The IMP_Contents:: module to use to
-     *                                  output the text.
-     *
-     * @return string  Returns the rendered text.
-     *                 If there was no PGP data, returns false.
-     */
-    function parseMessageOutput(&$part, &$contents)
-    {
-        if (!($parts = &$this->parseMessage($part->getContents()))) {
-            return false;
-        }
-
-        $text = '';
-
-        // TODO
-        $base_ob = &$contents->getBaseObjectPtr();
-        $addr = $base_ob->getFromAddress();
-
-        $message = new Horde_Mime_Message();
-        foreach ($parts as $val) {
-            $message->addPart($val);
-        }
-
-        // TODO
-        $mc = new IMP_Contents($message, array('download' => 'download_attach', 'view' => 'view_attach'), array(&$contents));
-        $message->buildMessage();
-
-        foreach ($message->getParts() as $val) {
-            /* If the part appears to be nothing but empty space, don't
-               display it. */
-            if (($val->getBytes() < 5) &&
-                !(rtrim($val->getContents()))) {
-                continue;
-            }
-            $v = &$mc->getMIMEViewer($val);
-            if (!is_a($v, 'IMP_Horde_Mime_Viewer_pgp')) {
-                $text .= $mc->formatStatusMsg(_("The message below has not been digitally signed or encrypted with PGP."), Horde::img('alerts/warning.png', _("Warning"), '', $GLOBALS['registry']->getImageDir('horde')));
-            }
-            $text .= $mc->renderMIMEPart($val);
-        }
-
-        return $text;
-    }
-
-    /**
-     * Returns the signed data only for a plaintext signed Horde_Mime_Part.
-     *
-     * @param Horde_Mime_Part $mime_part  The object with a plaintext PGP
-     *                                    signed message in the contents.
-     *
-     * @return string  The contents of the signed message.
-     */
-    public function getSignedMessage(&$mime_part)
-    {
-        $msg = '';
-
-        /* Just output signed data - remove all PGP headers. */
-        $result = $this->parsePGPData($mime_part->getContents());
-        foreach ($result as $block) {
-            if ($block['type'] == self::ARMOR_SIGNED_MESSAGE) {
-                $headerSeen = false;
-                $headerDone = false;
-                foreach ($block['data'] as $line) {
-                    if ($headerDone) {
-                        $msg .= $line . "\n";
-                    } elseif (strpos($line, "-----") === 0) {
-                        $headerSeen = true;
-                        continue;
-                    } elseif ($headerSeen) {
-                        /* There are some versions of GnuPG (like Version:
-                           GnuPG v1.2.1 (MingW32)) which separate headers from
-                           content with a line containing a blank, but this
-                           isn't RFC conforming, so this isn't handled.
-                           It results in a good signature with an empty
-                           message.
-                           The wrong code would be:
-                           elseif (empty($line) || (strcmp($line, ' ') == 0))
-                         */
-                        $line = trim($line);
-                        if (empty($line)) {
-                            $headerDone = true;
-                        }
-                    }
-                }
-            }
-        }
-
-        return rtrim($msg);
-    }
-
-    /**
      * Get a public key via a public PGP keyserver.
      *
      * @param string $fingerprint  The fingerprint of the requested key.