Make html mode an optional argument to buildAndSendMessage()
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Nov 2010 20:37:01 +0000 (14:37 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Nov 2010 16:19:10 +0000 (10:19 -0600)
imp/compose-mimp.php
imp/compose.php
imp/lib/Ajax/Application.php
imp/lib/Compose.php

index 5d00cf4..033ca09 100644 (file)
@@ -282,7 +282,7 @@ case _("Send"):
         );
 
         try {
-            if ($imp_compose->buildAndSendMessage($message, $header, $registry->getEmailCharset(), false, $options)) {
+            if ($imp_compose->buildAndSendMessage($message, $header, $registry->getEmailCharset(), $options)) {
                 $imp_compose->destroy('send');
 
                 $notification->push(_("Message sent successfully."), 'horde.success');
index 34462a9..0b456b2 100644 (file)
@@ -417,6 +417,7 @@ case 'send_message':
 
     $options = array(
         'encrypt' => $prefs->isLocked('default_encrypt') ? $prefs->getValue('default_encrypt') : $vars->encrypt_options,
+        'html' => $rtemode,
         'identity' => $identity,
         'priority' => $vars->priority,
         'save_sent' => $save_sent_mail,
@@ -426,7 +427,7 @@ case 'send_message':
     );
 
     try {
-        $sent = $imp_compose->buildAndSendMessage($message, $header, $charset, $rtemode, $options);
+        $sent = $imp_compose->buildAndSendMessage($message, $header, $charset, $options);
         $imp_compose->destroy('send');
     } catch (IMP_Compose_Exception $e) {
         $get_sig = false;
index bd44638..81b4fcc 100644 (file)
@@ -1624,6 +1624,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
 
         $options = array(
             'encrypt' => ($GLOBALS['prefs']->isLocked('default_encrypt') ? $GLOBALS['prefs']->getValue('default_encrypt') : $this->_vars->encrypt),
+            'html' => $this->_vars->html,
             'identity' => $identity,
             'priority' => $this->_vars->priority,
             'readreceipt' => $this->_vars->request_read_receipt,
@@ -1638,7 +1639,7 @@ class IMP_Ajax_Application extends Horde_Core_Ajax_Application
 
         try {
             // TODO: Use 'sending_charset'
-            $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, $GLOBALS['registry']->getEmailCharset(), $this->_vars->html, $options);
+            $sent = $imp_compose->buildAndSendMessage($this->_vars->message, $headers, $GLOBALS['registry']->getEmailCharset(), $options);
         } catch (IMP_Compose_Exception $e) {
             $result->success = 0;
 
index 1c17852..413f47f 100644 (file)
@@ -445,20 +445,21 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
      * @param string $body     The message body.
      * @param array $header    List of message headers.
      * @param string $charset  The sending charset.
-     * @param boolean $html    Whether this is an HTML message.
      * @param array $opts      An array of options w/the following keys:
      * <pre>
-     * 'encrypt' => (integer) A flag whether to encrypt or sign the message.
-     *              One of IMP::PGP_ENCRYPT, IMP::PGP_SIGNENC,
-     *              IMP::SMIME_ENCRYPT, or IMP::SMIME_SIGNENC.
-     * 'identity' => (IMP_Prefs_Identity) If set, checks for proper tie-to
-     *               addresses.
-     * 'priority' => (string) The message priority ('high', 'normal', 'low').
-     * 'save_sent' = (bool) Save sent mail?
-     * 'sent_folder' = (string) The sent-mail folder (UTF7-IMAP).
-     * 'save_attachments' = (bool) Save attachments with the message?
-     * 'readreceipt' => (bool) Add return receipt headers?
-     * 'useragent' => (string) The User-Agent string to use.
+     * encrypt - (integer) A flag whether to encrypt or sign the message.
+     *           One of IMP::PGP_ENCRYPT, IMP::PGP_SIGNENC,
+     *           IMP::SMIME_ENCRYPT, or IMP::SMIME_SIGNENC.
+     * html - (boolean) Whether this is an HTML message.
+     *        DEFAULT: false
+     * identity - (IMP_Prefs_Identity) If set, checks for proper tie-to
+     *            addresses.
+     * priority - (string) The message priority ('high', 'normal', 'low').
+     * save_sent - (boolean) Save sent mail?
+     * sent_folder - (string) The sent-mail folder (UTF7-IMAP).
+     * save_attachments - (bool) Save attachments with the message?
+     * readreceipt - (boolean) Add return receipt headers?
+     * useragent - (string) The User-Agent string to use.
      * </pre>
      *
      * @return boolean  Whether the sent message has been saved in the
@@ -467,8 +468,8 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
      * @throws IMP_Compose_Exception
      * @throws IMP_Exception
      */
-    public function buildAndSendMessage($body, $header, $charset, $html,
-                                        $opts = array())
+    public function buildAndSendMessage($body, $header, $charset,
+                                        array $opts = array())
     {
         global $conf, $notification, $prefs, $registry;
 
@@ -501,7 +502,7 @@ class IMP_Compose implements ArrayAccess, Countable, Iterator
         $send_msgs = array();
         $msg_options = array(
             'encrypt' => $encrypt,
-            'html' => $html
+            'html' => !empty($opts['html'])
         );
 
         /* Must encrypt & send the message one recipient at a time. */