Ignore:
Timestamp:
2015-05-28T05:26:30Z (5 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
b38f655
Parents:
faeb521
git-author:
dequis <dx@…> (08-05-15 04:16:37)
git-committer:
dequis <dx@…> (28-05-15 05:26:30)
Message:

imcb_notify_email: change parameters to take a format string

Saves some messing with g_strdup_printf for the callers, and
flags/sent_at weren't used anyway.

Also check if the mail_notifications setting is enabled

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee_user.c

    rfaeb521 r0864a52  
    271271}
    272272
    273 void imcb_notify_email(struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at)
    274 {
     273void imcb_notify_email(struct im_connection *ic, char *format, ...)
     274{
     275        const char *handle;
     276        va_list params;
     277        char *msg;
     278
     279        if (!set_getbool(&ic->acc->set, "mail_notifications")) {
     280                return;
     281        }
     282
     283        va_start(params, format);
     284        msg = g_strdup_vprintf(format, params);
     285        va_end(params);
     286
     287        /* up to the protocol to set_add this if they want to use this */
     288        handle = set_getstr(&ic->acc->set, "notify_handle");
     289
    275290        if (handle != NULL) {
    276                 imcb_buddy_msg(ic, handle, msg, flags, sent_at);
     291                imcb_buddy_msg(ic, handle, msg, 0, 0);
    277292        } else {
    278293                imcb_log(ic, "%s", msg);
    279294        }
     295
     296        g_free(msg);
    280297}
    281298
Note: See TracChangeset for help on using the changeset viewer.