changeset 11930:eb1f471a924d

virtual: Added support for IDLE notifications.
author Timo Sirainen <tss@iki.fi>
date Wed, 04 Aug 2010 16:54:17 +0100
parents e9cc262e4bbb
children 85bdc6f6ff30
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	Wed Aug 04 16:28:10 2010 +0100
+++ b/src/plugins/virtual/virtual-storage.c	Wed Aug 04 16:54:17 2010 +0100
@@ -356,9 +356,29 @@
 	return -1;
 }
 
-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