static void * finch_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info) { char *primary; char *info; void *ui_handle; char *key = userinfo_hash(purple_connection_get_account(gc), who); info = purple_notify_user_info_get_xhtml(user_info); ui_handle = g_hash_table_lookup(userinfo, key); if (ui_handle != NULL) { GntTextView *msg = GNT_TEXT_VIEW(g_object_get_data(G_OBJECT(ui_handle), "info-widget")); char *strip = purple_markup_strip_html(info); int tvw, tvh, width, height, ntvw, ntvh; while (GNT_WIDGET(ui_handle)->parent) ui_handle = GNT_WIDGET(ui_handle)->parent; gnt_widget_get_size(GNT_WIDGET(ui_handle), &width, &height); gnt_widget_get_size(GNT_WIDGET(msg), &tvw, &tvh); gnt_text_view_clear(msg); if (!gnt_util_parse_xhtml_to_textview(info, msg)) gnt_text_view_append_text_with_flags(msg, strip, GNT_TEXT_FLAG_NORMAL); gnt_text_view_scroll(msg, 0); gnt_util_get_text_bound(strip, &ntvw, &ntvh); ntvw += 3; ntvh++; gnt_screen_resize_widget(GNT_WIDGET(ui_handle), width + MAX(0, ntvw - tvw), height + MAX(0, ntvh - tvh)); g_free(strip); g_free(key); } else { primary = g_strdup_printf(_("Info for %s"), who); ui_handle = finch_notify_formatted(_("Buddy Information"), primary, NULL, info); g_hash_table_insert(userinfo, key, ui_handle); g_free(primary); g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key); } g_free(info); return ui_handle; }
static void * pidgin_notify_userinfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info) { char *info; void *ui_handle; char *key = userinfo_hash(purple_connection_get_account(gc), who); PidginUserInfo *pinfo = NULL; if (!userinfo) { userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); } info = purple_notify_user_info_get_text_with_newline(user_info, "<br />"); pinfo = g_hash_table_lookup(userinfo, key); if (pinfo != NULL) { GtkIMHtml *imhtml = g_object_get_data(G_OBJECT(pinfo->window), "info-widget"); char *linked_text = purple_markup_linkify(info); gtk_imhtml_clear(imhtml); gtk_imhtml_append_text(imhtml, linked_text, notify_imhtml_options()); g_free(linked_text); g_free(key); ui_handle = pinfo->window; pinfo->count++; } else { char *primary = g_strdup_printf(_("Info for %s"), who); ui_handle = pidgin_notify_formatted(_("Buddy Information"), primary, NULL, info); g_signal_handlers_disconnect_by_func(G_OBJECT(ui_handle), G_CALLBACK(formatted_close_cb), NULL); g_signal_connect(G_OBJECT(ui_handle), "destroy", G_CALLBACK(remove_userinfo), key); g_free(primary); pinfo = g_new0(PidginUserInfo, 1); pinfo->window = ui_handle; pinfo->count = 1; g_hash_table_insert(userinfo, key, pinfo); } g_free(info); return ui_handle; }