| | |
| | | public $delimiter = NULL; |
| | | public $threading = false; |
| | | public $fetch_add_headers = ''; |
| | | public $conn; // rcube_imap_generic object |
| | | |
| | | /** |
| | | * Instance of rcube_imap_generic |
| | | * |
| | | * @var rcube_imap_generic |
| | | */ |
| | | public $conn; |
| | | |
| | | /** |
| | | * Instance of rcube_mdb2 |
| | | * |
| | | * @var rcube_mdb2 |
| | | */ |
| | | private $db; |
| | | private $root_ns = ''; |
| | | private $mailbox = 'INBOX'; |
| | |
| | | /** |
| | | * Connect to an IMAP server |
| | | * |
| | | * @param string Host to connect |
| | | * @param string Username for IMAP account |
| | | * @param string Password for IMAP account |
| | | * @param number Port to connect to |
| | | * @param string SSL schema (either ssl or tls) or null if plain connection |
| | | * @param string $host Host to connect |
| | | * @param string $user Username for IMAP account |
| | | * @param string $pass Password for IMAP account |
| | | * @param integer $port Port to connect to |
| | | * @param string $use_ssl SSL schema (either ssl or tls) or null if plain connection |
| | | * @return boolean TRUE on success, FALSE on failure |
| | | * @access public |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Set options to be used in rcube_imap_generic::connect() |
| | | * |
| | | * @param array $opt Options array |
| | | */ |
| | | function set_options($opt) |
| | | { |
| | |
| | | * Only folders within this root folder will be displayed |
| | | * and all folder paths will be translated using this folder name |
| | | * |
| | | * @param string Root folder |
| | | * @param string $root Root folder |
| | | * @access public |
| | | */ |
| | | function set_rootdir($root) |
| | |
| | | * |
| | | * This will be used for message decoding if a charset specification is not available |
| | | * |
| | | * @param string Charset string |
| | | * @param string $cs Charset string |
| | | * @access public |
| | | */ |
| | | function set_charset($cs) |
| | |
| | | /** |
| | | * This list of folders will be listed above all other folders |
| | | * |
| | | * @param array Indexed list of folder names |
| | | * @param array $arr Indexed list of folder names |
| | | * @access public |
| | | */ |
| | | function set_default_mailboxes($arr) |
| | |
| | | * |
| | | * All operations will be perfomed on this mailbox/folder |
| | | * |
| | | * @param string Mailbox/Folder name |
| | | * @param string $new_mbox Mailbox/Folder name |
| | | * @access public |
| | | */ |
| | | function set_mailbox($new_mbox) |
| | |
| | | /** |
| | | * Set internal list page |
| | | * |
| | | * @param number Page number to list |
| | | * @param number $page Page number to list |
| | | * @access public |
| | | */ |
| | | function set_page($page) |
| | |
| | | /** |
| | | * Set internal page size |
| | | * |
| | | * @param number Number of messages to display on one page |
| | | * @param number $size Number of messages to display on one page |
| | | * @access public |
| | | */ |
| | | function set_pagesize($size) |
| | |
| | | /** |
| | | * Returns the IMAP server's capability |
| | | * |
| | | * @param string Capability name |
| | | * @param string $cap Capability name |
| | | * @return mixed Capability value or TRUE if supported, FALSE if not |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Sets threading flag to the best supported THREAD algorithm |
| | | * |
| | | * @param boolean TRUE to enable and FALSE |
| | | * @param boolean $enable TRUE to enable and FALSE |
| | | * @return string Algorithm or false if THREAD is not supported |
| | | * @access public |
| | | */ |
| | |
| | | * Checks the PERMANENTFLAGS capability of the current mailbox |
| | | * and returns true if the given flag is supported by the IMAP server |
| | | * |
| | | * @param string Permanentflag name |
| | | * @param string $flag Permanentflag name |
| | | * @return mixed True if this flag is supported |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Get message count for a specific mailbox |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param string Mode for count [ALL|THREADS|UNSEEN|RECENT] |
| | | * @param boolean Force reading from server and update cache |
| | | * @param boolean Enables storing folder status info (max UID/count), |
| | | * required for mailbox_status() |
| | | * @param string $mbox_name Mailbox/folder name |
| | | * @param string $mode Mode for count [ALL|THREADS|UNSEEN|RECENT] |
| | | * @param boolean $force Force reading from server and update cache |
| | | * @param boolean $status Enables storing folder status info (max UID/count), |
| | | * required for mailbox_status() |
| | | * @return int Number of messages |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Private method for getting nr of messages |
| | | * |
| | | * @param string $mailbox Mailbox name |
| | | * @param string $mode Mode for count [ALL|THREADS|UNSEEN|RECENT] |
| | | * @param boolean $force Force reading from server and update cache |
| | | * @param boolean $status Enables storing folder status info (max UID/count), |
| | | * required for mailbox_status() |
| | | * @return int Number of messages |
| | | * @access private |
| | | * @see rcube_imap::messagecount() |
| | | */ |
| | |
| | | /** |
| | | * Private method for getting nr of threads |
| | | * |
| | | * @param string $mailbox |
| | | * @param int $msg_count |
| | | * @access private |
| | | * @see rcube_imap::messagecount() |
| | | */ |
| | |
| | | * Public method for listing headers |
| | | * convert mailbox name with root dir first |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param int Current page to list |
| | | * @param string Header field to sort by |
| | | * @param string Sort order [ASC|DESC] |
| | | * @param boolean Number of slice items to extract from result array |
| | | * @param string $mbox_name Mailbox/folder name |
| | | * @param int $page Current page to list |
| | | * @param string $sort_field Header field to sort by |
| | | * @param string $sort_order Sort order [ASC|DESC] |
| | | * @param int $slice Number of slice items to extract from result array |
| | | * @return array Indexed array with message header objects |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Private method for listing message headers |
| | | * |
| | | * @param string $mailbox Mailbox name |
| | | * @param int $page Current page to list |
| | | * @param string $sort_field Header field to sort by |
| | | * @param string $sort_order Sort order [ASC|DESC] |
| | | * @param int $slice Number of slice items to extract from result array |
| | | * @return array Indexed array with message header objects |
| | | * @access private |
| | | * @see rcube_imap::list_headers |
| | | */ |
| | |
| | | /** |
| | | * Private method for listing message headers using threads |
| | | * |
| | | * @param string $mailbox Mailbox/folder name |
| | | * @param int $page Current page to list |
| | | * @param string $sort_field Header field to sort by |
| | | * @param string $sort_order Sort order [ASC|DESC] |
| | | * @param boolean $recursive |
| | | * @param int $slice Number of slice items to extract from result array |
| | | * @return array Indexed array with message header objects |
| | | * @access private |
| | | * @see rcube_imap::list_headers |
| | | */ |
| | |
| | | /** |
| | | * Private method for fetching threads data |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param string $mailbox Mailbox/folder name |
| | | * @return array Array with thread data |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * Private method for fetching threaded messages headers |
| | | * |
| | | * @param string $mailbox Mailbox name |
| | | * @param string $thread_tree |
| | | * @param int $msg_depth |
| | | * @param boolean $has_children |
| | | * @param int $msg_index |
| | | * @param int $page |
| | | * @param int $slice |
| | | * @access private |
| | | */ |
| | | private function _fetch_thread_headers($mailbox, $thread_tree, $msg_depth, $has_children, $msg_index, $page, $slice=0) |
| | |
| | | * Private method for setting threaded messages flags: |
| | | * depth, has_children and unread_children |
| | | * |
| | | * @param array Reference to headers array indexed by message ID |
| | | * @param array Array of messages depth indexed by message ID |
| | | * @param array Array of messages children flags indexed by message ID |
| | | * @param array $headers Reference to headers array indexed by message ID |
| | | * @param array $msg_depth Array of messages depth indexed by message ID |
| | | * @param array $msg_children Array of messages children flags indexed by message ID |
| | | * @return array Message headers array indexed by message ID |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * Private method for listing a set of message headers (search results) |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param int Current page to list |
| | | * @param string Header field to sort by |
| | | * @param string Sort order [ASC|DESC] |
| | | * @param boolean Number of slice items to extract from result array |
| | | * @param string $mailbox Mailbox/folder name |
| | | * @param int $page Current page to list |
| | | * @param string $sort_field Header field to sort by |
| | | * @param string $sort_order Sort order [ASC|DESC] |
| | | * @param int $slice Number of slice items to extract from result array |
| | | * @return array Indexed array with message header objects |
| | | * @access private |
| | | * @see rcube_imap::list_header_set() |
| | |
| | | /** |
| | | * Private method for listing a set of threaded message headers (search results) |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param int Current page to list |
| | | * @param string Header field to sort by |
| | | * @param string Sort order [ASC|DESC] |
| | | * @param boolean Number of slice items to extract from result array |
| | | * @param string $mailbox Mailbox/folder name |
| | | * @param int $page Current page to list |
| | | * @param string $sort_field Header field to sort by |
| | | * @param string $sort_order Sort order [ASC|DESC] |
| | | * @param int $slice Number of slice items to extract from result array |
| | | * @return array Indexed array with message header objects |
| | | * @access private |
| | | * @see rcube_imap::list_header_set() |
| | |
| | | /** |
| | | * Helper function to get first and last index of the requested set |
| | | * |
| | | * @param int message count |
| | | * @param mixed page number to show, or string 'all' |
| | | * @param int $max message count |
| | | * @param mixed $page page number to show, or string 'all' |
| | | * @return array array with two values: first index, last index |
| | | * @access private |
| | | */ |
| | |
| | | * We compare the maximum UID to determine the number of |
| | | * new messages because the RECENT flag is not reliable. |
| | | * |
| | | * @param string Mailbox/folder name |
| | | * @param string $mbox_name Mailbox/folder name |
| | | * @return int Folder status |
| | | */ |
| | | function mailbox_status($mbox_name = null) |
| | |
| | | * Stores folder statistic data in session |
| | | * @TODO: move to separate DB table (cache?) |
| | | * |
| | | * @param string Mailbox name |
| | | * @param string Data name |
| | | * @param mixed Data value |
| | | * @param string $mbox_name Mailbox name |
| | | * @param string $name Data name |
| | | * @param mixed $data Data value |
| | | */ |
| | | private function set_folder_stats($mbox_name, $name, $data) |
| | | { |
| | |
| | | /** |
| | | * Gets folder statistic data |
| | | * |
| | | * @param string Mailbox name |
| | | * @param string $mbox_name Mailbox name |
| | | * @return array Stats data |
| | | */ |
| | | private function get_folder_stats($mbox_name) |
| | |
| | | /** |
| | | * Return sorted array of message IDs (not UIDs) |
| | | * |
| | | * @param string Mailbox to get index from |
| | | * @param string Sort column |
| | | * @param string Sort order [ASC, DESC] |
| | | * @param string $mbox_name Mailbox to get index from |
| | | * @param string $sort_field Sort column |
| | | * @param string $sort_order Sort order [ASC, DESC] |
| | | * @return array Indexed array with message ids |
| | | */ |
| | | function message_index($mbox_name='', $sort_field=NULL, $sort_order=NULL) |
| | |
| | | /** |
| | | * Return sorted array of threaded message IDs (not UIDs) |
| | | * |
| | | * @param string Mailbox to get index from |
| | | * @param string Sort column |
| | | * @param string Sort order [ASC, DESC] |
| | | * @param string $mbox_name Mailbox to get index from |
| | | * @param string $sort_field Sort column |
| | | * @param string $sort_order Sort order [ASC, DESC] |
| | | * @return array Indexed array with message IDs |
| | | */ |
| | | function thread_index($mbox_name='', $sort_field=NULL, $sort_order=NULL) |
| | |
| | | /** |
| | | * Return array of threaded messages (all, not only roots) |
| | | * |
| | | * @param string Mailbox to get index from |
| | | * @param array Threaded messages array (see _fetch_threads()) |
| | | * @param array Message IDs if we know what we need (e.g. search result) |
| | | * for better performance |
| | | * @param string $mailbox Mailbox to get index from |
| | | * @param array $thread_tree Threaded messages array (see _fetch_threads()) |
| | | * @param array $ids Message IDs if we know what we need (e.g. search result) |
| | | * for better performance |
| | | * @return array Indexed array with message IDs |
| | | * |
| | | * @access private |
| | |
| | | |
| | | |
| | | /** |
| | | * @param string $mailbox Mailbox name |
| | | * @access private |
| | | */ |
| | | private function sync_header_index($mailbox) |
| | |
| | | /** |
| | | * Invoke search request to IMAP server |
| | | * |
| | | * @param string mailbox name to search in |
| | | * @param string search string |
| | | * @param string search string charset |
| | | * @param string header field to sort by |
| | | * @param string $mbox_name mailbox name to search in |
| | | * @param string $str search string |
| | | * @param string $charset search string charset |
| | | * @param string $sort_field header field to sort by |
| | | * @return array search results as list of message ids |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Private search method |
| | | * |
| | | * @param string $mailbox Mailbox name |
| | | * @param string $criteria Search criteria |
| | | * @param string $charset Charset |
| | | * @param string $sort_field Sorting field |
| | | * @return array search results as list of message ids |
| | | * @access private |
| | | * @see rcube_imap::search() |
| | |
| | | * Direct (real and simple) SEARCH request to IMAP server, |
| | | * without result sorting and caching |
| | | * |
| | | * @param string Mailbox name to search in |
| | | * @param string Search string |
| | | * @param boolean True if UIDs should be returned |
| | | * @param string $mbox_name Mailbox name to search in |
| | | * @param string $str Search string |
| | | * @param boolean $ret_uid True if UIDs should be returned |
| | | * @return array Search results as list of message IDs or UIDs |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Converts charset of search criteria string |
| | | * |
| | | * @param string Search string |
| | | * @param string Original charset |
| | | * @param string Destination charset (default US-ASCII) |
| | | * @param string $str Search string |
| | | * @param string $charset Original charset |
| | | * @param string $dest_charset Destination charset (default US-ASCII) |
| | | * @return string Search string |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * Sort thread |
| | | * |
| | | * @param string Mailbox name |
| | | * @param array Unsorted thread tree (rcube_imap_generic::thread() result) |
| | | * @param array Message IDs if we know what we need (e.g. search result) |
| | | * @param string $mailbox Mailbox name |
| | | * @param array $thread_tree Unsorted thread tree (rcube_imap_generic::thread() result) |
| | | * @param array $ids Message IDs if we know what we need (e.g. search result) |
| | | * @return array Sorted roots IDs |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * THREAD=REFS sorting implementation |
| | | * |
| | | * @param array Thread tree array (message identifiers as keys) |
| | | * @param array Array of sorted message identifiers |
| | | * @param array $tree Thread tree array (message identifiers as keys) |
| | | * @param array $index Array of sorted message identifiers |
| | | * @return array Array of sorted roots messages |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * Check if the given message ID is part of the current search set |
| | | * |
| | | * @param string $msgid Message id |
| | | * @return boolean True on match or if no search request is stored |
| | | */ |
| | | function in_searchset($msgid) |
| | |
| | | /** |
| | | * Return message headers object of a specific message |
| | | * |
| | | * @param int Message ID |
| | | * @param string Mailbox to read from |
| | | * @param boolean True if $id is the message UID |
| | | * @param boolean True if we need also BODYSTRUCTURE in headers |
| | | * @param int $id Message ID |
| | | * @param string $mbox_name Mailbox to read from |
| | | * @param boolean $is_uid True if $id is the message UID |
| | | * @param boolean $bodystr True if we need also BODYSTRUCTURE in headers |
| | | * @return object Message headers representation |
| | | */ |
| | | function get_headers($id, $mbox_name=NULL, $is_uid=true, $bodystr=false) |
| | |
| | | * Fetch body structure from the IMAP server and build |
| | | * an object structure similar to the one generated by PEAR::Mail_mimeDecode |
| | | * |
| | | * @param int Message UID to fetch |
| | | * @param string Message BODYSTRUCTURE string (optional) |
| | | * @param int $uid Message UID to fetch |
| | | * @param string $structure_str Message BODYSTRUCTURE string (optional) |
| | | * @return object rcube_message_part Message part tree or False on failure |
| | | */ |
| | | function &get_structure($uid, $structure_str='') |
| | |
| | | /** |
| | | * Build message part object |
| | | * |
| | | * @param array $part |
| | | * @param int $count |
| | | * @param string $parent |
| | | * @access private |
| | | */ |
| | | function &_structure_part($part, $count=0, $parent='', $mime_headers=null) |
| | |
| | | * Set attachment filename from message part structure |
| | | * |
| | | * @access private |
| | | * @param object rcube_message_part Part object |
| | | * @param string Part's raw headers |
| | | * @param rcube_message_part $part Part object |
| | | * @param string $headers Part's raw headers |
| | | */ |
| | | private function _set_part_filename(&$part, $headers=null) |
| | | { |
| | |
| | | * Get charset name from message structure (first part) |
| | | * |
| | | * @access private |
| | | * @param array Message structure |
| | | * @param array $structure Message structure |
| | | * @return string Charset name |
| | | */ |
| | | function _structure_charset($structure) |
| | |
| | | /** |
| | | * Fetch message body of a specific message from the server |
| | | * |
| | | * @param int Message UID |
| | | * @param string Part number |
| | | * @param object rcube_message_part Part object created by get_structure() |
| | | * @param mixed True to print part, ressource to write part contents in |
| | | * @param resource File pointer to save the message part |
| | | * @param int $uid Message UID |
| | | * @param string $part Part number |
| | | * @param rcube_message_part $o_part Part object created by get_structure() |
| | | * @param mixed $print True to print part, ressource to write part contents in |
| | | * @param resource $fp File pointer to save the message part |
| | | * @return string Message/part body if not printed |
| | | */ |
| | | function &get_message_part($uid, $part=1, $o_part=NULL, $print=NULL, $fp=NULL) |
| | |
| | | /** |
| | | * Fetch message body of a specific message from the server |
| | | * |
| | | * @param int Message UID |
| | | * @return string Message/part body |
| | | * @param int $uid Message UID |
| | | * @return string $part Message/part body |
| | | * @see rcube_imap::get_message_part() |
| | | */ |
| | | function &get_body($uid, $part=1) |
| | |
| | | /** |
| | | * Returns the whole message source as string |
| | | * |
| | | * @param int Message UID |
| | | * @param int $uid Message UID |
| | | * @return string Message source string |
| | | */ |
| | | function &get_raw_body($uid) |
| | |
| | | /** |
| | | * Returns the message headers as string |
| | | * |
| | | * @param int Message UID |
| | | * @param int $uid Message UID |
| | | * @return string Message headers string |
| | | */ |
| | | function &get_raw_headers($uid) |
| | |
| | | /** |
| | | * Sends the whole message source to stdout |
| | | * |
| | | * @param int Message UID |
| | | * @param int $uid Message UID |
| | | */ |
| | | function print_raw_body($uid) |
| | | { |
| | |
| | | /** |
| | | * Set message flag to one or several messages |
| | | * |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| | | * @param string Folder name |
| | | * @param boolean True to skip message cache clean up |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $flag Flag to set: SEEN, UNDELETED, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| | | * @param string $mbox_name Folder name |
| | | * @param boolean $skip_cache True to skip message cache clean up |
| | | * @return int Number of flagged messages, -1 on failure |
| | | */ |
| | | function set_flag($uids, $flag, $mbox_name=NULL, $skip_cache=false) |
| | |
| | | /** |
| | | * Remove message flag for one or several messages |
| | | * |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string Flag to unset: SEEN, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| | | * @param string Folder name |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $flag Flag to unset: SEEN, DELETED, RECENT, ANSWERED, DRAFT, MDNSENT |
| | | * @param string $mbox_name Folder name |
| | | * @return int Number of flagged messages, -1 on failure |
| | | * @see set_flag |
| | | */ |
| | |
| | | /** |
| | | * Append a mail message (source) to a specific mailbox |
| | | * |
| | | * @param string Target mailbox |
| | | * @param string The message source string or filename |
| | | * @param string Headers string if $message contains only the body |
| | | * @param boolean True if $message is a filename |
| | | * @param string $mbox_name Target mailbox |
| | | * @param string $message The message source string or filename |
| | | * @param string $headers Headers string if $message contains only the body |
| | | * @param boolean $is_file True if $message is a filename |
| | | * |
| | | * @return boolean True on success, False on error |
| | | */ |
| | |
| | | /** |
| | | * Move a message from one mailbox to another |
| | | * |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string Target mailbox |
| | | * @param string Source mailbox |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $to_mbox Target mailbox |
| | | * @param string $from_mbox Source mailbox |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | function move_message($uids, $to_mbox, $from_mbox='') |
| | |
| | | /** |
| | | * Copy a message from one mailbox to another |
| | | * |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string Target mailbox |
| | | * @param string Source mailbox |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $to_mbox Target mailbox |
| | | * @param string $from_mbox Source mailbox |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | function copy_message($uids, $to_mbox, $from_mbox='') |
| | |
| | | /** |
| | | * Mark messages as deleted and expunge mailbox |
| | | * |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string Source mailbox |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $mbox_name Source mailbox |
| | | * @return boolean True on success, False on error |
| | | */ |
| | | function delete_message($uids, $mbox_name='') |
| | |
| | | /** |
| | | * Clear all messages in a specific mailbox |
| | | * |
| | | * @param string Mailbox name |
| | | * @param string $mbox_name Mailbox name |
| | | * @return int Above 0 on success |
| | | */ |
| | | function clear_mailbox($mbox_name=NULL) |
| | |
| | | /** |
| | | * Send IMAP expunge command and clear cache |
| | | * |
| | | * @param string Mailbox name |
| | | * @param boolean False if cache should not be cleared |
| | | * @param string $mbox_name Mailbox name |
| | | * @param boolean $clear_cache False if cache should not be cleared |
| | | * @return boolean True on success |
| | | */ |
| | | function expunge($mbox_name='', $clear_cache=true) |
| | |
| | | /** |
| | | * Send IMAP expunge command and clear cache |
| | | * |
| | | * @param string Mailbox name |
| | | * @param boolean False if cache should not be cleared |
| | | * @param mixed Message UIDs as array or comma-separated string, or '*' |
| | | * @param string $mailbox Mailbox name |
| | | * @param boolean $clear_cache False if cache should not be cleared |
| | | * @param mixed $uids Message UIDs as array or comma-separated string, or '*' |
| | | * @return boolean True on success |
| | | * @access private |
| | | * @see rcube_imap::expunge() |
| | |
| | | /** |
| | | * Parse message UIDs input |
| | | * |
| | | * @param mixed UIDs array or comma-separated list or '*' or '1:*' |
| | | * @param string Mailbox name |
| | | * @param mixed $uids UIDs array or comma-separated list or '*' or '1:*' |
| | | * @param string $mailbox Mailbox name |
| | | * @return array Two elements array with UIDs converted to list and ALL flag |
| | | * @access private |
| | | */ |
| | |
| | | /** |
| | | * Translate UID to message ID |
| | | * |
| | | * @param int Message UID |
| | | * @param string Mailbox name |
| | | * @param int $uid Message UID |
| | | * @param string $mbox_name Mailbox name |
| | | * @return int Message ID |
| | | */ |
| | | function get_id($uid, $mbox_name=NULL) |
| | |
| | | /** |
| | | * Translate message number to UID |
| | | * |
| | | * @param int Message ID |
| | | * @param string Mailbox name |
| | | * @param int $id Message ID |
| | | * @param string $mbox_name Mailbox name |
| | | * @return int Message UID |
| | | */ |
| | | function get_uid($id,$mbox_name=NULL) |
| | |
| | | * |
| | | * Converts mailbox name with root dir first |
| | | * |
| | | * @param string Optional root folder |
| | | * @param string Optional filter for mailbox listing |
| | | * @param string $root Optional root folder |
| | | * @param string $filter Optional filter for mailbox listing |
| | | * @return array List of mailboxes/folders |
| | | * @access public |
| | | */ |
| | |
| | | /** |
| | | * Private method for mailbox listing |
| | | * |
| | | * @param string $root Optional root folder |
| | | * @param string $filter Optional filter for mailbox listing |
| | | * @return array List of mailboxes/folders |
| | | * @see rcube_imap::list_mailboxes() |
| | | * @access private |
| | |
| | | /** |
| | | * Get a list of all folders available on the IMAP server |
| | | * |
| | | * @param string IMAP root dir |
| | | * @param string Optional filter for mailbox listing |
| | | * @param string $root IMAP root dir |
| | | * @param string $filter Optional filter for mailbox listing |
| | | * @return array Indexed array with folder names |
| | | */ |
| | | function list_unsubscribed($root='', $filter='*') |
| | |
| | | /** |
| | | * Subscribe to a specific mailbox(es) |
| | | * |
| | | * @param array Mailbox name(s) |
| | | * @param array $a_mboxes Mailbox name(s) |
| | | * @return boolean True on success |
| | | */ |
| | | function subscribe($a_mboxes) |
| | |
| | | /** |
| | | * Unsubscribe mailboxes |
| | | * |
| | | * @param array Mailbox name(s) |
| | | * @param array $a_mboxes Mailbox name(s) |
| | | * @return boolean True on success |
| | | */ |
| | | function unsubscribe($a_mboxes) |
| | |
| | | /** |
| | | * Create a new mailbox on the server and register it in local cache |
| | | * |
| | | * @param string New mailbox name (as utf-7 string) |
| | | * @param boolean True if the new mailbox should be subscribed |
| | | * @param string $name New mailbox name (as utf-7 string) |
| | | * @param boolean $subscribe True if the new mailbox should be subscribed |
| | | * @param string Name of the created mailbox, false on error |
| | | */ |
| | | function create_mailbox($name, $subscribe=false) |
| | |
| | | /** |
| | | * Set a new name to an existing mailbox |
| | | * |
| | | * @param string Mailbox to rename (as utf-7 string) |
| | | * @param string New mailbox name (as utf-7 string) |
| | | * @param string $mbox_name Mailbox to rename (as utf-7 string) |
| | | * @param string $new_name New mailbox name (as utf-7 string) |
| | | * @return string Name of the renames mailbox, False on error |
| | | */ |
| | | function rename_mailbox($mbox_name, $new_name) |
| | |
| | | /** |
| | | * Remove mailboxes from server |
| | | * |
| | | * @param string Mailbox name(s) string/array |
| | | * @param string|array $mbox_name sMailbox name(s) string/array |
| | | * @return boolean True on success |
| | | */ |
| | | function delete_mailbox($mbox_name) |
| | |
| | | /** |
| | | * Checks if folder exists and is subscribed |
| | | * |
| | | * @param string Folder name |
| | | * @param boolean Enable subscription checking |
| | | * @param string $mbox_name Folder name |
| | | * @param boolean $subscription Enable subscription checking |
| | | * @return boolean TRUE or FALSE |
| | | */ |
| | | function mailbox_exists($mbox_name, $subscription=false) |
| | |
| | | /** |
| | | * Modify folder name for input/output according to root dir and namespace |
| | | * |
| | | * @param string Folder name |
| | | * @param string Mode |
| | | * @param string $mbox_name Folder name |
| | | * @param string $mode Mode |
| | | * @return string Folder name |
| | | */ |
| | | function mod_mailbox($mbox_name, $mode='in') |
| | |
| | | * --------------------------------*/ |
| | | |
| | | /** |
| | | * Enable or disable caching |
| | | * |
| | | * @param boolean $set Flag |
| | | * @access public |
| | | */ |
| | | function set_caching($set) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns cached value |
| | | * |
| | | * @param string $key Cache key |
| | | * @return mixed |
| | | * @access public |
| | | */ |
| | | function get_cache($key) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Update cache |
| | | * |
| | | * @param string $key Cache key |
| | | * @param mixed $data Data |
| | | * @access private |
| | | */ |
| | | private function update_cache($key, $data) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Writes the cache |
| | | * |
| | | * @access private |
| | | */ |
| | | private function write_cache() |
| | |
| | | } |
| | | |
| | | /** |
| | | * Clears the cache. |
| | | * |
| | | * @param string $key Cache key |
| | | * @access public |
| | | */ |
| | | function clear_cache($key=NULL) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns cached entry |
| | | * |
| | | * @param string $key Cache key |
| | | * @return mixed Cached value |
| | | * @access private |
| | | */ |
| | | private function _read_cache_record($key) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Writes single cache record |
| | | * |
| | | * @param string $key Cache key |
| | | * @param mxied $data Cache value |
| | | * @access private |
| | | */ |
| | | private function _write_cache_record($key, $data) |
| | |
| | | } |
| | | |
| | | /** |
| | | * Clears cache for single record |
| | | * |
| | | * @param string $ket Cache key |
| | | * @access private |
| | | */ |
| | | private function _clear_cache_record($key) |
| | |
| | | /** |
| | | * Checks if the cache is up-to-date |
| | | * |
| | | * @param string Mailbox name |
| | | * @param string Internal cache key |
| | | * @param string $mailbox Mailbox name |
| | | * @param string $cache_key Internal cache key |
| | | * @return int Cache status: -3 = off, -2 = incomplete, -1 = dirty, 1 = OK |
| | | */ |
| | | private function check_cache_status($mailbox, $cache_key) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param string $key Cache key |
| | | * @param string $from |
| | | * @param string $to |
| | | * @param string $sort_field |
| | | * @param string $sort_order |
| | | * @access private |
| | | */ |
| | | private function get_message_cache($key, $from, $to, $sort_field, $sort_order) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param string $key Cache key |
| | | * @param int $uid User id |
| | | * @return mixed |
| | | * @access private |
| | | */ |
| | | private function &get_cached_message($key, $uid) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param string $key Cache key |
| | | * @param boolean $force Force flag |
| | | * @param string $sort_field |
| | | * @param string $sort_order |
| | | * @access private |
| | | */ |
| | | private function get_message_cache_index($key, $sort_field='idx', $sort_order='ASC') |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param string $key Cache key |
| | | * @param int $start_index Start index |
| | | * @access private |
| | | */ |
| | | private function clear_message_cache($key, $start_index=1) |
| | |
| | | /** |
| | | * Split an address list into a structured array list |
| | | * |
| | | * @param string Input string |
| | | * @param int List only this number of addresses |
| | | * @param boolean Decode address strings |
| | | * @param string $input Input string |
| | | * @param int $max List only this number of addresses |
| | | * @param boolean $decode Decode address strings |
| | | * @return array Indexed list of addresses |
| | | */ |
| | | function decode_address_list($input, $max=null, $decode=true) |
| | |
| | | /** |
| | | * Decode a message header value |
| | | * |
| | | * @param string Header value |
| | | * @param boolean Remove quotes if necessary |
| | | * @param string $input Header value |
| | | * @param boolean $remove_quotas Remove quotes if necessary |
| | | * @return string Decoded string |
| | | */ |
| | | function decode_header($input, $remove_quotes=false) |
| | |
| | | /** |
| | | * Decode a part of a mime-encoded string |
| | | * |
| | | * @param string $str String to decode |
| | | * @return string Decoded string |
| | | * @access private |
| | | */ |
| | | private function _decode_mime_string_part($str) |
| | |
| | | /** |
| | | * Decode a mime part |
| | | * |
| | | * @param string Input string |
| | | * @param string Part encoding |
| | | * @param string $input Input string |
| | | * @param string $encoding Part encoding |
| | | * @return string Decoded string |
| | | */ |
| | | function mime_decode($input, $encoding='7bit') |
| | |
| | | /** |
| | | * Convert body charset to RCMAIL_CHARSET according to the ctype_parameters |
| | | * |
| | | * @param string Part body to decode |
| | | * @param string Charset to convert from |
| | | * @param string $body Part body to decode |
| | | * @param string $ctype_param Charset to convert from |
| | | * @return string Content converted to internal charset |
| | | */ |
| | | function charset_decode($body, $ctype_param) |
| | |
| | | |
| | | /** |
| | | * Validate the given input and save to local properties |
| | | * |
| | | * @param string $sort_field Sort column |
| | | * @param string $sort_order Sort order |
| | | * @access private |
| | | */ |
| | | private function _set_sort_order($sort_field, $sort_order) |
| | |
| | | |
| | | /** |
| | | * Sort mailboxes first by default folders and then in alphabethical order |
| | | * |
| | | * @param array $a_folders Mailboxes list |
| | | * @access private |
| | | */ |
| | | private function _sort_mailbox_list($a_folders) |
| | |
| | | |
| | | |
| | | /** |
| | | * @param int $uid User id |
| | | * @param string $mbox_name Mailbox name |
| | | * @return int |
| | | * @access private |
| | | */ |
| | | private function _uid2id($uid, $mbox_name=NULL) |
| | |
| | | } |
| | | |
| | | /** |
| | | * @param int $id Id |
| | | * @param string $mbox_name Mailbox name |
| | | * @return int |
| | | * @access private |
| | | */ |
| | | private function _id2uid($id, $mbox_name=NULL) |
| | |
| | | /** |
| | | * Set the predetermined sort order. |
| | | * |
| | | * @param array Numerically indexed array of IMAP message sequence numbers |
| | | * @param array $seqnums Numerically indexed array of IMAP message sequence numbers |
| | | */ |
| | | function set_sequence_numbers($seqnums) |
| | | { |
| | |
| | | /** |
| | | * Sort the array of header objects |
| | | * |
| | | * @param array Array of rcube_mail_header objects indexed by UID |
| | | * @param array $headers Array of rcube_mail_header objects indexed by UID |
| | | */ |
| | | function sort_headers(&$headers) |
| | | { |
| | |
| | | |
| | | /** |
| | | * Sort method called by uasort() |
| | | * |
| | | * @param rcube_mail_header $a |
| | | * @param rcube_mail_header $b |
| | | */ |
| | | function compare_seqnums($a, $b) |
| | | { |