If I like to always sort my messages ascending or descending, it can become a
pain to have to select that every time I log into RC|Mail. I'm submitting
some patches to fix this, so that the search column and search order is
saved.
set_sort_user_pref.diff sets the sort column/order into the session
user_prefs . This is done when the message list is reloaded with a new sort
param (which is done when you click on a column heading). However, the
session user_prefs aren't saved normally (unless you go into preferences)
which necessitates the following patch.
save_prefs_on_logout.diff saves the session user_prefs into the preferences
column of the user table in the database, so that it can be restored later.
This is done just before the session is destroyed.
--
Jacob Brunson
BYU Chemistry Department Webmaster
Index: program/steps/mail/list.inc
===================================================================
RCS file: /cvsroot/roundcubemail/roundcubemail/program/steps/mail/list.inc,v
retrieving revision 1.8
diff -u -r1.8 list.inc
--- program/steps/mail/list.inc 27 Mar 2006 19:07:13 -0000 1.8
+++ program/steps/mail/list.inc 1 Apr 2006 00:58:54 -0000
@@ -33,6 +33,10 @@
// set session vars for sort (so next page and task switch know how to sort)
$_SESSION['sort_col'] = $sort_col;
$_SESSION['sort_order'] = $sort_order;
+
+ //set user preferences
+ $_SESSION['user_prefs']['message_sort_col'] = $sort_col;
+ $_SESSION['user_prefs']['message_sort_order'] = $sort_order;
}
else
{
Index: program/include/main.inc
===================================================================
RCS file: /cvsroot/roundcubemail/roundcubemail/program/include/main.inc,v
retrieving revision 1.48
diff -u -r1.48 main.inc
--- program/include/main.inc 23 Mar 2006 22:32:32 -0000 1.48
+++ program/include/main.inc 1 Apr 2006 01:07:06 -0000
@@ -219,10 +219,13 @@
// destroy session data and remove cookie
function rcmail_kill_session()
{
-/* $sess_name = session_name();
- if (isset($_COOKIE[$sess_name]))
- setcookie($sess_name, '', time()-42000, '/');
-*/
+ global $DB;
+
+ $DB->query("UPDATE ".get_table_name('users')."
+ SET preferences=?
+ WHERE user_id=?",
+ serialize($_SESSION['user_prefs']),
+ $_SESSION['user_id']);
$_SESSION = array();
session_destroy();
}