From b461a2d72ea1fa2f7488710e5c5329848adf43fd Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 21 Oct 2013 10:03:03 -0400
Subject: [PATCH] Send last fetch time with 'refresh' requests and allow plugins to alter query parameters of http requests
---
index.php | 2 +-
program/js/app.js | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/index.php b/index.php
index 3be71f2..1719abc 100644
--- a/index.php
+++ b/index.php
@@ -294,7 +294,7 @@
}
if ($RCMAIL->action == 'refresh') {
- $RCMAIL->plugins->exec_hook('refresh', array());
+ $RCMAIL->plugins->exec_hook('refresh', array('last' => intval(rcube_utils::get_input_value('_last', rcube_utils::INPUT_GPC))));
}
// parse main template (default)
diff --git a/program/js/app.js b/program/js/app.js
index ac49b4e..0170736 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -463,6 +463,7 @@
// flag object as complete
this.loaded = true;
+ this.env.lastrefresh = new Date();
// show message
if (this.pending_message)
@@ -6298,7 +6299,7 @@
if (result === false)
return false;
else
- query = result;
+ url = this.url(action, result);
}
url += '&_remote=1';
@@ -6743,6 +6744,9 @@
if (this.task == 'mail' && this.gui_objects.mailboxlist)
params = this.check_recent_params();
+ params._last = Math.floor(this.env.lastrefresh.getTime() / 1000);
+ this.env.lastrefresh = new Date();
+
// plugins should bind to 'requestrefresh' event to add own params
this.http_request('refresh', params, lock);
};
--
Gitblit v1.9.1