*
* $Id$
*/
-require_once('../functions/imap_utf7_encode_local.php');
-require_once('../functions/imap_utf7_decode_local.php');
+require_once(SM_PATH . 'functions/imap_utf7_encode_local.php');
+require_once(SM_PATH . 'functions/imap_utf7_decode_local.php');
global $boxesnew;
class mailboxes {
return ($acmp>$bcmp) ? 1: -1;
}
-
function find_mailbox_name ($mailbox) {
if (ereg(" *\"([^\r\n\"]*)\"[ \r\n]*$", $mailbox, $regs))
return $regs[1];
ereg(" *([^ \r\n\"]*)[ \r\n]*$",$mailbox,$regs);
return $regs[1];
-
+}
+
+function check_is_noselect ($lsub_line) {
+ return preg_match("/^\* LSUB \([^\)]*\\Noselect[^\)]*\)/i", $lsub_line);
}
/**
}
/* Expunges a mailbox */
-function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true) {
- $read = sqimap_run_command($imap_stream, 'EXPUNGE', $handle_errors,
- $response, $message);
+function sqimap_mailbox_expunge ($imap_stream, $mailbox, $handle_errors = true, $id='') {
+ global $uid_support;
+ if ($id) {
+ if (is_array($id)) {
+ $id = sqimap_message_list_squisher($id);
+ }
+ $id = ' '.$id;
+ $uid = $uid_support;
+ } else {
+ $uid = false;
+ }
+ $read = sqimap_run_command($imap_stream, 'EXPUNGE'.$id, $handle_errors,
+ $response, $message, $uid);
+ $cnt = 0;
+
+ if ( is_array( $read ) ) {
+ foreach ($read as $r) {
+ if (preg_match('/^\*\s[0-9]+\sEXPUNGE/AUi',$r,$regs)) {
+ $cnt++;
+ }
+ }
+ }
+ return $cnt;
}
/* Checks whether or not the specified mailbox exists */
$inbox_in_list = false;
$inbox_subscribed = false;
- require_once('../src/load_prefs.php');
- require_once('../functions/array.php');
+ require_once(SM_PATH . 'include/load_prefs.php');
+ require_once(SM_PATH . 'functions/array.php');
if ($noselect_fix_enable) {
$lsub_args = "LSUB \"$folder_prefix\" \"*%\"";
$used[$k] = true;
}
$spec_sub = str_replace(' ', '', $box['formatted']);
- $spec_sub = str_replace('*', '', $spec_sub);
- $spec_sub = str_replace('?', '\?', $spec_sub);
+ $spec_sub = preg_replace("/(\*|\[|\]|\(|\)|\?|\+|\{|\}|\^|\\$)/", '\\\\'.'\\1', $spec_sub);
/* In case of problems with preg
here is a ereg version
function sqimap_mailbox_list_all($imap_stream) {
global $list_special_folders_first, $folder_prefix, $delimiter;
- require_once('../functions/array.php');
+ require_once(SM_PATH . 'functions/array.php');
$ssid = sqimap_session_id();
$lsid = strlen( $ssid );
$inbox_in_list = false;
$inbox_subscribed = false;
- require_once('../src/load_prefs.php');
- require_once('../functions/array.php');
+ require_once(SM_PATH . 'include/load_prefs.php');
+ require_once(SM_PATH . 'functions/array.php');
/* LSUB array */
$lsub_ary = sqimap_run_command ($imap_stream, "LSUB \"$folder_prefix\" \"*\"",
// $sorted_lsub_ary[] = array ('mbx' => $mbx, 'flag' => $flag);
// }
$mbx = find_mailbox_name($lsub_ary[$i]);
+ $noselect = check_is_noselect($lsub_ary[$i]);
if (substr($mbx, -1) == $delimiter) {
$mbx = substr($mbx, 0, strlen($mbx) - 1);
}
- $sorted_lsub_ary[] = array ('mbx' => $mbx, 'flag' => '');
+ $sorted_lsub_ary[] = array ('mbx' => $mbx, 'noselect' => $noselect);
}
array_multisort($sorted_lsub_ary, SORT_ASC, SORT_REGULAR);
if (isset($mbx_ary[$i]['nummessages'])) {
$mbx->total = $mbx_ary[$i]['nummessages'];
}
+
+ $mbx->is_noselect = $mbx_ary[$i]['noselect'];
$r_del_pos = strrpos($mbx_ary[$i]['mbx'], $delimiter);
if ($r_del_pos) {