]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Fri, 26 May 2017 06:07:44 +0000 (09:07 +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 0aff693e88417c7c448d6d91544ab08170380180..decc85785fdadb9a75c1a25ed7b7dcf6226f3e38 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 bb3b83f142c1cc28ac3e83ff37896d917e016a69..960081c54192c4dfe39c5b1db17d6ffa88d67345 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 ff578756dc1d7328c8f9ba32829466b6bb93416e..85fad85c602a0cc9bd3f7d490a77b311f68c25dd 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 {