function isSpecialMailbox( $box ) {
global $trash_folder, $sent_folder, $draft_folder,
- $move_to_trash, $move_to_sent, $save_as_draft,
- $delimiter, $folder_prefix, $imap_server_type;
+ $move_to_trash, $move_to_sent, $save_as_draft;
$ret = ( (strtolower($box) == 'inbox') ||
( $move_to_trash && isBoxBelow( $box, $trash_folder ) ) ||
( $move_to_sent && isBoxBelow( $box, $sent_folder )) ||
- ($box == $draft_folder &&
- $save_as_draft) );
+ ($save_as_draft && $box == $draft_folder ) );
+
+ if ( !$ret ) {
+ $ret = do_hook_function( 'special_mailbox', $box );
+ }
return( $ret );
** Selects a mailbox
******************************************************************************/
function sqimap_mailbox_select ($imap_stream, $mailbox,
- $hide=TRUE, $recent=false)
+ $hide=TRUE, $recent=false, $extrainfo=false)
{
global $auto_expunge;
-
+
if ( $mailbox == 'None' ) {
return;
}
-
+
$read = sqimap_run_command($imap_stream, "SELECT \"$mailbox\"",
TRUE, $response, $message);
if ($recent) {
}
}
return $r[1];
- }
- if ($auto_expunge) {
- $tmp = sqimap_run_command($imap_stream, 'EXPUNGE',
+ } else {
+ if ($auto_expunge) {
+ $tmp = sqimap_run_command($imap_stream, 'EXPUNGE',
false, $a, $b);
+ }
+ if (isset( $extrainfo ) && $extrainfo) {
+ $result = array();
+ for ($i=0; $i<count($read); $i++) {
+ if (preg_match("/PERMANENTFLAGS(.*)/i",$read[$i], $regs)) {
+ $regs[1]=trim(preg_replace ( array ("/\(/","/\)/","/\]/") ,'', $regs[1])) ;
+ $result['PERMANENTFLAGS'] = $regs[1];
+ }
+ else if (preg_match("/FLAGS(.*)/i",$read[$i], $regs)) {
+ $regs[1]=trim(preg_replace ( array ("/\(/","/\)/") ,'', $regs[1])) ;
+ $result["FLAGS"] = $regs[1];
+ }
+ else if (preg_match("/(.*)EXISTS/i",$read[$i], $regs)) {
+ $result['EXISTS']=trim($regs[1]);
+ }
+ else if (preg_match("/(.*)RECENT/i",$read[$i], $regs)) {
+ $result['RECENT']=trim($regs[1]);
+ }
+ else if (preg_match("/\[UNSEEN(.*)\]/i",$read[$i], $regs)) {
+ $result['UNSEEN']=trim($regs[1]);
+ }
+
+ }
+ return( $result );
+ }
}
}
/******************************************************************************
- ** Creates a folder
+ ** Creates a folder
******************************************************************************/
function sqimap_mailbox_create ($imap_stream, $mailbox, $type)
{
}
$read_ary = sqimap_run_command($imap_stream, "CREATE \"$mailbox\"",
TRUE, $response, $message);
-
+
sqimap_subscribe ($imap_stream, $mailbox);
}
** See comment on sqimap_mailbox_parse() for info about the returned array.
******************************************************************************/
function sqimap_mailbox_list ($imap_stream) {
+
global $data_dir, $username, $list_special_folders_first,
$folder_prefix, $trash_folder, $sent_folder, $draft_folder,
$move_to_trash, $move_to_sent, $save_as_draft,
$delimiter;
- $inbox_in_list = false;
- $inbox_subscribed = false;
+ $inbox_in_list = $inbox_subscribed = FALSE;
require_once('../src/load_prefs.php');
require_once('../functions/array.php');
}
return( $boxesnew );
+
}
/*
global $list_special_folders_first, $folder_prefix;
global $delimiter;
- if (!function_exists('ary_sort')) {
- include_once('../functions/array.php');
- }
+ require_once('../functions/array.php');
$ssid = sqimap_session_id();
$lsid = strlen( $ssid );
if (substr($read_ary[$i], 0, $lsid) != $ssid ) {
/* Store the raw IMAP reply */
- $boxes[$g]["raw"] = $read_ary[$i];
+ $boxes[$g]['raw'] = $read_ary[$i];
/* Count number of delimiters ($delimiter) in folder name */
$mailbox = find_mailbox_name($read_ary[$i]);