From 2fd975071a43147b054adaa857008f6ae2ee245f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 28 Nov 2008 14:03:24 -0500
Subject: [PATCH] Option to check for new mails in all folders (#1484374)

---
 program/steps/settings/func.inc |   49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index 6e8c6b5..6a158b9 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -148,6 +148,13 @@
   
   $table = new html_table(array('cols' => 2));
 
+  if (!isset($no_override['focus_on_new_message'])) {
+    $field_id = 'rcmfd_focus_on_new_message';
+    $input_focus_on_new_message = new html_checkbox(array('name' => '_focus_on_new_message', 'id' => $field_id, 'value' => 1));
+    $table->add('title', html::label($field_id, Q(rcube_label('focusonnewmessage'))));
+    $table->add(null, $input_focus_on_new_message->show($config['focus_on_new_message']?1:0));
+  }
+
   // show config parameter for preview pane
   if (!isset($no_override['preview_pane'])) {
     $field_id = 'rcmfd_preview';
@@ -166,6 +173,27 @@
 
     $table->add('title', html::label($field_id, Q(rcube_label('mdnrequests'))));
     $table->add(null, $select_mdn_requests->show($config['mdn_requests']));
+  }
+
+  if (!isset($no_override['keep_alive'])) {
+    $field_id = 'rcmfd_keep_alive';
+    $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id));
+
+    foreach(array(1, 3, 5, 10, 15, 30, 60) as $min)
+      if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60)
+          && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) {
+        $select_keep_alive->add(rcube_label(array('name' => 'keepaliveevery', 'vars' => array('n' => $min))), $min);
+      }
+
+    $table->add('title', html::label($field_id, Q(rcube_label('keepalive'))));
+    $table->add(null, $select_keep_alive->show($config['keep_alive']/60));
+  }
+
+  if (!isset($no_override['check_all_folders'])) {
+    $field_id = 'rcmfd_check_all_folders';
+    $input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1));
+    $table->add('title', html::label($field_id, Q(rcube_label('checkallfolders'))));
+    $table->add(null, $input_check_all->show($config['check_all_folders']?1:0));
   }
 
   $out .= html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('mailboxview'))) . $table->show($attrib));
@@ -294,7 +322,7 @@
     $table->add('title', html::label($field_id, Q(rcube_label('skipdeleted'))));
     $table->add(null, $input_purge->show($config['skip_deleted']?1:0));
   }
-  
+
   // Trash purging on logout
   if (!isset($no_override['logout_purge'])) {
     $field_id = 'rcmfd_logout_purge';
@@ -394,7 +422,24 @@
   return $skins;
   }
 
-$OUTPUT->set_env('multiple_identities', $RCMAIL->config->get('multiple_identities', true));
+
+function rcmail_get_email()
+  {
+  global $RCMAIL;
+  
+  if (strpos($RCMAIL->user->data['username'], '@'))
+    return $RCMAIL->user->data['username'];
+  else {
+    if ($RCMAIL->config->get('virtuser_file'))
+      $user_email = rcube_user::user2email($RCMAIL->user->data['username']);
+
+    if ($user_email == '')
+      $user_email = sprintf('%s@%s', $RCMAIL->user->data['username'], 
+    	    $RCMAIL->config->mail_domain($_SESSION['imap_host']));
+
+    return $user_email;
+    }		      
+  }
 
 // register UI objects
 $OUTPUT->add_handlers(array(

--
Gitblit v1.9.1