/functions/imap_messages.php

Description

imap_messages.php

This implements functions that manipulate messages NOTE: Quite a few functions in this file are obsolete

Functions
elapsedTime (line 456)
void elapsedTime ( $start)
  • $start
get_squirrel_sort (line 221)

Retrieves an array with a sorted uid list. Sorting is done by SquirrelMail

  • return: sorted uid list
array get_squirrel_sort (resource $imap_stream, string $sSortField, [bool $reverse = false], [array $aUid = NULL])
  • resource $imap_stream: IMAP socket connection
  • string $sSortField: Field to sort on
  • bool $reverse: Reverse order search
  • array $aUid: limit the search to the provided array with uid's default sqimap_get_small_headers uses 1:*
get_thread_sort (line 317)

Returns an array with each element as a string representing one message-thread as returned by the IMAP server.

array get_thread_sort (resource $imap_stream, [string $search = 'ALL'])
  • resource $imap_stream: IMAP socket connection
  • string $search: optional search string
parseArray (line 520)

Parses a string containing an array from an imap response. String starts with ( and end with )

array parseArray (string $read,  &$i, integer $i)
  • string $read: imap response
  • integer $i: (reference) offset in string
  • &$i
parseFetch (line 608)

Parses a fetch response, currently it can hande FLAGS, HEADERS, RFC822.SIZE, INTERNALDATE and UID

  • return: associative array with messages. Key is the UID, value is an associative array
  • author: Marc Groot Koerkamp
array parseFetch ( &$aResponse, [array $aMessageList = array()], array $aResponse)
  • array $aResponse: Imap response
  • array $aMessageList: Placeholder array for results. The keys of the placeholder array should be the UID so we can reconstruct the order.
  • &$aResponse
parseString (line 470)

Parses a string in an imap response. String starts with " or { which means it can handle double quoted strings and literal strings

  • return: parsed string without the double quotes or literal count
string parseString (string $read,  &$i, integer $i)
  • string $read: imap response
  • integer $i: (reference) offset in string
  • &$i
parseUidList (line 198)

Parses a UID list returned on a SORT or SEARCH request

  • return: uid list
array parseUidList (array $aData, string $sCommand)
  • array $aData: imap response (retrieved from sqimap_run_command_list)
  • string $sCommand: issued imap command (SEARCH or SORT)
parse_message_entities (line 957)

Recursively parse embedded messages (if any) in the given message, building correct rfc822 headers for each one

  • since: 1.5.2
void parse_message_entities ( &$msg, int $id, resource $imap_stream, object $msg)
  • object $msg: The message object to scan for attached messages NOTE: this is passed by reference! Changes made within will affect the caller's copy of $msg!
  • int $id: The top-level message UID on the IMAP server, even if the $msg being passed in is only an attached entity thereof.
  • resource $imap_stream: A live connection to the IMAP server.
  • &$msg
sqimap_get_message (line 896)

Returns a message array with all the information about a message.

See the documentation folder for more information about this array.

  • return: Message object or FALSE/error string if error occurred and $hide is set to 2/3
mixed sqimap_get_message (resource $imap_stream, integer $id, string $mailbox, [int $hide = 0])
  • resource $imap_stream: imap connection
  • integer $id: uid of the message
  • string $mailbox: used for error handling, can be removed because we should return an error code and generate the message elsewhere
  • int $hide: Indicates whether or not to hide any errors: 0 = don't hide, 1 = hide (just exit), 2 = hide (return FALSE), 3 = hide (return error string) (OPTIONAL; default don't hide)
sqimap_get_small_header_list (line 546)

Retrieves a list with headers, flags, size or internaldate from the imap server

WARNING: function is not portable between SquirrelMail 1.2.x, 1.4.x and 1.5.x. Output format, third argument and $msg_list array format requirements differ.

  • return: associative array with messages. Key is the UID, value is an associative array
  • since: 1.1.3
array sqimap_get_small_header_list (stream $imap_stream, array $msg_list, [array $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Content-Type')], [array $aFetchItems = array('FLAGS', 'RFC822.SIZE', 'INTERNALDATE')])
  • stream $imap_stream: imap connection
  • array $msg_list: array with id's to create a msgs set from
  • array $aHeaderFields: (since 1.5.0) requested header fields
  • array $aFetchItems: (since 1.5.0) requested other fetch items like FLAGS, RFC822.SIZE
sqimap_get_sort_order (line 158)

Retrieves an array with a sorted uid list. Sorting is done on the imap server

array sqimap_get_sort_order (resource $imap_stream, string $sSortField, bool $reverse, [ $search = 'ALL'])
  • resource $imap_stream: IMAP socket connection
  • string $sSortField: Field to sort on
  • bool $reverse: Reverse order search
  • $search
sqimap_message_list_squisher (line 122)

Sort the message list and crunch to be as small as possible

(overflow could happen, so make it small if possible)

  • return: message set string
string sqimap_message_list_squisher (array $aUid)
  • array $aUid: array with uid's
sqimap_msgs_list_copy (line 25)

Copy a set of messages ($id) to another mailbox ($mailbox)

  • return: If the copy completed without errors
bool sqimap_msgs_list_copy (int $imap_stream, string $id, string $mailbox, [bool $handle_errors = true])
  • int $imap_stream: The resource ID for the IMAP socket
  • string $id: The list of messages to copy
  • string $mailbox: The destination to copy to
  • bool $handle_errors: Show error messages in case of a NO, BAD or BYE response
sqimap_msgs_list_delete (line 67)

Deletes a message and move it to trash or expunge the mailbox

  • return: array with messages containing the new flags and UID @see parseFetch
  • since: 1.4.0
array sqimap_msgs_list_delete (resource $imap_stream, string $mailbox, array $id, [bool $bypass_trash = false])
  • string $mailbox: mailbox, used for checking if it concerns the trash_folder
  • array $id: list with uid's
  • bool $bypass_trash: (since 1.5.0) skip copy to trash
  • resource $imap_stream: imap connection
sqimap_msgs_list_move (line 46)

Move a set of messages ($id) to another mailbox. Deletes the originals.

  • return: If the move completed without errors
bool sqimap_msgs_list_move (int $imap_stream, string $id, string $mailbox, [bool $handle_errors = true], [string $source_mailbox = false])
  • int $imap_stream: The resource ID for the IMAP socket
  • string $id: The list of messages to move
  • string $mailbox: The destination to move to
  • bool $handle_errors: Show error messages in case of a NO, BAD or BYE response
  • string $source_mailbox: (since 1.5.1) name of source mailbox. It is used to validate that target mailbox != source mailbox.
sqimap_parse_address (line 853)

Work in process

  • author: Marc Groot Koerkamp
  • private:
void sqimap_parse_address ( $read,  &$i)
  • $read
  • &$i
sqimap_parse_envelope (line 772)

Work in process

  • author: Marc Groot Koerkamp
  • private:
void sqimap_parse_envelope ( $read,  &$i,  &$msg)
  • $read
  • &$i
  • &$msg
sqimap_toggle_flag (line 91)

Set a flag on the provided uid list

  • return: array with messages containing the new flags and UID @see parseFetch
array sqimap_toggle_flag (resource $imap_stream, array $id, string $flag, bool $set, bool $handle_errors)
  • array $id: list with uid's
  • string $flag: Flags to set/unset flags can be i.e.'\Seen', '\Answered', '\Seen \Answered'
  • bool $set: add (true) or remove (false) the provided flag
  • bool $handle_errors: Show error messages in case of a NO, BAD or BYE response
  • resource $imap_stream: imap connection

Documentation generated on Thu, 24 Apr 2014 04:18:14 +0200 by phpDocumentor 1.4.3