summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-11-08 20:22:34 +0100
committerAleksander Machniak <alec@alec.pl>2012-11-10 12:04:38 +0100
commitc442f822fb9b961f7a92930e572edb52159391d3 (patch)
treeb623ac96927243ee1d78ba751879cbe452ea1925 /program/js
parentfb53c809a632a0f4122f0ef76cb8958a4ed7f6e1 (diff)
Simplify keep-alive action. Now the interval is based on session_lifetime,
which means it's executed only if needed for session keeping (reset interval on every action). Temporarily remove check-recent request, it will be replaced by new global system refresh request in future. Use keep_alive setting as auto-refresh request interval (allow no-refresh mode)
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 7764c6c86..f372c0f9e 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -952,9 +952,6 @@ function rcube_webmail()
break;
}
- // re-set keep-alive timeout
- this.start_keepalive();
-
this.submit_messageform(true);
break;
@@ -6077,6 +6074,9 @@ function rcube_webmail()
$('<a>').attr('href', url).appendTo(document.body).get(0).click();
else
target.location.href = url;
+
+ // reset keep-alive interval
+ this.start_keepalive();
};
// send a http request to the server
@@ -6105,6 +6105,9 @@ function rcube_webmail()
success: function(data){ ref.http_response(data); },
error: function(o, status, err) { ref.http_error(o, status, err, lock, action); }
});
+
+ // reset keep-alive interval
+ this.start_keepalive();
};
// send a http POST request to the server
@@ -6137,6 +6140,9 @@ function rcube_webmail()
success: function(data){ ref.http_response(data); },
error: function(o, status, err) { ref.http_error(o, status, err, lock, action); }
});
+
+ // reset keep-alive interval
+ this.start_keepalive();
};
// aborts ajax request
@@ -6264,6 +6270,9 @@ function rcube_webmail()
this.triggerEvent('responseafter', {response: response});
this.triggerEvent('responseafter'+response.action, {response: response});
+
+ // reset keep-alive interval
+ this.start_keepalive();
};
// handle HTTP request errors
@@ -6288,8 +6297,6 @@ function rcube_webmail()
// re-send keep-alive requests after 30 seconds
if (action == 'keep-alive')
setTimeout(function(){ ref.keep_alive(); ref.start_keepalive(); }, 30000);
- else if (action == 'check-recent')
- setTimeout(function(){ ref.check_for_recent(false); ref.start_keepalive(); }, 30000);
};
// post the given form to a hidden iframe
@@ -6459,20 +6466,16 @@ function rcube_webmail()
}
};
-
- // starts interval for keep-alive/check-recent signal
+ // starts interval for keep-alive signal
this.start_keepalive = function()
{
- if (!this.env.keep_alive || this.env.framed)
+ if (!this.env.session_lifetime || this.env.framed || this.task == 'login' || this.env.action == 'print')
return;
if (this._int)
clearInterval(this._int);
- if (this.task == 'mail' && this.gui_objects.mailboxlist)
- this._int = setInterval(function(){ ref.check_for_recent(false); }, this.env.keep_alive * 1000);
- else if (this.task != 'login' && this.env.action != 'print')
- this._int = setInterval(function(){ ref.keep_alive(); }, this.env.keep_alive * 1000);
+ this._int = setInterval(function(){ ref.keep_alive(); }, this.env.session_lifetime * 0.5 * 1000);
};
// sends keep-alive signal
@@ -6493,8 +6496,6 @@ function rcube_webmail()
if (refresh) {
lock = this.set_busy(true, 'checkingmail');
url._refresh = 1;
- // reset check-recent interval
- this.start_keepalive();
}
if (this.gui_objects.messagelist)