struct MailboxNode *np = mutt_mem_calloc(1, sizeof(*np));
np->mailbox = m;
STAILQ_INSERT_TAIL(&a->mailboxes, np, entries);
+ notify_set_parent(m->notify, a->notify);
+ struct EventMailbox ev_m = { m };
+ notify_send(a->notify, NT_MAILBOX, NT_MAILBOX_ADD, IP & ev_m);
return true;
}
{
if (!m || (np->mailbox == m))
{
+ struct EventMailbox ev_m = { m };
+ notify_send(a->notify, NT_MAILBOX, NT_MAILBOX_REMOVE, IP & ev_m);
STAILQ_REMOVE(&a->mailboxes, np, MailboxNode, entries);
mailbox_free(&np->mailbox);
FREE(&np);
void *mdata; /**< driver specific data */
void (*free_mdata)(void **); /**< driver-specific data free function */
+ struct Notify *notify; ///< Notifications handler
void (*notify2)(struct Mailbox *m, enum MailboxNotification action); ///< Notification callback
void *ndata; ///< Notification callback private data
};
};
STAILQ_HEAD(MailboxList, MailboxNode);
+/**
+ * struct EventMailbox - An Event that happened to a Mailbox
+ */
+struct EventMailbox
+{
+ struct Mailbox *mailbox; ///< The Mailbox this Event relates to
+};
+
+/**
+ * enum NotifyMailbox - Types of Mailbox Event
+ */
+enum NotifyMailbox
+{
+ NT_MAILBOX_ADD = 1, ///< A new Mailbox has been created
+ NT_MAILBOX_REMOVE, ///< A Mailbox is about to be destroyed
+};
+
void mailbox_free (struct Mailbox **ptr);
struct Mailbox *mailbox_new (void);
void mutt_mailbox_changed (struct Mailbox *m, enum MailboxNotification action);