alecpl
2010-05-29 7ceabc8815ef27557826380d649e18942b02c814
- Add request* event triggers in http_post/http_request (#1486054)


2 files modified
23 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/js/app.js 22 ●●●●● patch | view | raw | blame | history
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
program/js/app.js
@@ -4884,8 +4884,18 @@
  // send a http request to the server
  this.http_request = function(action, querystring, lock)
  {
    // 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
    var url = this.env.comm_path + '&_action=' + action + '&' + querystring;
    // send request
    console.log('HTTP GET: ' + url);
@@ -4904,6 +4914,16 @@
    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');