/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 452)
void elapsedTime ( $start)
  • $start
get_squirrel_sort (line 223)

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 312)

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 543)

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 631)

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
parsePriority (line 471)

Normalise the different Priority headers into a uniform value, namely that of the X-Priority header (1, 3, 5). Supports: Prioirty, X-Priority, Importance.

X-MS-Mail-Priority is not parsed because it always coincides with one of the other headers.

FIXME: DUPLICATE CODE ALERT: NOTE: this is actually a duplicate from the function in class/mime/Rfc822Header.php.

  • todo: obsolate function or use it instead of code block in parseFetch()
void parsePriority ( $sValue)
  • $sValue
parseString (line 493)

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 200)

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)
sqimap_get_message (line 917)

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

See the documentation folder for more information about this array.

  • return: Message object
Message sqimap_get_message (resource $imap_stream, integer $id, string $mailbox)
  • 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
sqimap_get_small_header_list (line 569)

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 160)

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 124)

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 68)

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 (mixed $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
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 875)

Work in process

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

Work in process

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

Set a flag on the provided uid list

  • return: array with messages containing the new flags and UID @see parseFetch
array sqimap_toggle_flag (mixed $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

Documentation generated on Sat, 07 Oct 2006 16:11:47 +0300 by phpDocumentor 1.3.0RC6