This is mainly to allow testing NOTIFY easily with imaptest scripts.
This is cheap anyway, because mailbox_list_notify_flush() doesn't do any
syscalls when there's no work.
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
#include "imap-common.h"
+#include "imap-notify.h"
#include "imap-commands.h"
bool cmd_noop(struct client_command_context *cmd)
{
+ if (cmd->client->notify_ctx != NULL) {
+ /* flush any delayed notifications now. this is mainly useful
+ for testing. */
+ imap_notify_flush(cmd->client->notify_ctx);
+ }
return cmd_sync(cmd, 0, IMAP_SYNC_FLAG_SAFE, "OK NOOP completed.");
}
imap_fetch_free(&ctx->fetch_ctx);
pool_unref(&ctx->pool);
}
+
+void imap_notify_flush(struct imap_notify_context *ctx)
+{
+ struct imap_notify_namespace *notify_ns;
+
+ array_foreach_modifiable(&ctx->namespaces, notify_ns) {
+ if (notify_ns->notify != NULL)
+ mailbox_list_notify_flush(notify_ns->notify);
+ }
+}
int imap_notify_begin(struct imap_notify_context *ctx);
void imap_notify_deinit(struct imap_notify_context **ctx);
+void imap_notify_flush(struct imap_notify_context *ctx);
+
#endif