summaryrefslogtreecommitdiffstats
path: root/src/lib-storage/mailbox-list-notify.c
blob: 9ca83ac0cc7f48b508d10574c6a046afe022575d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "mailbox-list-private.h"
#include "mailbox-list-notify.h"

int mailbox_list_notify_init(struct mailbox_list *list,
			     enum mailbox_list_notify_event mask,
			     struct mailbox_list_notify **notify_r)
{
	if (list->v.notify_init == NULL)
		return -1;
	return list->v.notify_init(list, mask, notify_r);
}

void mailbox_list_notify_deinit(struct mailbox_list_notify **_notify)
{
	struct mailbox_list_notify *notify = *_notify;

	*_notify = NULL;

	notify->list->v.notify_deinit(notify);
}

int mailbox_list_notify_next(struct mailbox_list_notify *notify,
			     const struct mailbox_list_notify_rec **rec_r)
{
	return notify->list->v.notify_next(notify, rec_r);
}

#undef mailbox_list_notify_wait
void mailbox_list_notify_wait(struct mailbox_list_notify *notify,
			      void (*callback)(void *context), void *context)
{
	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);
}