changeset 9597:367ce71922bf HEAD

virtual: Added support for IDLE notifications.
author Timo Sirainen <tss@iki.fi>
date Wed, 04 Aug 2010 16:54:17 +0100
parents e5f3bd280210
children 2281223b9cb9
files src/plugins/virtual/virtual-storage.c
diffstat 1 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-storage.c	Tue Aug 03 13:11:47 2010 +0100
+++ b/src/plugins/virtual/virtual-storage.c	Wed Aug 04 16:54:17 2010 +0100
@@ -494,9 +494,29 @@
 	return virtual_delete_nonrecursive(list, src, name);
 }
 
-static void virtual_notify_changes(struct mailbox *box ATTR_UNUSED)
+static void
+virtual_notify_callback(struct mailbox *bbox ATTR_UNUSED, struct mailbox *box)
+{
+	box->notify_callback(box, box->notify_context);
+}
+
+static void virtual_notify_changes(struct mailbox *box)
 {
-	/* FIXME: maybe some day */
+	struct virtual_mailbox *mbox = (struct virtual_mailbox *)box;
+	struct virtual_backend_box *const *bboxes;
+	unsigned int i, count;
+
+	bboxes = array_get(&mbox->backend_boxes, &count);
+	for (i = 0; i < count; i++) {
+		struct mailbox *bbox = bboxes[i]->box;
+
+		if (box->notify_callback == NULL)
+			mailbox_notify_changes_stop(bbox);
+		else {
+			mailbox_notify_changes(bbox, box->notify_min_interval,
+					       virtual_notify_callback, box);
+		}
+	}
 }
 
 static int