#define IMAP_NOTIFY_WATCH_ADD_DELAY_MSECS 1000
-static bool notify_hook_registered;
-
static int imap_notify_list(struct imap_notify_namespace *notify_ns,
const struct mailbox_list_notify_rec *rec,
enum mailbox_info_flags flags)
}
}
-static void imap_notify_cmd_hook_pre(struct client_command_context *cmd)
+void imap_client_notify_command_allocated(struct client *client)
{
- struct imap_notify_context *ctx = cmd->client->notify_ctx;
+ struct imap_notify_context *ctx = client->notify_ctx;
if (ctx == NULL)
return;
/* remove mailbox watcher before starting any commands */
if (ctx->watching_mailbox) {
- mailbox_notify_changes_stop(cmd->client->mailbox);
+ mailbox_notify_changes_stop(client->mailbox);
ctx->watching_mailbox = FALSE;
}
if (ctx->to_watch != NULL)
enum mailbox_list_notify_event notify_events;
int ret = -1;
- if (!notify_hook_registered) {
- notify_hook_registered = TRUE;
- command_hook_register(imap_notify_cmd_hook_pre, NULL);
- }
-
array_foreach_modifiable(&ctx->namespaces, notify_ns) {
notify_events = 0;
array_foreach(¬ify_ns->mailboxes, notify_boxes) {
int imap_client_notify_newmails(struct client *client);
void imap_client_notify_finished(struct client *client);
+void imap_client_notify_command_allocated(struct client *client);
void imap_client_notify_command_freed(struct client *client);
int imap_notify_begin(struct imap_notify_context *ctx);