]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Removed min_timeout parameter from mailbox_notify_changes()
authorTimo Sirainen <tss@iki.fi>
Sun, 26 Feb 2012 02:59:36 +0000 (04:59 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 26 Feb 2012 02:59:36 +0000 (04:59 +0200)
It's now internally taken from mailbox_idle_check_interval setting.

src/imap/cmd-idle.c
src/lib-storage/index/imapc/imapc-storage.c
src/lib-storage/index/index-mailbox-check.c
src/lib-storage/mail-storage-private.h
src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h
src/plugins/virtual/virtual-storage.c

index 04bc521d84700232c9f51869f912ed38a5ed812f..ca36ced3777c13209dfdb932aeb483f5f705ed6d 100644 (file)
@@ -253,14 +253,8 @@ bool cmd_idle(struct client_command_context *cmd)
        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);
index b92738071a7fb86b061f67fe9a8bf0ac6f64ee3f..bf1a569009db363a6d895bb7e5463c7449d707dc 100644 (file)
@@ -705,10 +705,11 @@ static void imapc_idle_noop_callback(const struct imapc_command_reply *reply,
 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 @@ static void imapc_notify_changes(struct mailbox *box)
                   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);
        }
 }
index 75dabe4fbfe21dc08a4f6cd72d672bf77116ae0f..7097a032456b4a856fa0d7d890f4de65e55235f9 100644 (file)
@@ -67,12 +67,13 @@ static void notify_callback(struct mailbox *box)
 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 @@ void index_mailbox_check_add(struct mailbox *box, const char *path)
         * 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);
        }
 }
index c506d84958356b8cdf7d18d2a7e9f4b7198ccb22..f16bcffd84282be5567cfb3bac511938f4f287af 100644 (file)
@@ -241,7 +241,6 @@ struct mailbox {
        enum mailbox_feature enabled_features;
 
        /* Mailbox notification settings: */
-       unsigned int notify_min_interval;
        mailbox_notify_callback_t *notify_callback;
        void *notify_context;
 
index 5e48b4eecd45d66efe4e369dbe1ef8680c07a749..b5633c34bec87d07167dd10a0d6360bd551c5e17 100644 (file)
@@ -1343,10 +1343,9 @@ int mailbox_sync(struct mailbox *box, enum mailbox_sync_flags flags)
 }
 
 #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(struct mailbox *box, unsigned int min_interval,
 
 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 *
index c80883d86e9a10f8638822de678744f7be2435d7..eae92c9a69a88d7a4aef1e8944d5f586662d2c88 100644 (file)
@@ -485,16 +485,16 @@ int mailbox_sync_deinit(struct mailbox_sync_context **ctx,
 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);
index d120d2548e867ddd8c446874d41134045033da52..9babba93866fb08ad8ac7a5b2d130ed15d6add8a 100644 (file)
@@ -391,10 +391,8 @@ static void virtual_notify_changes(struct mailbox *box)
 
                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);
        }
 }