Mercurial > pidgin.yaz
changeset 12129:216988c717da
[gaim-migrate @ 14429]
SF Patch #1353745 from bsponline (Ka-Hing Cheung)
"Adds a signal to fire an event before userinfo/profile
is shown, so that a plugin can modify it."
I renamed it from receiving-userinfo to displaying-userinfo and documented it.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 18 Nov 2005 12:44:07 +0000 |
parents | 34deaeeb5d42 |
children | 5d9a74c47108 |
files | doc/Makefile.am doc/notify-signals.dox plugins/ChangeLog.API src/core.c src/notify.c src/notify.h |
diffstat | 6 files changed, 87 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/Makefile.am Fri Nov 18 12:23:36 2005 +0000 +++ b/doc/Makefile.am Fri Nov 18 12:44:07 2005 +0000 @@ -20,6 +20,7 @@ gtkblist-signals.dox \ gtkconv-signals.dox \ gtkimhtml-signals.dox \ + notify-signals.dox \ plugin-ids.dox \ plugin-signals.dox \ the_penguin.txt \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/notify-signals.dox Fri Nov 18 12:44:07 2005 +0000 @@ -0,0 +1,23 @@ +/** @page conversation-signals Notification Signals + + @signals + @signal displaying-userinfo + @endsignals + + @signaldef displaying-userinfo + @signalproto +void (*displaying_userinfo)(GaimAccount *account, const char *who, char **infotext); + @endsignalproto + @signaldesc + Emitted before userinfo is handed to the UI to display. + @a infotext is a pointer to a string, so a plugin can replace the text that + will be displayed. + @note + Make sure to free @a *infotext before you replace it! + @param account The account on which the info was obtained. + @param who The screen name of the user whose info is to be displayed. + @param infotext A pointer to the userinfo text to be displayed. + @endsignaldef + +*/ +// vim: syntax=c tw=75 et
--- a/plugins/ChangeLog.API Fri Nov 18 12:23:36 2005 +0000 +++ b/plugins/ChangeLog.API Fri Nov 18 12:44:07 2005 +0000 @@ -189,6 +189,7 @@ * "buddy-icon-changed" * "gtkblist-hiding" * "gtkblist-unhiding" + * "displaying-userinfo" Signals - Removed: * "account-away": replaced by account-status-changed
--- a/src/core.c Fri Nov 18 12:23:36 2005 +0000 +++ b/src/core.c Fri Nov 18 12:44:07 2005 +0000 @@ -30,6 +30,7 @@ #include "debug.h" #include "ft.h" #include "network.h" +#include "notify.h" #include "plugin.h" #include "pounce.h" #include "prefs.h" @@ -110,6 +111,7 @@ gaim_accounts_init(); gaim_savedstatuses_init(); gaim_ciphers_init(); + gaim_notify_init(); gaim_connections_init(); gaim_conversations_init(); gaim_blist_init(); @@ -152,6 +154,7 @@ gaim_pounces_uninit(); gaim_blist_uninit(); gaim_ciphers_uninit(); + gaim_notify_uninit(); gaim_conversations_uninit(); gaim_connections_uninit(); gaim_buddy_icons_uninit();
--- a/src/notify.c Fri Nov 18 12:23:36 2005 +0000 +++ b/src/notify.c Fri Nov 18 12:44:07 2005 +0000 @@ -339,15 +339,21 @@ if (ops != NULL && ops->notify_userinfo != NULL) { GaimNotifyInfo *info; + char *infotext = g_strdup(text); info = g_new0(GaimNotifyInfo, 1); info->type = GAIM_NOTIFY_USERINFO; info->handle = gc; + + gaim_signal_emit(gaim_notify_get_handle(), "displaying-userinfo", + gaim_connection_get_account(gc), who, &infotext); + info->ui_handle = ops->notify_userinfo(gc, who, - text, cb, user_data); + infotext, cb, user_data); handles = g_list_append(handles, info); + g_free(infotext); return info->ui_handle; } @@ -442,3 +448,30 @@ { return notify_ui_ops; } + +void * +gaim_notify_get_handle(void) +{ + static int handle; + + return &handle; +} + +void +gaim_notify_init(void) +{ + gpointer handle = gaim_notify_get_handle(); + + gaim_signal_register(handle, "displaying-userinfo", + gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3, + gaim_value_new(GAIM_TYPE_SUBTYPE, + GAIM_SUBTYPE_ACCOUNT), + gaim_value_new(GAIM_TYPE_STRING), + gaim_value_new_outgoing(GAIM_TYPE_STRING)); +} + +void +gaim_notify_uninit(void) +{ + gaim_signals_unregister_by_instance(gaim_notify_get_handle()); +}
--- a/src/notify.h Fri Nov 18 12:23:36 2005 +0000 +++ b/src/notify.h Fri Nov 18 12:44:07 2005 +0000 @@ -448,6 +448,31 @@ /*@}*/ +/**************************************************************************/ +/** @name Notify Subsystem */ +/**************************************************************************/ +/*@{*/ + +/** + * Returns the notify subsystem handle. + * + * @return The notify subsystem handle. + */ +void *gaim_notify_get_handle(void); + +/** + * Initializes the notify subsystem. + */ +void gaim_notify_init(void); + +/** + * Uninitializes the notify subsystem. + */ +void gaim_notify_uninit(void); + +/*@}*/ + + #ifdef __cplusplus } #endif