# HG changeset patch # User Sean Egan # Date 1185600619 0 # Node ID cb91bb07eeffd9d3f2c0a4317078e0ac6fce389c # Parent 7c8321023ae5f16d6ef796b14461447bf94bcc78 Email notification signals from charkins. Fixes #1324 diff -r 7c8321023ae5 -r cb91bb07eeff ChangeLog.API --- a/ChangeLog.API Sat Jul 28 05:08:42 2007 +0000 +++ b/ChangeLog.API Sat Jul 28 05:30:19 2007 +0000 @@ -29,6 +29,8 @@ * purple_xfer_get_remote_user * purple_pounces_get_all_for_ui * purple_prefs_get_children_names + * added displaying-email-notification and + displaying-emails-notification signals Changed: * The documentation of the following functions now properly diff -r 7c8321023ae5 -r cb91bb07eeff doc/notify-signals.dox --- a/doc/notify-signals.dox Sat Jul 28 05:08:42 2007 +0000 +++ b/doc/notify-signals.dox Sat Jul 28 05:30:19 2007 +0000 @@ -2,6 +2,8 @@ @signals @signal displaying-userinfo + @signal displaying-email-notification + @signal displaying-emails-notification @endsignals @signaldef displaying-userinfo @@ -18,5 +20,37 @@ @param user_info The information to be displayed, as PurpleNotifyUserInfoEntry objects @endsignaldef + @signaldef displaying-email-notification + @signalproto +void (*displaying_email_notification)(const char *subject, + const char *from, + const char *to, + const char *url); + @endsignalproto + @signaldesc + Emitted before email notification is handed to the UI to display. + @param subject Subject of email being notified of. + @param from Who the email is from. + @param to Who the email is to. + @param url A url to view the email. + @endsignaldef + + @signaldef displaying-emails-notification + @signalproto +void (*displaying_emails_notification)(const char **subjects, + const char **froms, + const char **tos, + const char **urls, + guint count); + @endsignalproto + @signaldesc + Emitted before notification of multiple emails is handed to the UI to display. + @param subjects Subjects of emails being notified of. + @param froms Who the emails are from. + @param tos Who the emails are to. + @param urls The urls to view the emails. + @param count Number of emails being notified of. + @endsignaldef + */ // vim: syntax=c tw=75 et diff -r 7c8321023ae5 -r cb91bb07eeff libpurple/notify.c --- a/libpurple/notify.c Sat Jul 28 05:08:42 2007 +0000 +++ b/libpurple/notify.c Sat Jul 28 05:30:19 2007 +0000 @@ -112,6 +112,10 @@ info = g_new0(PurpleNotifyInfo, 1); info->type = PURPLE_NOTIFY_EMAIL; info->handle = handle; + + purple_signal_emit(purple_notify_get_handle(), "displaying-email-notification", + subject, from, to, url); + info->ui_handle = ops->notify_email(handle, subject, from, to, url); info->cb = cb; info->cb_user_data = user_data; @@ -164,6 +168,10 @@ info = g_new0(PurpleNotifyInfo, 1); info->type = PURPLE_NOTIFY_EMAILS; info->handle = handle; + + purple_signal_emit(purple_notify_get_handle(), "displaying-emails-notification", + subjects, froms, tos, urls, count); + info->ui_handle = ops->notify_emails(handle, count, detailed, subjects, froms, tos, urls); info->cb = cb; @@ -799,6 +807,21 @@ { gpointer handle = purple_notify_get_handle(); + purple_signal_register(handle, "displaying-email-notification", + purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER, NULL, 4, + purple_value_new(PURPLE_TYPE_STRING), + purple_value_new(PURPLE_TYPE_STRING), + purple_value_new(PURPLE_TYPE_STRING), + purple_value_new(PURPLE_TYPE_STRING)); + + purple_signal_register(handle, "displaying-emails-notification", + purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, NULL, 5, + purple_value_new(PURPLE_TYPE_POINTER), + purple_value_new(PURPLE_TYPE_POINTER), + purple_value_new(PURPLE_TYPE_POINTER), + purple_value_new(PURPLE_TYPE_POINTER), + purple_value_new(PURPLE_TYPE_UINT)); + purple_signal_register(handle, "displaying-userinfo", purple_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, purple_value_new(PURPLE_TYPE_SUBTYPE, diff -r 7c8321023ae5 -r cb91bb07eeff libpurple/plugins/signals-test.c --- a/libpurple/plugins/signals-test.c Sat Jul 28 05:08:42 2007 +0000 +++ b/libpurple/plugins/signals-test.c Sat Jul 28 05:30:19 2007 +0000 @@ -522,6 +522,26 @@ } /************************************************************************** + * Notify signals callbacks + **************************************************************************/ +static void +notify_email_cb(char *subject, char *from, char *to, char *url) { + purple_debug_misc("signals test", "notify email: subject=%s, from=%s, to=%s, url=%s\n", + subject, from, to, url); +} + +static void +notify_emails_cb(char **subjects, char **froms, char **tos, char **urls, guint count) { + int i; + purple_debug_misc("signals test", "notify emails: count=%d\n", count); + for(i=0; i