From: Stephan Bosch Date: Sun, 1 Dec 2019 10:29:06 +0000 (+0100) Subject: plugins: push-notification: Reformat push-notification-event-messagenew.c. X-Git-Tag: 2.3.10~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c077501ea876da2d1ae387424f11be5b30a20e6;p=thirdparty%2Fdovecot%2Fcore.git plugins: push-notification: Reformat push-notification-event-messagenew.c. --- diff --git a/src/plugins/push-notification/push-notification-event-messagenew.c b/src/plugins/push-notification/push-notification-event-messagenew.c index 1a047b98da..930c0eeaf6 100644 --- a/src/plugins/push-notification/push-notification-event-messagenew.c +++ b/src/plugins/push-notification/push-notification-event-messagenew.c @@ -15,92 +15,83 @@ #include "push-notification-event-messagenew.h" #include "push-notification-txn-msg.h" - #define EVENT_NAME "MessageNew" static struct push_notification_event_messagenew_config default_config; - static void *push_notification_event_messagenew_default_config(void) { - i_zero(&default_config); + i_zero(&default_config); - return &default_config; + return &default_config; } -static void push_notification_event_messagenew_debug_msg -(struct push_notification_txn_event *event) +static void +push_notification_event_messagenew_debug_msg( + struct push_notification_txn_event *event) { - struct push_notification_event_messagenew_data *data = event->data; - struct tm *tm; - - if (data->date != -1) { - tm = gmtime(&data->date); - i_debug("%s: Date [%s]", EVENT_NAME, - iso8601_date_create_tm(tm, data->date_tz)); - } - - if (data->from != NULL) { - i_debug("%s: From [%s]", EVENT_NAME, data->from); - } - - if (data->snippet != NULL) { - i_debug("%s: Snippet [%s]", EVENT_NAME, data->snippet); - } - - if (data->subject != NULL) { - i_debug("%s: Subject [%s]", EVENT_NAME, data->subject); - } - - if (data->to != NULL) { - i_debug("%s: To [%s]", EVENT_NAME, data->to); - } + struct push_notification_event_messagenew_data *data = event->data; + struct tm *tm; + + if (data->date != -1) { + tm = gmtime(&data->date); + i_debug("%s: Date [%s]", EVENT_NAME, + iso8601_date_create_tm(tm, data->date_tz)); + } + + if (data->from != NULL) + i_debug("%s: From [%s]", EVENT_NAME, data->from); + if (data->snippet != NULL) + i_debug("%s: Snippet [%s]", EVENT_NAME, data->snippet); + if (data->subject != NULL) + i_debug("%s: Subject [%s]", EVENT_NAME, data->subject); + if (data->to != NULL) + i_debug("%s: To [%s]", EVENT_NAME, data->to); } static void -push_notification_event_messagenew_event(struct push_notification_txn *ptxn, - struct push_notification_event_config *ec, - struct push_notification_txn_msg *msg, - struct mail *mail) +push_notification_event_messagenew_event( + struct push_notification_txn *ptxn, + struct push_notification_event_config *ec, + struct push_notification_txn_msg *msg, struct mail *mail) { - struct push_notification_event_messagenew_config *config = - (struct push_notification_event_messagenew_config *)ec->config; - struct push_notification_event_messagenew_data *data; - - if (config->flags == 0) { - return; - } - - data = push_notification_txn_msg_get_eventdata(msg, EVENT_NAME); - if (data == NULL) { - data = p_new(ptxn->pool, - struct push_notification_event_messagenew_data, 1); - data->date = -1; - - push_notification_txn_msg_set_eventdata(ptxn, msg, ec, data); - } - - push_notification_message_fill(mail, ptxn->pool, config->flags, - &data->from, &data->to, &data->subject, - &data->date, &data->date_tz, - &data->message_id, - &data->flags, &data->flags_set, - &data->keywords, - &data->snippet, &data->ext); + struct push_notification_event_messagenew_config *config = + (struct push_notification_event_messagenew_config *)ec->config; + struct push_notification_event_messagenew_data *data; + + if (config->flags == 0) + return; + + data = push_notification_txn_msg_get_eventdata(msg, EVENT_NAME); + if (data == NULL) { + data = p_new(ptxn->pool, + struct push_notification_event_messagenew_data, 1); + data->date = -1; + + push_notification_txn_msg_set_eventdata(ptxn, msg, ec, data); + } + + push_notification_message_fill(mail, ptxn->pool, config->flags, + &data->from, &data->to, &data->subject, + &data->date, &data->date_tz, + &data->message_id, + &data->flags, &data->flags_set, + &data->keywords, + &data->snippet, &data->ext); } - /* Event definition */ struct push_notification_event push_notification_event_messagenew = { - .name = EVENT_NAME, - .init = { - .default_config = push_notification_event_messagenew_default_config - }, - .msg = { - .debug_msg = push_notification_event_messagenew_debug_msg - }, - .msg_triggers = { - .save = push_notification_event_messagenew_event - } + .name = EVENT_NAME, + .init = { + .default_config = + push_notification_event_messagenew_default_config, + }, + .msg = { + .debug_msg = push_notification_event_messagenew_debug_msg, + }, + .msg_triggers = { + .save = push_notification_event_messagenew_event, + }, };