File/nasmail/functions/imap_messages.php

Description

imap_messages.php

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

This script contains size sorting patches by Christopher E. Brown.

  • version: $Id: imap_messages.php 1444 2009-08-05 18:34:37Z tokul $
  • copyright: (c) 1999-2006 The SquirrelMail Project Team
  • copyright: (c) 2006-2009 The NaSMail Project
  • license: GNU Public License
Functions
elapsedTime (line 477)

Calculates difference between given gettimeofday() value and current time

FIXME: profiling function

  • return: difference between $start and current time in microseconds
  • deprecated: 1.2 - 2007.06.16 - function will be removed in NaSMail 2.0. Don't use it in released plugins.
integer elapsedTime (array $start)
  • array $start: start time in gettimeofday() format.
get_parent_level (line 286)

Returns an indent array for printMessageinfo()

This represents the amount of indent needed (value), for this message number (key)

  • todo: fix it. don't write code that depends on this function
array get_parent_level (stream $imap_stream)
  • stream $imap_stream: IMAP connection resource
get_reference_header (line 110)

Returns the reference headers

array get_reference_header (stream $imap_stream, string $message)
  • stream $imap_stream: IMAP connection resource
  • string $message: message ids in IMAP sequence set format
get_thread_sort (line 394)

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

$response and $message don't have defaults. PHP4 E_PARSE issue. Function should be called with four arguments.

  • return: array with sorted message ids or 'no' string on unknown imap response
array|string get_thread_sort (stream $imap_stream, [boolean $handle_errors = true], string &$response, string &$message)
  • stream $imap_stream: IMAP connection resource
  • boolean $handle_errors: handle_errors (since 1.2) Controls error handling in THREAD command.
  • string &$response: response (since 1.2) Returns IMAP response
  • string &$message: message (since 1.2) Returns IMAP message
nsm_imap_msgs_next (line 1047)

Locates next message ID

Given an IMAP message id number, this will look it up in the cached and sorted msgs array and return the index. Used for finding the next and previous messages.

In NaSMail 1.0-1.4 function is called findNextMessage() and used only in src/read_body.php.

  • return: id of next valid message from message array
  • since: 1.5
integer nsm_imap_msgs_next (integer $passed_id)
  • integer $passed_id: Message id
nsm_imap_msgs_prev (line 1093)

Locates previous message ID

In NaSMail 1.0-1.4 function is called findPreviousMessage() and used only in src/read_body.php.

  • return: id of previous message in message array
  • since: 1.5
integer nsm_imap_msgs_prev (integer $passed_id)
  • integer $passed_id: message id
parseArray (line 540)

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

  • return: a
array parseArray (string $read, integer &$i)
  • string $read: read imap response
  • integer &$i: i (reference) offset in string
parsePriority (line 562)

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.

  • return: 1 - urgent, 3 - normal, 5 - non-urgent or any other numeric priority value
integer parsePriority (string $sValue)
  • string $sValue: priority header value
parseString (line 491)

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, integer &$i)
  • string $read: read imap response
  • integer &$i: i (reference) offset in string
sqimap_get_headerfield (line 844)

Gets specified field values for all messages in current mailbox

  • deprecated:
array sqimap_get_headerfield (stream $imap_stream, string $field)
  • stream $imap_stream: imap_stream IMAP connection resource
  • string $field: field Fetched field name
sqimap_get_message (line 906)

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

Since NaSMail 1.3 function automatically selects mailbox and uses cached message information. If you use this function in third party plugins and want to keep backwards compatibility, execute sqimap_mailbox_select() call before calling sqimap_get_message() or include own message cache implementation.

object Message sqimap_get_message (stream $imap_stream, int $id, string $mailbox)
  • stream $imap_stream: imap_stream IMAP connection resource
  • int $id: id Message ID. If $uid_support is on, message UID should be used.
  • string $mailbox: mailbox Mailbox name
sqimap_get_php_sort_order (line 240)

Get sort order from server if server does not have the SORT extension and return it as array for mailbox_display.

  • return: or 'no' string on unknown imap response
array|string sqimap_get_php_sort_order (resource $imap_stream, array $mbxresponse)
  • resource $imap_stream
  • array $mbxresponse: response from a sqimap_mailbox_select
sqimap_get_small_header_list (line 586)

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

  • return: message data
array sqimap_get_small_header_list (stream $imap_stream, array|string $msg_list, [int $show_num = false])
  • stream $imap_stream: imap_stream IMAP connection resource
  • array|string $msg_list: msg_list array or string with message ids. string must follow IMAP message sequence set format
  • int $show_num: show_num Value of '999999' triggers '1:*' listing. Any other value does nothing
sqimap_get_sort_order (line 141)

Get sort order from server and return it as the $id array for mailbox_display

$response and $message don't have defaults. PHP4 E_PARSE issue. Function should be called with six arguments.

  • return: array with message ids. if sort or search command fails with unknown error, 'no' string is returned.
array|string sqimap_get_sort_order (stream $imap_stream, integer $sort, array $mbxresponse, [boolean $handle_errors = true], string &$response, string &$message)
  • stream $imap_stream: IMAP connection resource
  • integer $sort: message sorting order. 0 - date reversed, 1 - date, 2 - from reversed, 3 - from, 4 - subject reversed, 5 - subject, 6 - unsorted. Since 1.4 parameter also support 8-9 for size sorting and 10-11 for to field sorting.
  • array $mbxresponse: response from a sqimap_mailbox_select
  • boolean $handle_errors: handle_errors (since 1.2) Controls error handling in SORT command. If $sort=6, IMAP SEARCH command is executed and sorting is handled internally.
  • string &$response: response (since 1.2) Returns IMAP response
  • string &$message: message (since 1.2) Returns IMAP message
sqimap_messages_copy (line 958)

Copies specified messages to specified folder

  • return: true, if message copy command was successful. false on error.
  • deprecated: Use sqimap_msgs_list_copy() instead.
boolean sqimap_messages_copy (stream $imap_stream, string $start, string $end, string $mailbox, [boolean $handle_errors = true])
  • stream $imap_stream: IMAP connection resource
  • string $start: starting message id or uid.
  • string $end: end message id or uid
  • string $mailbox: target mailbox
  • boolean $handle_errors: handle errors
sqimap_messages_delete (line 973)

Deletes specified message range and moves them to trash if possible

  • deprecated: Use sqimap_msgs_list_delete() instead.
void sqimap_messages_delete (stream $imap_stream, int $start, int $end, string $mailbox)
  • stream $imap_stream: IMAP connection resource
  • int $start: Starting message ID
  • int $end: Ending message ID
  • string $mailbox: Current mailbox
sqimap_messages_flag (line 997)

Sets the specified messages with specified flag

  • deprecated: Use sqimap_toggle_flag() instead.
void sqimap_messages_flag (stream $imap_stream, int $start, int $end, string $flag, boolean $handle_errors)
  • stream $imap_stream: IMAP connection resource
  • int $start: Start message ID
  • int $end: End message ID
  • string $flag: Modified flag
  • boolean $handle_errors: Error handling
sqimap_messages_remove_flag (line 1012)

Removes specified flag from specified messages

  • deprecated: Use sqimap_toggle_flag() instead.
void sqimap_messages_remove_flag (stream $imap_stream, int $start, int $end, string $flag, boolean $handle_errors)
  • stream $imap_stream: IMAP connection resource
  • int $start: Start message ID
  • int $end: End message ID
  • string $flag: Removed flag
  • boolean $handle_errors: error handling
sqimap_message_list_squisher (line 80)

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

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

  • return: message ids in IMAP message sequence set format
string sqimap_message_list_squisher ( $messages_array, array|string $id)
  • array|string $id: array or string with message ids. string must follow IMAP message sequence set format
  • $messages_array
sqimap_msgs_list_copy (line 31)

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

This function is not compatible with SquirrelMail 1.4.8 sqimap_msgs_list_copy() function. In SquirrelMail function moves messages. In NaSMail messages are copied.

void sqimap_msgs_list_copy (stream $imap_stream, array|string $id, string $mailbox)
  • stream $imap_stream: imap_stream IMAP connection resource
  • array|string $id: id array or string with message ids. string must follow IMAP message sequence set format
  • string $mailbox: mailbox target mailbox
sqimap_msgs_list_delete (line 60)

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

void sqimap_msgs_list_delete (stream $imap_stream, string $mailbox, array|string $id)
  • stream $imap_stream: IMAP connection resource
  • string $mailbox: current mailbox
  • array|string $id: array or string with message ids. string must follow IMAP message sequence set format
sqimap_msgs_list_move (line 45)

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

void sqimap_msgs_list_move (stream $imap_stream, array|string $id, string $mailbox)
  • stream $imap_stream: IMAP connection resource
  • array|string $id: array or string with message ids. string must follow IMAP message sequence set format
  • string $mailbox: target mailbox
sqimap_toggle_flag (line 1027)

Changes flag on selected messages

void sqimap_toggle_flag (stream $imap_stream, array|string $id, string $flag, boolean $set, boolean $handle_errors)
  • string $flag: Modified flag
  • boolean $set: New flag value
  • boolean $handle_errors: error handling
  • stream $imap_stream: imap_stream IMAP connection resource
  • array|string $id: id array or string with message ids. string must follow IMAP message sequence set format

Documentation generated on Sun, 22 Nov 2009 17:36:39 +0200 by phpDocumentor 1.4.3