comparison 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
comparison
equal deleted inserted replaced
12128:34deaeeb5d42 12129:216988c717da
337 337
338 ops = gaim_notify_get_ui_ops(); 338 ops = gaim_notify_get_ui_ops();
339 339
340 if (ops != NULL && ops->notify_userinfo != NULL) { 340 if (ops != NULL && ops->notify_userinfo != NULL) {
341 GaimNotifyInfo *info; 341 GaimNotifyInfo *info;
342 char *infotext = g_strdup(text);
342 343
343 info = g_new0(GaimNotifyInfo, 1); 344 info = g_new0(GaimNotifyInfo, 1);
344 info->type = GAIM_NOTIFY_USERINFO; 345 info->type = GAIM_NOTIFY_USERINFO;
345 info->handle = gc; 346 info->handle = gc;
347
348 gaim_signal_emit(gaim_notify_get_handle(), "displaying-userinfo",
349 gaim_connection_get_account(gc), who, &infotext);
350
346 info->ui_handle = ops->notify_userinfo(gc, who, 351 info->ui_handle = ops->notify_userinfo(gc, who,
347 text, cb, user_data); 352 infotext, cb, user_data);
348 353
349 handles = g_list_append(handles, info); 354 handles = g_list_append(handles, info);
350 355
356 g_free(infotext);
351 return info->ui_handle; 357 return info->ui_handle;
352 } 358 }
353 359
354 return NULL; 360 return NULL;
355 } 361 }
440 GaimNotifyUiOps * 446 GaimNotifyUiOps *
441 gaim_notify_get_ui_ops(void) 447 gaim_notify_get_ui_ops(void)
442 { 448 {
443 return notify_ui_ops; 449 return notify_ui_ops;
444 } 450 }
451
452 void *
453 gaim_notify_get_handle(void)
454 {
455 static int handle;
456
457 return &handle;
458 }
459
460 void
461 gaim_notify_init(void)
462 {
463 gpointer handle = gaim_notify_get_handle();
464
465 gaim_signal_register(handle, "displaying-userinfo",
466 gaim_marshal_VOID__POINTER_POINTER_POINTER, NULL, 3,
467 gaim_value_new(GAIM_TYPE_SUBTYPE,
468 GAIM_SUBTYPE_ACCOUNT),
469 gaim_value_new(GAIM_TYPE_STRING),
470 gaim_value_new_outgoing(GAIM_TYPE_STRING));
471 }
472
473 void
474 gaim_notify_uninit(void)
475 {
476 gaim_signals_unregister_by_instance(gaim_notify_get_handle());
477 }