X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmailbox_display.php;h=d5eb6214ca735faf84c96bb6f26399c201864b2d;hb=2c92ea9da4c11cac1ea3118a1e0fda6407e5d62b;hp=d892cdca21f000a1185e439bd038c51713404a07;hpb=f3a1e5fae4a893373a6394fb4e07ba4fd0a3d9c9;p=squirrelmail.git diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index d892cdca..d5eb6214 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -1,17 +1,16 @@ 1 && $aQuery) { @@ -492,7 +532,7 @@ function prepareMessageList(&$aMailbox, $aProps) { } foreach ($aCol as $k => $v) { - $link = $target = $title = ''; + $title = $link = $target = $onclick = $link_extra = ''; $aColumns[$k] = array(); $value = (isset($aMsg[$v])) ? $aMsg[$v] : ''; $sUnknown = _("Unknown recipient"); @@ -507,35 +547,71 @@ function prepareMessageList(&$aMailbox, $aProps) { if ($highlight_list && !$bHighLight) { $bHighLight = highlightMessage($aCol[$k], $value, $highlight_list,$aFormattedMessages[$iUid]); } - $sTmp = getAddressString(parseRFC822Address($value),array('best' => true)); + $aAddressList = parseRFC822Address($value); + $sTmp = getAddressString($aAddressList,array('best' => true)); + $title = $title_maybe = ''; + foreach ($aAddressList as $aAddr) { + $sPersonal = (isset($aAddr[SQM_ADDR_PERSONAL])) ? $aAddr[SQM_ADDR_PERSONAL] : ''; + $sMailbox = (isset($aAddr[SQM_ADDR_MAILBOX])) ? $aAddr[SQM_ADDR_MAILBOX] : ''; + $sHost = (isset($aAddr[SQM_ADDR_HOST])) ? $aAddr[SQM_ADDR_HOST] : ''; + if ($sPersonal) { + $title .= htmlspecialchars($sMailbox.'@'.$sHost).', '; + } else { + // if $value gets truncated we need to add the addresses with no + // personal name as well + $title_maybe .= htmlspecialchars($sMailbox.'@'.$sHost).', '; + } + } + if ($title) { + $title = substr($title,0,-2); // strip ', '; + } + $sTmp = decodeHeader($sTmp); if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) { $sTrunc = truncateWithEntities($sTmp, $aColumnDesc[$k]['truncate']); - $title = ($sTrunc != $sTmp) ? htmlspecialchars($sTmp) : ''; + if ($sTrunc != $sTmp) { + if (!$title) { + $title = htmlspecialchars($sTmp); + } else if ($title_maybe) { + $title = $title .', '.$title_maybe; + $title = substr($title,0,-2); // strip ', '; + } + } $sTmp = $sTrunc; } } - $value = ($sTmp) ? htmlspecialchars($sTmp) : $sUnknown; + $value = ($sTmp) ? $sTmp : $sUnknown; break; case SQM_COL_SUBJ: + // subject is mime encoded, decode it. + // value is sanitized in decoding function. + // TODO, verify if it should be done before or after the highlighting + $value=decodeHeader($value); if ($highlight_list && !$bHighLight) { $bHighLight = highlightMessage('SUBJECT', $value, $highlight_list, $aFormattedMessages[$iUid]); } $iIndent = (isset($aIndentArray[$aId[$i]])) ? $aIndentArray[$aId[$i]] : 0; + // FIXME: don't break 8bit symbols and html entities during truncation if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) { $sTmp = truncateWithEntities($value, $aColumnDesc[$k]['truncate']-$iIndent); - $title = ($sTmp != $value) ? htmlspecialchars($value) : ''; + // drop any double spaces since these will be displayed in the title + $title = ($sTmp != $value) ? preg_replace('/\s{2,}/', ' ', $value) : ''; $value = $sTmp; } /* generate the link to the message */ if ($aQuery) { // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint $link = $sTargetModule.'.php?' . implode('&',$aQuery); - } + // see top of this function for which attributes are available + // in the global scope for plugin use (like $link, $target, + // $onclick, $link_extra, $title, and so forth) + // plugins are responsible for sharing nicely (such as for + // setting the target, etc) + do_hook('subject_link', array($iPageOffset, $sSearch, $aSearch)); + } $value = (trim($value)) ? $value : _("(no subject)"); /* add thread indentation */ $aColumns[$k]['indent'] = $iIndent; - $value = htmlspecialchars($value); break; case SQM_COL_SIZE: $value = show_readable_size($value); @@ -550,6 +626,8 @@ function prepareMessageList(&$aMailbox, $aProps) { 'answered'=>false, 'flagged' => false, 'draft' => false); + + if(!is_array($value)) $value = array(); foreach ($value as $sFlag => $value) { switch ($sFlag) { case '\\seen' : $aFlagColumn['seen'] = true; break; @@ -573,16 +651,18 @@ function prepareMessageList(&$aMailbox, $aProps) { break; default : break; } - if ($title) { $aColumns[$k]['title'] = $title; } - if ($link) { $aColumns[$k]['link'] = $link; } - if ($target) { $aColumns[$k]['target'] = $target; } + if ($title) { $aColumns[$k]['title'] = $title; } + if ($link) { $aColumns[$k]['link'] = $link; } + if ($link_extra) { $aColumns[$k]['link_extra'] = $link_extra; } + if ($onclick) { $aColumns[$k]['onclick'] = $onclick; } + if ($target) { $aColumns[$k]['target'] = $target; } $aColumns[$k]['value'] = $value; } /* columns which will not be displayed but should be inspected because the highlight list contains rules with those columns */ - foreach ($aExtraColumns as $k) { - if ($highlight_list && !$bHighLight) { - $bHighLight = highlightMessage($k, $value, $highlight_list,$aFormattedMessages[$iUid]); + foreach ($aExtraHighLightColumns as $v) { + if ($highlight_list && !$bHighLight && isset($aMsg[$v])) { + $bHighLight = highlightMessage($v, $aMsg[$v], $highlight_list,$aFormattedMessages[$iUid]); } } $aFormattedMessages[$iUid]['columns'] = $aColumns; @@ -595,16 +675,24 @@ function prepareMessageList(&$aMailbox, $aProps) { } - +/** + * Sets the row color if the provided column value pair matches a hightlight rule + * + * @param string $sCol column name + * @param string $sVal column value + * @param array $highlight_list highlight rules + * @param array $aFormat (reference) array where row color info is stored + * @return bool match found + * @since 1.5.1 + * @author Marc Groot Koerkamp + */ function highlightMessage($sCol, $sVal, $highlight_list, &$aFormat) { - - if (!is_array($highlight_list) && count($highlight_list) == 0) { return false; } $hlt_color = false; $sCol = strtoupper($sCol); - //echo "$sCol $sVal
"; + foreach ($highlight_list as $highlight_list_part) { if (trim($highlight_list_part['value'])) { $high_val = strtolower($highlight_list_part['value']); @@ -627,7 +715,7 @@ function highlightMessage($sCol, $sVal, $highlight_list, &$aFormat) { } } if ($hlt_color) { - // Bug in highlight color??? + // Bug in highlight color??? if ($hlt_color{0} != '#') { $hlt_color = '#'. $hlt_color; } @@ -644,17 +732,18 @@ function setUserPref($username, $pref, $value) { } /** -* Execute the sorting for a mailbox -* -* @param resource $imapConnection Imap connection -* @param array $aMailbox (reference) Mailbox retrieved with sqm_api_mailbox_select -* @return int $error (reference) Error number -* @private -* @author Marc Groot Koerkamp -*/ + * Execute the sorting for a mailbox + * + * @param resource $imapConnection Imap connection + * @param array $aMailbox (reference) Mailbox retrieved with sqm_api_mailbox_select + * @return int $error (reference) Error number + * @private + * @since 1.5.1 + * @author Marc Groot Koerkamp + */ function _get_sorted_msgs_list($imapConnection,&$aMailbox) { $iSetIndx = (isset($aMailbox['SETINDEX'])) ? $aMailbox['SETINDEX'] : 0; - $bDirection = ($aMailbox['SORT'] % 2); + $bDirection = !($aMailbox['SORT'] % 2); $error = 0; if (!$aMailbox['SEARCH'][$iSetIndx]) { $aMailbox['SEARCH'][$iSetIndx] = 'ALL'; @@ -698,13 +787,14 @@ function _get_sorted_msgs_list($imapConnection,&$aMailbox) { } /** -* Does the $srt $_GET var to field mapping -* -* @param int $srt Field to sort on -* @param bool $bServerSort Server sorting is true -* @return string $sSortField Field to sort on -* @private -*/ + * Does the $srt $_GET var to field mapping + * + * @param int $srt Field to sort on + * @param bool $bServerSort Server sorting is true + * @return string $sSortField Field to sort on + * @since 1.5.1 + * @private + */ function _getSortField($sort,$bServerSort) { switch($sort) { case SQSORT_NONE: @@ -747,55 +837,24 @@ function _getSortField($sort,$bServerSort) { return $sSortField; } - - - /** -* This function loops through a group of messages in the mailbox -* and shows them to the user. -* -* @param resource $imapConnection -* @param array $aMailbox associative array with mailbox related vars -* @param array $aProps -* @param int $iError error code, 0 is no error -*/ -function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { - global $PHP_SELF; - global $boxes; + * This function is a utility function for setting which headers should be + * fetched. It takes into account the highlight list which requires extra + * headers to be fetch in order to make those rules work. It's called before + * the headers are fetched which happens in showMessagesForMailbox and when + * the next and prev links in read_body.php are used. + * + * @param array $aMailbox associative array with mailbox related vars + * @param array $aProps + * @return void + * @since 1.5.1 + */ + +function calcFetchColumns(&$aMailbox, &$aProps) { $highlight_list = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false; - $fancy_index_highlite = (isset($aProps['config']['fancy_index_highlite'])) ? $aProps['config']['fancy_index_highlite'] : true; $aColumnsDesc = (isset($aProps['columns'])) ? $aProps['columns'] : false; - $iAccount = (isset($aProps['account'])) ? (int) $aProps['account'] : 0; - $sMailbox = (isset($aProps['mailbox'])) ? $aProps['mailbox'] : false; - $sTargetModule = (isset($aProps['module'])) ? $aProps['module'] : 'read_body'; - $show_flag_buttons = (isset($aProps['config']['show_flag_buttons'])) ? $aProps['config']['show_flag_buttons'] : true; - $lastTargetMailbox = (isset($aProps['config']['lastTargetMailbox'])) ? $aProps['config']['lastTargetMailbox'] : ''; - $aOrder = array_keys($aProps['columns']); - $trash_folder = (isset($aProps['config']['trash_folder']) && $aProps['config']['trash_folder']) - ? $aProps['config']['trash_folder'] : false; - $sent_folder = (isset($aProps['config']['sent_folder']) && $aProps['config']['sent_folder']) - ? $aProps['config']['sent_folder'] : false; - $draft_folder = (isset($aProps['config']['draft_folder']) && $aProps['config']['draft_folder']) - ? $aProps['config']['draft_folder'] : false; - $page_selector = (isset($aProps['config']['page_selector'])) ? $aProps['config']['page_selector'] : false; - $page_selector_max = (isset($aProps['config']['page_selector_max'])) ? $aProps['config']['page_selector_max'] : 10; - $color = $aProps['config']['color']; - - /* - * Form ID - */ - static $iFormId; - - if (!isset($iFormId)) { - $iFormId=1; - } else { - ++$iFormId; - } - /* - * Remove the checkbox column because we cannot fetch it from the imap server - */ $aFetchColumns = $aColumnsDesc; if (isset($aFetchColumns[SQM_COL_CHECK])) { unset($aFetchColumns[SQM_COL_CHECK]); @@ -810,15 +869,14 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { foreach ($highlight_list as $highlight_list_part) { if (trim($highlight_list_part['value'])) { $match_type = strtoupper($highlight_list_part['match_type']); - $aHighlightColumns = array(); switch ($match_type) { case 'TO_CC': $aHighlightColumns[SQM_COL_TO] = true; $aHighlightColumns[SQM_COL_CC] = true; break; - case 'TO': $aHighlightColumns[SQM_COL_TO] = true; break; - case 'CC': $aHighlightColumns[SQM_COL_CC] = true; break; - case 'FROM': $aHighlightColumns[SQM_COL_FROM] = true; break; + case 'TO': $aHighlightColumns[SQM_COL_TO] = true; break; + case 'CC': $aHighlightColumns[SQM_COL_CC] = true; break; + case 'FROM': $aHighlightColumns[SQM_COL_FROM] = true; break; case 'SUBJECT':$aHighlightColumns[SQM_COL_SUBJ] = true; break; } } @@ -834,12 +892,58 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { $aProps['extra_columns'] = $aExtraColumns; } } - $aFetchColumns = array_keys($aFetchColumns); - // store the columns to fetch to the session so we can pick them up in read_body + $aMailbox['FETCHHEADERS'] = array_keys($aFetchColumns); +} + + +/** + * This function loops through a group of messages in the mailbox + * and shows them to the user. + * + * @param resource $imapConnection + * @param array $aMailbox associative array with mailbox related vars + * @param array $aProps + * @param int $iError error code, 0 is no error + */ +function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { + global $PHP_SELF; + global $boxes; + + $highlight_list = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false; + $fancy_index_highlite = (isset($aProps['config']['fancy_index_highlite'])) ? $aProps['config']['fancy_index_highlite'] : true; + $aColumnsDesc = (isset($aProps['columns'])) ? $aProps['columns'] : false; + $iAccount = (isset($aProps['account'])) ? (int) $aProps['account'] : 0; + $sMailbox = (isset($aProps['mailbox'])) ? $aProps['mailbox'] : false; + $sTargetModule = (isset($aProps['module'])) ? $aProps['module'] : 'read_body'; + $show_flag_buttons = (isset($aProps['config']['show_flag_buttons'])) ? $aProps['config']['show_flag_buttons'] : true; + $lastTargetMailbox = (isset($aProps['config']['lastTargetMailbox'])) ? $aProps['config']['lastTargetMailbox'] : ''; + $aOrder = array_keys($aProps['columns']); + $trash_folder = (isset($aProps['config']['trash_folder']) && $aProps['config']['trash_folder']) + ? $aProps['config']['trash_folder'] : false; + $sent_folder = (isset($aProps['config']['sent_folder']) && $aProps['config']['sent_folder']) + ? $aProps['config']['sent_folder'] : false; + $draft_folder = (isset($aProps['config']['draft_folder']) && $aProps['config']['draft_folder']) + ? $aProps['config']['draft_folder'] : false; + $page_selector = (isset($aProps['config']['page_selector'])) ? $aProps['config']['page_selector'] : false; + $page_selector_max = (isset($aProps['config']['page_selector_max'])) ? $aProps['config']['page_selector_max'] : 10; + $color = $aProps['config']['color']; + + + /* + * Form ID + */ + static $iFormId; + + if (!isset($iFormId)) { + $iFormId=1; + } else { + ++$iFormId; + } + // store the columns to fetch so we can pick them up in read_body // where we validate the cache. - /////// sqsession_register($aFetchColumns,'aFetchColumns'); + calcFetchColumns($aMailbox ,$aProps); - $iError = fetchMessageHeaders($imapConnection, $aMailbox, $aFetchColumns); + $iError = fetchMessageHeaders($imapConnection, $aMailbox); if ($iError) { return array(); } else { @@ -852,6 +956,7 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS']; $iNumberOfMessages = $aMailbox['TOTAL'][$iSetIndx]; + $iEnd = min ( $iEnd, $iNumberOfMessages ); $php_self = $PHP_SELF; @@ -897,32 +1002,35 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { 'markFlagged' => 1, 'markRead' => 1, 'markUnread' => 1, + 'forward' => 1, 'delete' => 1, 'undeleteButton'=> 1, 'bypass_trash' => 1, 'expungeButton' => 1, - 'moveButton' => 1, - 'forward' => 1 + 'moveButton' => 1 ); /* user prefs control */ $aUserControl = array ( + 'markUnflagged' => $show_flag_buttons, 'markFlagged' => $show_flag_buttons, 'markRead' => 1, 'markUnread' => 1, + 'forward' => 1, 'delete' => 1, 'undeleteButton'=> 1, 'bypass_trash' => 1, 'expungeButton' => 1, - 'moveButton' => 1, - 'forward' => 1 + 'moveButton' => 1 + ); $showDelete = ($aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true)) ? true : false; - $showByPassTrash = (!$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && + $showByPassTrash = (($aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true)) && - $trash_folder ? true : false; // + $trash_folder) ? true : false; // + $showUndelete = (!$aMailbox['AUTO_EXPUNGE'] && $aMailbox['RIGHTS'] != 'READ-ONLY' && in_array('\\deleted',$aMailbox['PERMANENTFLAGS'], true) && !$trash_folder) ? true : false; $showMove = ($aMailbox['RIGHTS'] != 'READ-ONLY') ? true : false; @@ -933,25 +1041,27 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { 'markFlagged' => in_array('\\flagged',$aMailbox['PERMANENTFLAGS'], true), 'markRead' => in_array('\\seen',$aMailbox['PERMANENTFLAGS'], true), 'markUnread' => in_array('\\seen',$aMailbox['PERMANENTFLAGS'], true), + 'forward' => 1, 'delete' => $showDelete, 'undeleteButton'=> $showUndelete, 'bypass_trash' => $showByPassTrash, 'expungeButton' => $showExpunge, - 'moveButton' => $showMove, - 'forward' => 1 + 'moveButton' => $showMove ); $aButtonStrings = array( 'markUnflagged' => _("Unflag"), 'markFlagged' => _("Flag"), 'markRead' => _("Read"), 'markUnread' => _("Unread"), + 'forward' => _("Forward"), 'delete' => _("Delete"), 'undeleteButton' => _("Undelete"), 'bypass_trash' => _("Bypass Trash"), 'expungeButton' => _("Expunge"), - 'moveButton' => _("Move"), - 'forward' => _("Forward") + 'moveButton' => _("Move") ); + + /** * Register buttons in order to an array * The key is the "name", the first element of the value array is the "value", second argument is the type. @@ -986,9 +1096,9 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { } /* - * This is the beginning of the message list table. - * It wraps around all messages - */ + * This is the beginning of the message list table. + * It wraps around all messages + */ $safe_name = preg_replace("/[^0-9A-Za-z_]/", '_', $aMailbox['NAME']); $form_name = "FormMsgs" . $safe_name; @@ -1002,7 +1112,6 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { // FIX ME, before we support multiple templates we must review the names of the vars - $aTemplate['color'] = $color; $aTemplate['form_name'] = "FormMsgs" . $safe_name; $aTemplate['form_id'] = 'mbx_'.$iFormId; @@ -1032,57 +1141,62 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) { $aTemplate['alt_index_colors'] = (isset($aProps['config']['alt_index_colors'])) ? $aProps['config']['alt_index_colors'] : false; $aTemplate['fancy_index_highlite'] = $fancy_index_highlite; + return $aTemplate; } /** -* FIXME: Undocumented function -*/ -function truncateWithEntities($subject, $trim_at) -{ - $ent_strlen = strlen($subject); - if (($trim_at <= 0) || ($ent_strlen <= $trim_at)) - return $subject; - + * Truncates a string and take care of html encoded characters + * + * @param string $s string to truncate + * @param int $iTrimAt Trim at nn characters + * @return string Trimmed string + */ +function truncateWithEntities($s, $iTrimAt) { global $languages, $squirrelmail_language; - /* - * see if this is entities-encoded string - * If so, Iterate through the whole string, find out - * the real number of characters, and if more - * than $trim_at, substr with an updated trim value. - */ - $trim_val = $trim_at; - $ent_offset = 0; - $ent_loc = 0; - while ( $ent_loc < $trim_val && (($ent_loc = strpos($subject, '&', $ent_offset)) !== false) && - (($ent_loc_end = strpos($subject, ';', $ent_loc+3)) !== false) ) { - $trim_val += ($ent_loc_end-$ent_loc); - $ent_offset = $ent_loc_end+1; - } - if (($trim_val > $trim_at) && ($ent_strlen > $trim_val) && (strpos($subject,';',$trim_val) < ($trim_val + 6))) { - $i = strpos($subject,';',$trim_val); - if ($i) { - $trim_val = strpos($subject,';',$trim_val); - } - } - // only print '...' when we're actually dropping part of the subject - if ($ent_strlen <= $trim_val) - return $subject; + $ent_strlen = strlen($s); + if (($iTrimAt <= 0) || ($ent_strlen <= $iTrimAt)) + return $s; if (isset($languages[$squirrelmail_language]['XTRA_CODE']) && function_exists($languages[$squirrelmail_language]['XTRA_CODE'] . '_strimwidth')) { - return call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_strimwidth', $subject, $trim_val); - } + return call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_strimwidth', $s, $iTrimAt); + } else { + /* + * see if this is entities-encoded string + * If so, Iterate through the whole string, find out + * the real number of characters, and if more + * than $iTrimAt, substr with an updated trim value. + */ + $trim_val = $iTrimAt; + $ent_offset = 0; + $ent_loc = 0; + while ( $ent_loc < $trim_val && (($ent_loc = strpos($s, '&', $ent_offset)) !== false) && + (($ent_loc_end = strpos($s, ';', $ent_loc+3)) !== false) ) { + $trim_val += ($ent_loc_end-$ent_loc); + $ent_offset = $ent_loc_end+1; + } - return substr_replace($subject, '...', $trim_val); + if (($trim_val > $iTrimAt) && ($ent_strlen > $trim_val) && (strpos($s,';',$trim_val) < ($trim_val + 6))) { + $i = strpos($s,';',$trim_val); + if ($i !== false) { + $trim_val = strpos($s,';',$trim_val)+1; + } + } + // only print '...' when we're actually dropping part of the subject + if ($ent_strlen <= $trim_val) + return $s; + } + return substr_replace($s, '...', $trim_val); } + /** -* This should go in imap_mailbox.php -* @param string $mailbox -*/ + * This should go in imap_mailbox.php + * @param string $mailbox + */ function handleAsSent($mailbox) { global $handleAsSent_result; @@ -1106,6 +1220,7 @@ function handleAsSent($mailbox) { * @param string $sButton fake a submit button * @param array $aUid fake the $msg array * @return string $sError error string in case of an error + * @since 1.5.1 * @author Marc Groot Koerkamp */ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = array()) { @@ -1155,7 +1270,7 @@ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = ar $aUpdatedMsgs = sqimap_toggle_flag($imapConnection, $aUid, $sFlag, $bSet, true); break; case 'move': - $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox); + $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox,true,$mailbox); sqsession_register($targetMailbox,'lastTargetMailbox'); $bExpunge = true; break; @@ -1247,7 +1362,7 @@ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = ar /** * on expunge we do not know which messages will be deleted * so it's useless to try to sync the cache - + * * Close the mailbox so we do not need to parse the untagged expunge * responses which do not contain uid info. * NB: Closing a mailbox is faster then expunge because the imap @@ -1264,6 +1379,14 @@ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = ar return $sError; } +/** + * Attach messages to a compose session + * + * @param resource $imapConnection imap connection + * @param array $aMsgHeaders + * @return int $composesession unique compose_session_id where the attached messages belong to + * @author Marc Groot Koerkamp + */ function attachSelectedMessages($imapConnection,$aMsgHeaders) { global $username, $attachment_dir, $data_dir;