diff src/notify.c @ 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 c9b815aeddc1
children 64254fbabc7b
line wrap: on
line diff
--- 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());
+}