Mercurial > pidgin
changeset 18675:cb91bb07eeff
Email notification signals from charkins. Fixes #1324
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 28 Jul 2007 05:30:19 +0000 |
parents | 7c8321023ae5 |
children | 1afeca132d68 |
files | ChangeLog.API doc/notify-signals.dox libpurple/notify.c libpurple/plugins/signals-test.c |
diffstat | 4 files changed, 86 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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,
--- 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<count && i<5; i++) { + if(subjects[i]==NULL || froms[i]==NULL || tos[i]==NULL || urls[i]==NULL) continue; + purple_debug_misc("signals test", "notify emails[%d]: subject=%s, from=%s, to=%s, url=%s\n", + i, subjects[i], froms[i], tos[i], urls[i]); + } +} + +/************************************************************************** * Plugin stuff **************************************************************************/ static gboolean @@ -535,6 +555,7 @@ void *ciphers_handle = purple_ciphers_get_handle(); void *ft_handle = purple_xfers_get_handle(); void *sound_handle = purple_sounds_get_handle(); + void *notify_handle = purple_notify_get_handle(); /* Accounts subsystem signals */ purple_signal_connect(accounts_handle, "account-connecting", @@ -666,6 +687,12 @@ purple_signal_connect(sound_handle, "playing-sound-event", plugin, PURPLE_CALLBACK(sound_playing_event_cb), NULL); + /* Notify signals */ + purple_signal_connect(notify_handle, "displaying-email-notification", + plugin, PURPLE_CALLBACK(notify_email_cb), NULL); + purple_signal_connect(notify_handle, "displaying-emails-notification", + plugin, PURPLE_CALLBACK(notify_emails_cb), NULL); + return TRUE; }