e_debug(ctx->event, "Found %s, handling %s event", fn, name);
- if (strcmp(name, "MessageNew") == 0) {
- push_notification_event_init(dtxn, name,
- &ctx->config_mn);
- } else if (strcmp(name, "MessageAppend") == 0) {
- push_notification_event_init(dtxn, name,
- &ctx->config_ma);
- } else if (strcmp(name, "FlagsSet") == 0) {
- push_notification_event_init(dtxn, name,
- &ctx->config_fs);
- } else if (strcmp(name, "FlagsClear") == 0) {
- push_notification_event_init(dtxn, name,
- &ctx->config_fc);
- } else if (event->init.default_config != NULL) {
- void *config = event->init.default_config();
- push_notification_event_init(dtxn, name, config);
- } else {
- push_notification_event_init(dtxn, name, NULL);
- }
+ void *config = NULL;
+ if (strcmp(name, "MessageNew") == 0)
+ config = &ctx->config_mn;
+ else if (strcmp(name, "MessageAppend") == 0)
+ config = &ctx->config_ma;
+ else if (strcmp(name, "FlagsSet") == 0)
+ config = &ctx->config_fs;
+ else if (strcmp(name, "FlagsClear") == 0)
+ config = &ctx->config_fc;
+ else if (event->init.default_config != NULL)
+ config = event->init.default_config();
+ push_notification_event_init(dtxn, name, config, ctx->event);
}
return found_one;
PUSH_NOTIFICATION_MESSAGE_HDR_SUBJECT |
PUSH_NOTIFICATION_MESSAGE_BODY_SNIPPET;
push_notification_event_init(
- dtxn, "MessageNew", config);
+ dtxn, "MessageNew", config, dconfig->event);
e_debug(dconfig->event, "Handling MessageNew event");
}
}
}
void push_notification_event_init(struct push_notification_driver_txn *dtxn,
- const char *event_name, void *config)
+ const char *event_name, void *config,
+ struct event *log_event)
{
const struct push_notification_event *event;
struct push_notification_event_config *ec;
struct push_notification_event_config, 1);
ec->config = config;
ec->event = event;
+ ec->log_event = log_event;
array_push_back(&dtxn->ptxn->events, &ec);
}
struct push_notification_event_config {
const struct push_notification_event *event;
+ struct event *log_event;
void *config;
};
void push_notification_event_init(struct push_notification_driver_txn *dtxn,
- const char *event_name, void *config);
+ const char *event_name, void *config,
+ struct event *event);
void push_notification_event_register(
const struct push_notification_event *event);