Aleksander Machniak
2013-03-19 a8040cf0bd71aad66b6847e27d14fe302ef87e95
Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000)
Prevent from re-adding the same forward attachment on compose page refresh
2 files modified
13 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/steps/mail/compose.inc 12 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000)
- Add ability to toggle between HTML and text while viewing a message (#1486939)
- Better handling of session errors in ajax requests (#1488960)
- Fix HTML part detection for some specific message structures (#1488992)
program/steps/mail/compose.inc
@@ -568,8 +568,7 @@
  else if ($compose_mode == RCUBE_COMPOSE_FORWARD && $COMPOSE['as_attachment']) {
    $isHtml = rcmail_compose_editor_mode();
    $body = '';
    if (empty($COMPOSE['attachments']))
      rcmail_write_forward_attachments();
    rcmail_write_forward_attachments();
  }
  // reply/edit/draft/forward
  else if ($compose_mode && ($compose_mode != RCUBE_COMPOSE_REPLY || $RCMAIL->config->get('reply_mode') != -1)) {
@@ -1074,6 +1073,11 @@
  $curr_mem  = function_exists('memory_get_usage') ? memory_get_usage() : 16*1024*1024; // safe value: 16MB
  $names     = array();
  $loaded_attachments = array();
  foreach ((array)$COMPOSE['attachments'] as $id => $attachment) {
      $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment;
  }
  if ($COMPOSE['forward_uid'] == '*') {
    $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order());
    $COMPOSE['forward_uid'] = $index->get();
@@ -1108,6 +1112,10 @@
    $data = $path = null;
    if (!empty($loaded_attachments[$name . 'message/rfc822'])) {
      continue;
    }
    // don't load too big attachments into memory
    if ($mem_limit > 0 && $message->size > $mem_limit - $curr_mem) {
      $temp_dir = unslashify($RCMAIL->config->get('temp_dir'));