It's now internally taken from mailbox_idle_check_interval setting.
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);
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;
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);
}
}
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) {
* 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);
}
}
enum mailbox_feature enabled_features;
/* Mailbox notification settings: */
- unsigned int notify_min_interval;
mailbox_notify_callback_t *notify_callback;
void *notify_context;
}
#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;
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 *
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);
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);
}
}