summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-29 17:16:45 +0000
committeralecpl <alec@alec.pl>2010-05-29 17:16:45 +0000
commit7ceabc8815ef27557826380d649e18942b02c814 (patch)
treec200be227789e9acc1793380b40925ce5d1af8f8
parentac8edbed3542fb62cf23b49a0dfd6f4692898be5 (diff)
- Add request* event triggers in http_post/http_request (#1486054)
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js24
2 files changed, 23 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 00fb61a51..86694689d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG RoundCube Webmail
===========================
+- Add request* event triggers in http_post/http_request (#1486054)
- Fix use RFC-compliant line-delimiter when saving messages on IMAP (#1486712)
- Add 'imap_timeout' option (#1486760)
- Fix forwarding of messages with winmail attachments
diff --git a/program/js/app.js b/program/js/app.js
index fbbae4a0b..dcc212071 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4884,9 +4884,19 @@ function rcube_webmail()
// send a http request to the server
this.http_request = function(action, querystring, lock)
{
- querystring += (querystring ? '&' : '') + '_remote=1';
- var url = this.env.comm_path + '&_action=' + action + '&' + querystring
+ // trigger plugin hook
+ var result = this.triggerEvent('request'+action, querystring);
+ if (typeof result != 'undefined') {
+ // abort if one the handlers returned false
+ if (result === false)
+ return false;
+ else
+ querystring = result;
+ }
+ querystring += (querystring ? '&' : '') + '_remote=1';
+ var url = this.env.comm_path + '&_action=' + action + '&' + querystring;
+
// send request
console.log('HTTP GET: ' + url);
$.get(url, { _unlock:(lock?1:0) }, function(data){ ref.http_response(data); }, 'json');
@@ -4904,6 +4914,16 @@ function rcube_webmail()
else
postdata += (postdata ? '&' : '') + '_remote=1' + (lock ? '&_unlock=1' : '');
+ // trigger plugin hook
+ var result = this.triggerEvent('request'+action, postdata);
+ if (typeof result != 'undefined') {
+ // abort if one the handlers returned false
+ if (result === false)
+ return false;
+ else
+ postdata = result;
+ }
+
// send request
console.log('HTTP POST: ' + url);
$.post(url, postdata, function(data){ ref.http_response(data); }, 'json');