thread sort view is now saved per folder thanks Robert Packard
This commit is contained in:
parent
7db9a937dc
commit
eb7eb24b9b
3 changed files with 13 additions and 5 deletions
|
@ -174,10 +174,12 @@ function sqimap_unsubscribe ($imap_stream, $mailbox) {
|
||||||
|
|
||||||
/* Deletes the given folder */
|
/* Deletes the given folder */
|
||||||
function sqimap_mailbox_delete ($imap_stream, $mailbox) {
|
function sqimap_mailbox_delete ($imap_stream, $mailbox) {
|
||||||
|
global $data_dir, $username;
|
||||||
$read_ary = sqimap_run_command($imap_stream, "DELETE \"$mailbox\"",
|
$read_ary = sqimap_run_command($imap_stream, "DELETE \"$mailbox\"",
|
||||||
true, $response, $message);
|
true, $response, $message);
|
||||||
sqimap_unsubscribe ($imap_stream, $mailbox);
|
sqimap_unsubscribe ($imap_stream, $mailbox);
|
||||||
do_hook_function("rename_or_delete_folder", $args = array($mailbox, 'delete', ''));
|
do_hook_function("rename_or_delete_folder", $args = array($mailbox, 'delete', ''));
|
||||||
|
removePref($data_dir, $username, "thread_$mailbox");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determines if the user is subscribed to the folder or not */
|
/* Determines if the user is subscribed to the folder or not */
|
||||||
|
@ -194,7 +196,7 @@ function sqimap_mailbox_is_subscribed($imap_stream, $folder) {
|
||||||
/* Renames a mailbox */
|
/* Renames a mailbox */
|
||||||
function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
|
function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
|
||||||
if ( $old_name != $new_name ) {
|
if ( $old_name != $new_name ) {
|
||||||
global $delimiter, $imap_server_type;
|
global $delimiter, $imap_server_type, $data_dir, $username;
|
||||||
if ( substr( $old_name, -1 ) == $delimiter ) {
|
if ( substr( $old_name, -1 ) == $delimiter ) {
|
||||||
$old_name = substr( $old_name, 0, strlen( $old_name ) - 1 );
|
$old_name = substr( $old_name, 0, strlen( $old_name ) - 1 );
|
||||||
$new_name = substr( $new_name, 0, strlen( $new_name ) - 1 );
|
$new_name = substr( $new_name, 0, strlen( $new_name ) - 1 );
|
||||||
|
@ -206,7 +208,10 @@ function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
|
||||||
$cmd = 'RENAME "' . quoteIMAP($old_name) . '" "' . quoteIMAP($new_name) . '"';
|
$cmd = 'RENAME "' . quoteIMAP($old_name) . '" "' . quoteIMAP($new_name) . '"';
|
||||||
$data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
|
$data = sqimap_run_command($imap_stream, $cmd, true, $response, $message);
|
||||||
sqimap_unsubscribe($imap_stream, $old_name.$postfix);
|
sqimap_unsubscribe($imap_stream, $old_name.$postfix);
|
||||||
|
$oldpref = getPref($data_dir, $username, "thread_".$old_name.$postfix);
|
||||||
|
removePref($data_dir, $username, "thread_".$old_name.$postfix);
|
||||||
sqimap_subscribe($imap_stream, $new_name.$postfix);
|
sqimap_subscribe($imap_stream, $new_name.$postfix);
|
||||||
|
setPref($data_dir, $username, "thread_".$new_name.$postfix, $oldpref);
|
||||||
do_hook_function("rename_or_delete_folder",$args = array($old_name, 'rename', $new_name));
|
do_hook_function("rename_or_delete_folder",$args = array($old_name, 'rename', $new_name));
|
||||||
$l = strlen( $old_name ) + 1;
|
$l = strlen( $old_name ) + 1;
|
||||||
$p = 'unformatted';
|
$p = 'unformatted';
|
||||||
|
@ -219,7 +224,10 @@ function sqimap_mailbox_rename( $imap_stream, $old_name, $new_name ) {
|
||||||
$response, $message);
|
$response, $message);
|
||||||
}
|
}
|
||||||
sqimap_unsubscribe($imap_stream, $box[$p]);
|
sqimap_unsubscribe($imap_stream, $box[$p]);
|
||||||
|
$oldpref = getPref($data_dir, $username, "thread_".$box[$p]);
|
||||||
|
removePref($data_dir, $username, "thread_".$box[$p]);
|
||||||
sqimap_subscribe($imap_stream, $new_sub);
|
sqimap_subscribe($imap_stream, $new_sub);
|
||||||
|
setPref($data_dir, $username, "thread_".$new_sub, $oldpref);
|
||||||
do_hook_function("rename_or_delete_folder",
|
do_hook_function("rename_or_delete_folder",
|
||||||
$args = array($box[$p], 'rename', $new_sub));
|
$args = array($box[$p], 'rename', $new_sub));
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ $sig_first = getPref($data_dir, $username, 'sig_first', 0);
|
||||||
$internal_date_sort = getPref($data_dir, $username, 'internal_date_sort', SMPREF_ON);
|
$internal_date_sort = getPref($data_dir, $username, 'internal_date_sort', SMPREF_ON);
|
||||||
|
|
||||||
/* if thread sorting is enabled/disabled */
|
/* if thread sorting is enabled/disabled */
|
||||||
$thread_sort_messages = getPref($data_dir, $username, 'thread_sort_messages', 0);
|
$thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox", 0);
|
||||||
$sort_by_ref = getPref($data_dir, $username, 'sort_by_ref', 1);
|
$sort_by_ref = getPref($data_dir, $username, 'sort_by_ref', 1);
|
||||||
|
|
||||||
/* Load the javascript settings. */
|
/* Load the javascript settings. */
|
||||||
|
|
|
@ -52,16 +52,16 @@ global $allow_thread_sort;
|
||||||
if ($allow_thread_sort == TRUE) {
|
if ($allow_thread_sort == TRUE) {
|
||||||
if (isset($set_thread)) {
|
if (isset($set_thread)) {
|
||||||
if ($set_thread == 1) {
|
if ($set_thread == 1) {
|
||||||
setPref($data_dir, $username, 'thread_sort_messages', 1);
|
setPref($data_dir, $username, "thread_$mailbox", 1);
|
||||||
$thread_sort_messages = '1';
|
$thread_sort_messages = '1';
|
||||||
}
|
}
|
||||||
elseif ($set_thread == 2) {
|
elseif ($set_thread == 2) {
|
||||||
setPref($data_dir, $username, 'thread_sort_messages', 0);
|
setPref($data_dir, $username, "thread_$mailbox", 0);
|
||||||
$thread_sort_messages = '0';
|
$thread_sort_messages = '0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$thread_sort_messages = getPref($data_dir, $username, 'thread_sort_messages');
|
$thread_sort_messages = getPref($data_dir, $username, "thread_$mailbox");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue