aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/bee_user.c
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-05-08 01:16:37 -0300
committerdequis <dx@dxzone.com.ar>2015-05-28 02:26:30 -0300
commit0864a524c9fd1184874d550216beb49f6a0bef55 (patch)
treea2a19d6787dd8b7b479fa43378994233aad839e1 /protocols/bee_user.c
parentfaeb521e66d825e68eb7f9eef8f32ddabbfd9c49 (diff)
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
Diffstat (limited to 'protocols/bee_user.c')
-rw-r--r--protocols/bee_user.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/protocols/bee_user.c b/protocols/bee_user.c
index 562b31b3..3088de5c 100644
--- a/protocols/bee_user.c
+++ b/protocols/bee_user.c
@@ -270,13 +270,30 @@ void imcb_buddy_msg(struct im_connection *ic, const char *handle, const char *ms
}
}
-void imcb_notify_email(struct im_connection *ic, const char *handle, char *msg, uint32_t flags, time_t sent_at)
+void imcb_notify_email(struct im_connection *ic, char *format, ...)
{
+ const char *handle;
+ va_list params;
+ char *msg;
+
+ if (!set_getbool(&ic->acc->set, "mail_notifications")) {
+ return;
+ }
+
+ va_start(params, format);
+ msg = g_strdup_vprintf(format, params);
+ va_end(params);
+
+ /* up to the protocol to set_add this if they want to use this */
+ handle = set_getstr(&ic->acc->set, "notify_handle");
+
if (handle != NULL) {
- imcb_buddy_msg(ic, handle, msg, flags, sent_at);
+ imcb_buddy_msg(ic, handle, msg, 0, 0);
} else {
imcb_log(ic, "%s", msg);
}
+
+ g_free(msg);
}
void imcb_buddy_typing(struct im_connection *ic, const char *handle, uint32_t flags)