dovecot-2.2: lib-storage: Removed min_timeout parameter from mai...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 26 04:59:58 EET 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/5e4e6c57c142
changeset: 14218:5e4e6c57c142
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 26 04:59:36 2012 +0200
description:
lib-storage: Removed min_timeout parameter from mailbox_notify_changes()
It's now internally taken from mailbox_idle_check_interval setting.
diffstat:
src/imap/cmd-idle.c | 10 ++--------
src/lib-storage/index/imapc/imapc-storage.c | 5 +++--
src/lib-storage/index/index-mailbox-check.c | 5 +++--
src/lib-storage/mail-storage-private.h | 1 -
src/lib-storage/mail-storage.c | 5 ++---
src/lib-storage/mail-storage.h | 10 +++++-----
src/plugins/virtual/virtual-storage.c | 6 ++----
7 files changed, 17 insertions(+), 25 deletions(-)
diffs (148 lines):
diff -r 36fc5b533562 -r 5e4e6c57c142 src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c Sat Feb 25 07:36:11 2012 +0200
+++ b/src/imap/cmd-idle.c Sun Feb 26 04:59:36 2012 +0200
@@ -253,14 +253,8 @@
ctx->client = client;
idle_add_keepalive_timeout(ctx);
- if (client->mailbox != NULL) {
- const struct mail_storage_settings *set;
-
- set = mailbox_get_settings(client->mailbox);
- mailbox_notify_changes(client->mailbox,
- set->mailbox_idle_check_interval,
- idle_callback, ctx);
- }
+ if (client->mailbox != NULL)
+ mailbox_notify_changes(client->mailbox, idle_callback, ctx);
client_send_line(client, "+ idling");
io_remove(&client->io);
diff -r 36fc5b533562 -r 5e4e6c57c142 src/lib-storage/index/imapc/imapc-storage.c
--- a/src/lib-storage/index/imapc/imapc-storage.c Sat Feb 25 07:36:11 2012 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c Sun Feb 26 04:59:36 2012 +0200
@@ -705,10 +705,11 @@
static void imapc_notify_changes(struct mailbox *box)
{
struct imapc_mailbox *mbox = (struct imapc_mailbox *)box;
+ const struct mail_storage_settings *set = box->storage->set;
struct imapc_command *cmd;
enum imapc_capability capa;
- if (box->notify_min_interval == 0) {
+ if (box->notify_callback == NULL) {
if (mbox->to_idle_check != NULL)
timeout_remove(&mbox->to_idle_check);
return;
@@ -728,7 +729,7 @@
check for changes with NOOP every once in a while. */
i_assert(!imapc_client_is_running(mbox->storage->client));
mbox->to_idle_check =
- timeout_add(box->notify_min_interval * 1000,
+ timeout_add(set->mailbox_idle_check_interval * 1000,
imapc_idle_timeout, mbox);
}
}
diff -r 36fc5b533562 -r 5e4e6c57c142 src/lib-storage/index/index-mailbox-check.c
--- a/src/lib-storage/index/index-mailbox-check.c Sat Feb 25 07:36:11 2012 +0200
+++ b/src/lib-storage/index/index-mailbox-check.c Sun Feb 26 04:59:36 2012 +0200
@@ -67,12 +67,13 @@
void index_mailbox_check_add(struct mailbox *box, const char *path)
{
struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
+ const struct mail_storage_settings *set = box->storage->set;
struct index_notify_file *file;
struct stat st;
struct io *io = NULL;
struct index_notify_io *aio;
- i_assert(box->notify_min_interval > 0);
+ i_assert(set->mailbox_idle_check_interval > 0);
(void)io_add_notify(path, notify_callback, box, &io);
if (io != NULL) {
@@ -94,7 +95,7 @@
* when the filesystem is remote (NFS, ...) */
if (ibox->notify_to == NULL) {
ibox->notify_to =
- timeout_add(box->notify_min_interval * 1000,
+ timeout_add(set->mailbox_idle_check_interval * 1000,
check_timeout, box);
}
}
diff -r 36fc5b533562 -r 5e4e6c57c142 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Sat Feb 25 07:36:11 2012 +0200
+++ b/src/lib-storage/mail-storage-private.h Sun Feb 26 04:59:36 2012 +0200
@@ -241,7 +241,6 @@
enum mailbox_feature enabled_features;
/* Mailbox notification settings: */
- unsigned int notify_min_interval;
mailbox_notify_callback_t *notify_callback;
void *notify_context;
diff -r 36fc5b533562 -r 5e4e6c57c142 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Sat Feb 25 07:36:11 2012 +0200
+++ b/src/lib-storage/mail-storage.c Sun Feb 26 04:59:36 2012 +0200
@@ -1343,10 +1343,9 @@
}
#undef mailbox_notify_changes
-void mailbox_notify_changes(struct mailbox *box, unsigned int min_interval,
+void mailbox_notify_changes(struct mailbox *box,
mailbox_notify_callback_t *callback, void *context)
{
- box->notify_min_interval = min_interval;
box->notify_callback = callback;
box->notify_context = context;
@@ -1355,7 +1354,7 @@
void mailbox_notify_changes_stop(struct mailbox *box)
{
- mailbox_notify_changes(box, 0, NULL, NULL);
+ mailbox_notify_changes(box, NULL, NULL);
}
struct mail_search_context *
diff -r 36fc5b533562 -r 5e4e6c57c142 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Sat Feb 25 07:36:11 2012 +0200
+++ b/src/lib-storage/mail-storage.h Sun Feb 26 04:59:36 2012 +0200
@@ -485,16 +485,16 @@
int mailbox_sync(struct mailbox *box, enum mailbox_sync_flags flags);
/* Call given callback function when something changes in the mailbox. */
-void mailbox_notify_changes(struct mailbox *box, unsigned int min_interval,
+void mailbox_notify_changes(struct mailbox *box,
mailbox_notify_callback_t *callback, void *context);
#ifdef CONTEXT_TYPE_SAFETY
-# define mailbox_notify_changes(box, min_interval, callback, context) \
+# define mailbox_notify_changes(box, callback, context) \
({(void)(1 ? 0 : callback((struct mailbox *)NULL, context)); \
- mailbox_notify_changes(box, min_interval, \
+ mailbox_notify_changes(box, \
(mailbox_notify_callback_t *)callback, context); })
#else
-# define mailbox_notify_changes(box, min_interval, callback, context) \
- mailbox_notify_changes(box, min_interval, \
+# define mailbox_notify_changes(box, callback, context) \
+ mailbox_notify_changes(box, \
(mailbox_notify_callback_t *)callback, context)
#endif
void mailbox_notify_changes_stop(struct mailbox *box);
diff -r 36fc5b533562 -r 5e4e6c57c142 src/plugins/virtual/virtual-storage.c
--- a/src/plugins/virtual/virtual-storage.c Sat Feb 25 07:36:11 2012 +0200
+++ b/src/plugins/virtual/virtual-storage.c Sun Feb 26 04:59:36 2012 +0200
@@ -391,10 +391,8 @@
if (box->notify_callback == NULL)
mailbox_notify_changes_stop(bbox);
- else {
- mailbox_notify_changes(bbox, box->notify_min_interval,
- virtual_notify_callback, box);
- }
+ else
+ mailbox_notify_changes(bbox, virtual_notify_callback, box);
}
}
More information about the dovecot-cvs
mailing list