Fix forwarding in dimp if only forwarding one message
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 30 Sep 2010 17:47:06 +0000 (11:47 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 30 Sep 2010 17:47:23 +0000 (11:47 -0600)
imp/compose-dimp.php
imp/lib/Ui/Compose.php

index e705678..7b6d7d0 100644 (file)
@@ -111,7 +111,11 @@ case 'forward_attach':
 case 'forward_auto':
 case 'forward_body':
 case 'forward_both':
-    if ($vars->uids) {
+    $indices = $vars->uids
+        ? new IMP_Indices($vars->uids)
+        : null;
+
+    if ($indices && (count($indices) > 1)) {
         if (!in_array($vars->type, array('forward_attach', 'forward_auto'))) {
             $notification->push(_("Multiple messages can only be forwarded as attachments."), 'horde.warning');
         }
@@ -128,13 +132,12 @@ case 'forward_both':
 
         $rte = $show_editor = ($prefs->getValue('compose_html') && $_SESSION['imp']['rteavail']);
     } else {
-
-    try {
-        $contents = $imp_ui->getContents($vars);
-    } catch (IMP_Compose_Exception $e) {
-        $notification->push($e, 'horde.error');
-        break;
-    }
+        try {
+            $contents = $imp_ui->getContents($vars);
+        } catch (IMP_Compose_Exception $e) {
+            $notification->push($e, 'horde.error');
+            break;
+        }
 
         $fwd_msg = $imp_compose->forwardMessage($vars->type, $contents);
         $msg = $fwd_msg['body'];
index 70d657f..5027007 100644 (file)
@@ -227,6 +227,8 @@ class IMP_Ui_Compose
         } elseif ($vars->folder && $vars->uid) {
             /* DIMP: compose-dimp.php */
             $indices = new IMP_Indices($vars->folder, $vars->uid);
+        } elseif ($vars->uids) {
+            $indices = new IMP_Indices($vars->uids);
         }
 
         if (!is_null($indices)) {