alecpl
2008-10-26 95d90f86d9c5482b531092776181943c9bf57642
- Added 'keep_alive' and 'min_keep_alive' options (#1485360)


8 files modified
54 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
config/main.inc.php.dist 17 ●●●● patch | view | raw | blame | history
program/include/rcmail.php 8 ●●●●● patch | view | raw | blame | history
program/js/app.js 2 ●●● patch | view | raw | blame | history
program/localization/en_US/labels.inc 2 ●●●●● patch | view | raw | blame | history
program/localization/pl_PL/labels.inc 2 ●●●●● patch | view | raw | blame | history
program/steps/settings/func.inc 14 ●●●●● patch | view | raw | blame | history
program/steps/settings/save_prefs.inc 8 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -4,6 +4,7 @@
2008/10/25 (alec)
----------
- Don't send disposition notification receipts for messages marked as 'read' (#1485523)
- Added 'keep_alive' and 'min_keep_alive' options (#1485360)
2008/10/24 (alec)
----------
config/main.inc.php.dist
@@ -107,17 +107,18 @@
// Log sent messages
$rcmail_config['smtp_log'] = TRUE;
// how many seconds must pass between emails sent by a user
// How many seconds must pass between emails sent by a user
$rcmail_config['sendmail_delay'] = 0;
// these cols are shown in the message list
// These cols are shown in the message list
// available cols are: subject, from, to, cc, replyto, date, size, encoding, flag
$rcmail_config['list_cols'] = array('subject', 'from', 'date', 'size', 'flag');
// includes should be interpreted as PHP files
// Includes should be interpreted as PHP files
$rcmail_config['skin_include_php'] = FALSE;
// session lifetime in minutes
// Session lifetime in minutes
// must be greater than 'keep_alive'/60
$rcmail_config['session_lifetime'] = 10;
// check client IP in session athorization
@@ -327,6 +328,10 @@
 */
$rcmail_config['delete_always'] = false;
// Minimal value of user's 'keep_alive' setting (in seconds)
// Must be less than 'session_lifetime'
$rcmail_config['min_keep_alive'] = 60;
/***** these settings can be overwritten by user's preferences *****/
// skin name: folder from skins/
@@ -390,5 +395,9 @@
// false causes deleted messages to be permanantly removed if there is no Trash folder
$rcmail_config['flag_for_deletion'] = FALSE;
// Default interval for keep-alive/check-recent requests (in seconds)
// Must be greater than or equal to 'min_keep_alive' and less than 'session_lifetime'
$rcmail_config['keep_alive'] = 60;
// end of config file
?>
program/include/rcmail.php
@@ -289,6 +289,14 @@
    foreach (array('flag_for_deletion','read_when_deleted') as $js_config_var) {
      $this->output->set_env($js_config_var, $this->config->get($js_config_var));
    }
    // set keep-alive/check-recent interval
    if ($keep_alive = $this->config->get('keep_alive')) {
      // be sure that it's less than session lifetime
      if ($session_lifetime = $this->config->get('session_lifetime'))
        $keep_alive = min($keep_alive, $session_lifetime * 60 - 30);
      $this->output->set_env('keep_alive', max(60, $keep_alive));
    }
    if ($framed) {
      $this->comm_path .= '&_framed=1';
program/js/app.js
@@ -366,7 +366,7 @@
    if (this.env.keep_alive && !this.env.framed && this.task=='mail' && this.gui_objects.mailboxlist)
      this._int = setInterval(function(){ ref.check_for_recent(); }, this.env.keep_alive * 1000);
    else if (this.env.keep_alive && !this.env.framed && this.task!='login')
      this._int = setInterval(function(){ ref.send_keep_alive(); }, this.env.keep_alive * 1000);
      this._int = setInterval(function(){ ref.send_keep_alive(); }, this.env.keep_alive * 1000);
    }
  this.init_message_row = function(row)
program/localization/en_US/labels.inc
@@ -282,6 +282,8 @@
$labels['showinlineimages'] = 'Display attached images below the message';
$labels['autosavedraft']  = 'Automatically save draft';
$labels['everynminutes']  = 'every $n minutes';
$labels['keepaliveevery']  = 'every $n minute(s)';
$labels['keepalive']  = 'Check for new messages on';
$labels['never']  = 'never';
$labels['messagesdisplaying'] = 'Displaying Messages';
$labels['messagescomposition'] = 'Composing Messages';
program/localization/pl_PL/labels.inc
@@ -230,6 +230,8 @@
$labels['skipdeleted'] = 'Ukryj wiadomości oznaczone do usunięcia';
$labels['autosavedraft'] = 'Automatyczny zapis tworzonej wiadomości';
$labels['everynminutes'] = 'co $n minut(y)';
$labels['keepalive']  = 'Sprawdzaj czy nadeszły nowe wiadomości';
$labels['keepaliveevery']  = 'co $n minut(y)';
$labels['never'] = 'nigdy';
$labels['focusonnewmessage'] = 'Informuj przeglądarkę o nowej wiadomości';
$labels['folder'] = 'Folder';
program/steps/settings/func.inc
@@ -175,6 +175,20 @@
    $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));
  }
  $out .= html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label('mailboxview'))) . $table->show($attrib));
  $table = new html_table(array('cols' => 2));
program/steps/settings/save_prefs.inc
@@ -37,6 +37,7 @@
  'logout_purge' => isset($_POST['_logout_purge']) ? TRUE : FALSE,
  'logout_expunge' => isset($_POST['_logout_expunge']) ? TRUE : FALSE,
  'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0,
  'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'],
  'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
  'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
  'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'],
@@ -78,6 +79,13 @@
if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['pagesize'] > $CONFIG['max_pagesize']))
  $a_user_prefs['pagesize'] = (int) $CONFIG['max_pagesize'];
// force keep_alive
if (isset($a_user_prefs['keep_alive'])) {
    $a_user_prefs['keep_alive'] = max(60, $CONFIG['min_keep_alive'], $a_user_prefs['keep_alive']);
    if (!empty($CONFIG['session_lifetime']))
      $a_user_prefs['keep_alive'] = min($CONFIG['session_lifetime']*60, $a_user_prefs['keep_alive']);
}
if ($USER->save_prefs($a_user_prefs))
  $OUTPUT->show_message('successfullysaved', 'confirmation');