/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
#ifndef PUSH_NOTIFICATION_DRIVERS_H
#define PUSH_NOTIFICATION_DRIVERS_H
#include "mail-user.h"
#include "push-notification-triggers.h"
struct mail_user;
struct push_notification_driver_config;
struct push_notification_driver_txn;
struct push_notification_driver_user;
struct push_notification_txn_mbox;
struct push_notification_txn_msg;
HASH_TABLE_DEFINE_TYPE(push_notification_config, const char *, const char *);
struct push_notification_txn_msg *);
struct push_notification_driver_vfuncs {
/* Init driver. Config (from plugin configuration) is parsed once (no
* user variable substitutions). Return 0 on success, or -1 if this
* driver should be disabled (or on error). */
const char **error_r);
/* Called at the beginning of a notification transaction. Return TRUE on
* success, or FALSE if this driver should be ignored for this
* transaction. */
/* Called once for every mailbox processed. */
struct push_notification_txn_mbox *mbox);
/* Called once for every message processed. */
struct push_notification_txn_msg *msg);
/* Called at the end of a successful notification transaction. */
/* Called when plugin is deinitialized. */
/* Called to cleanup any global resources used in plugin. */
void (*cleanup)(void);
};
struct push_notification_driver {
const char *name;
struct push_notification_driver_vfuncs v;
};
struct push_notification_driver_config {
const char *raw_config;
};
struct push_notification_driver_user {
void *context;
};
struct push_notification_driver_txn {
/* Transaction context. */
void *context;
};
struct push_notification_driver_list {
};
struct push_notification_user {
};
struct push_notification_trigger_ctx {
const char *name;
void *context;
};
struct push_notification_txn {
bool initialized;
/* Used with mailbox events. */
/* Used with mailbox events. */
/* Private (used with message events). */
struct mailbox_transaction_context *t;
};
int
struct push_notification_driver_user **duser_r);
void push_notification_driver_cleanup_all(void);
const char *fmt, ...);
(const struct push_notification_driver *driver);
(const struct push_notification_driver *driver);
#endif /* PUSH_NOTIFICATION_DRIVERS_H */