]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Implement mailbox_list_notify_flush()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 17 May 2017 16:01:57 +0000 (19:01 +0300)
committerGitLab <gitlab@git.dovecot.net>
Fri, 19 May 2017 14:19:52 +0000 (17:19 +0300)
This flushes any pending notifications. For now it only checks if there's
a pending notification waiting for a timeout. It could also stat() the
files to make sure, but that's probably unnecessary.

src/lib-storage/list/mailbox-list-index-notify.c
src/lib-storage/list/mailbox-list-index.c
src/lib-storage/list/mailbox-list-index.h
src/lib-storage/mailbox-list-notify.c
src/lib-storage/mailbox-list-notify.h
src/lib-storage/mailbox-list-private.h

index 24251b2dcfbd21c44c4981134b0916f5506f9a00..d3516208df74be5895b1db9b4bb7c6d0e97321f4 100644 (file)
@@ -876,3 +876,12 @@ void mailbox_list_index_notify_wait(struct mailbox_list_notify *notify,
                notify_update_stat(inotify);
        }
 }
+
+void mailbox_list_index_notify_flush(struct mailbox_list_notify *notify)
+{
+       struct mailbox_list_notify_index *inotify =
+               (struct mailbox_list_notify_index *)notify;
+
+       if (inotify->to_notify != NULL)
+               notify_now_callback(inotify);
+}
index 052b4c19b724ba99784dcbef1a6bc43877e3c759..f1e851f151853d9b374157edce2cbac7b94d6ce8 100644 (file)
@@ -772,6 +772,7 @@ static void mailbox_list_index_created(struct mailbox_list *list)
        v->notify_next = mailbox_list_index_notify_next;
        v->notify_deinit = mailbox_list_index_notify_deinit;
        v->notify_wait = mailbox_list_index_notify_wait;
+       v->notify_flush = mailbox_list_index_notify_flush;
 
        MODULE_CONTEXT_SET(list, mailbox_list_index_module, ilist);
 
index 4825c3189cf1ba2a420ed084bcc0a4943e773729..02dc4828b49b979f130246a1f47c53d3f51df463 100644 (file)
@@ -198,6 +198,7 @@ int mailbox_list_index_notify_next(struct mailbox_list_notify *notify,
 void mailbox_list_index_notify_wait(struct mailbox_list_notify *notify,
                                    void (*callback)(void *context),
                                    void *context);
+void mailbox_list_index_notify_flush(struct mailbox_list_notify *notify);
 
 void mailbox_list_index_status_init_mailbox(struct mailbox_vfuncs *v);
 void mailbox_list_index_backend_init_mailbox(struct mailbox *box,
index 842177e95eea91a24f74826ebf6d16a8f60ade47..5e3ace1c5f7e1853a28ef7e49108df30ca51e60b 100644 (file)
@@ -33,3 +33,9 @@ void mailbox_list_notify_wait(struct mailbox_list_notify *notify,
 {
        notify->list->v.notify_wait(notify, callback, context);
 }
+
+void mailbox_list_notify_flush(struct mailbox_list_notify *notify)
+{
+       if (notify->list->v.notify_flush != NULL)
+               notify->list->v.notify_flush(notify);
+}
index 7e63909e65b19fae71d2b2b0ff329e7c1cbdd9f7..30f8e11268fd204ed1f94b4965cfd4a40601190b 100644 (file)
@@ -56,5 +56,7 @@ int mailbox_list_notify_next(struct mailbox_list_notify *notify,
 /* Call the specified callback when something changes. */
 void mailbox_list_notify_wait(struct mailbox_list_notify *notify,
                              void (*callback)(void *context), void *context);
+/* Flush any delayed notifications now. */
+void mailbox_list_notify_flush(struct mailbox_list_notify *notify);
 
 #endif
index a957b0b24ec89e5407c4c4bc140fddc1f9462872..0d84fa3de8c333d374607303dd1dde8f565f19bb 100644 (file)
@@ -89,6 +89,7 @@ struct mailbox_list_vfuncs {
        void (*notify_deinit)(struct mailbox_list_notify *notify);
        void (*notify_wait)(struct mailbox_list_notify *notify,
                            void (*callback)(void *context), void *context);
+       void (*notify_flush)(struct mailbox_list_notify *notify);
 };
 
 struct mailbox_list_module_register {