pidgin/pidgin

Parents 6b2ba7253a36
Children e603d4381fe5
Remove PurpleProtocolClient->tooltip_text as it is barely used and we're scaling back our tooltip usage

Testing Done:
Compiled

Reviewed at https://reviews.imfreedom.org/r/2370/
--- a/finch/gntblist.c Mon Mar 20 22:27:22 2023 -0500
+++ b/finch/gntblist.c Mon Mar 20 22:28:16 2023 -0500
@@ -1579,7 +1579,6 @@
PurpleContactInfo *info = NULL;
PurpleNotifyUserInfo *user_info;
PurplePresence *presence = NULL;
- PurpleProtocol *protocol = NULL;
const char *alias = purple_buddy_get_alias(buddy);
char *tmp, *strip;
@@ -1599,11 +1598,6 @@
purple_notify_user_info_add_pair_plaintext(user_info, _("Account"), tmp);
g_free(tmp);
- protocol = purple_account_get_protocol(account);
- if (protocol) {
- purple_protocol_client_tooltip_text(PURPLE_PROTOCOL_CLIENT(protocol), buddy, user_info, full);
- }
-
if (purple_prefs_get_bool("/finch/blist/idletime")) {
PurplePresence *pre = purple_buddy_get_presence(buddy);
if (purple_presence_is_idle(pre)) {
--- a/libpurple/protocols/bonjour/bonjour.c Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/protocols/bonjour/bonjour.c Mon Mar 20 22:28:16 2023 -0500
@@ -389,73 +389,6 @@
}
static void
-bonjour_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client,
- PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info,
- G_GNUC_UNUSED gboolean full)
-{
- PurplePresence *presence;
- PurpleStatus *status;
- BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy);
- const char *status_description;
- const char *message;
-
- presence = purple_buddy_get_presence(buddy);
- status = purple_presence_get_active_status(presence);
- message = purple_status_get_attr_string(status, "message");
-
- if (purple_presence_is_available(presence))
- status_description = purple_status_get_name(status);
- else if (purple_presence_is_idle(presence))
- status_description = _("Idle");
- else
- status_description = purple_status_get_name(status);
-
- purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_description);
- if (message != NULL) {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("Message"), message);
- }
-
- if (bb == NULL) {
- purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n");
- return;
- }
-
- /* Only show first/last name if there is a nickname set (to avoid duplication) */
- if (bb->nick != NULL && *bb->nick != '\0') {
- if (bb->first != NULL && *bb->first != '\0') {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("First name"), bb->first);
- }
- if (bb->last != NULL && *bb->last != '\0') {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("Last name"), bb->last);
- }
- }
-
- if (bb->email != NULL && *bb->email != '\0') {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("Email"), bb->email);
- }
-
- if (bb->AIM != NULL && *bb->AIM != '\0') {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("AIM Account"), bb->AIM);
- }
-
- if (bb->jid != NULL && *bb->jid != '\0') {
- /* TODO: Check whether it's correct to call add_pair_html,
- or if we should be using add_pair_plaintext */
- purple_notify_user_info_add_pair_html(user_info, _("XMPP Account"), bb->jid);
- }
-}
-
-static void
bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group)
{
if (buddy == NULL)
@@ -681,7 +614,6 @@
static void
bonjour_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface)
{
- client_iface->tooltip_text = bonjour_tooltip_text;
client_iface->convo_closed = bonjour_convo_closed;
client_iface->get_max_message_size = bonjour_get_max_message_size;
}
--- a/libpurple/protocols/facebook/facebook.c Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/protocols/facebook/facebook.c Mon Mar 20 22:28:16 2023 -0500
@@ -1160,28 +1160,6 @@
return g_list_reverse(types);
}
-static void
-fb_client_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client,
- PurpleBuddy *buddy, PurpleNotifyUserInfo *info,
- G_GNUC_UNUSED gboolean full)
-{
- const gchar *name;
- PurplePresence *presence;
- PurpleStatus *status;
-
- presence = purple_buddy_get_presence(buddy);
- status = purple_presence_get_active_status(presence);
-
- if (!PURPLE_BUDDY_IS_ONLINE(buddy)) {
- /* Prevent doubles statues for Offline buddies */
- /* See: pidgin_get_tooltip_text() in gtkblist.c */
- purple_notify_user_info_remove_last_item(info);
- }
-
- name = purple_status_get_name(status);
- purple_notify_user_info_add_pair_plaintext(info, _("Status"), name);
-}
-
static GList *
fb_client_blist_node_menu(G_GNUC_UNUSED PurpleProtocolClient *client,
PurpleBlistNode *node)
@@ -1608,7 +1586,6 @@
static void
facebook_protocol_client_iface_init(PurpleProtocolClientInterface *iface)
{
- iface->tooltip_text = fb_client_tooltip_text;
iface->blist_node_menu = fb_client_blist_node_menu;
iface->offline_message = fb_client_offline_message;
}
--- a/libpurple/protocols/gg/gg.c Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/protocols/gg/gg.c Mon Mar 20 22:28:16 2023 -0500
@@ -756,44 +756,6 @@
return normalized;
}
-/* TODO:
- * - move to status.c ?
- * - add information about not adding to his buddy list (not_a_friend)
- */
-static void
-ggp_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client, PurpleBuddy *b,
- PurpleNotifyUserInfo *user_info,
- G_GNUC_UNUSED gboolean full)
-{
- PurpleStatus *status;
- char *tmp;
- const char *name, *alias;
- gchar *msg;
-
- g_return_if_fail(b != NULL);
-
- status = purple_presence_get_active_status(purple_buddy_get_presence(b));
- name = purple_status_get_name(status);
- alias = purple_buddy_get_alias(b);
- ggp_status_from_purplestatus(status, &msg);
-
- purple_notify_user_info_add_pair_plaintext(user_info, _("Alias"), alias);
-
- if (msg != NULL) {
- if (PURPLE_BUDDY_IS_ONLINE(b)) {
- tmp = g_strdup_printf("%s: %s", name, msg);
- purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), tmp);
- g_free(tmp);
- } else {
- purple_notify_user_info_add_pair_plaintext(user_info, _("Message"), msg);
- }
- g_free(msg);
- /* We don't want to duplicate 'Status: Offline'. */
- } else if (PURPLE_BUDDY_IS_ONLINE(b)) {
- purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), name);
- }
-}
-
static void
ggp_login(G_GNUC_UNUSED PurpleProtocol *protocol, PurpleAccount *account) {
PurpleConnection *gc = purple_account_get_connection(account);
@@ -1303,7 +1265,6 @@
ggp_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface)
{
client_iface->list_emblem = ggp_list_emblem;
- client_iface->tooltip_text = ggp_tooltip_text;
client_iface->buddy_free = ggp_buddy_free;
client_iface->normalize = ggp_normalize;
client_iface->offline_message = ggp_offline_message;
--- a/libpurple/protocols/jabber/jabber.c Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/protocols/jabber/jabber.c Mon Mar 20 22:28:16 2023 -0500
@@ -1507,123 +1507,6 @@
return NULL;
}
-static void
-jabber_tooltip_add_resource_text(JabberBuddyResource *jbr,
- PurpleNotifyUserInfo *user_info, gboolean multiple_resources)
-{
- char *text = NULL;
- char *res = NULL;
- char *label, *value;
- const char *state;
-
- if(jbr->status) {
- text = g_markup_escape_text(jbr->status, -1);
- }
-
- if(jbr->name)
- res = g_strdup_printf(" (%s)", jbr->name);
-
- state = jabber_buddy_state_get_name(jbr->state);
- if (text != NULL && !purple_utf8_strcasecmp(state, text)) {
- g_free(text);
- text = NULL;
- }
-
- label = g_strdup_printf("%s%s", _("Status"), (res ? res : ""));
- value = g_strdup_printf("%s%s%s", state, (text ? ": " : ""), (text ? text : ""));
-
- purple_notify_user_info_add_pair_html(user_info, label, value);
- g_free(label);
- g_free(value);
- g_free(text);
-
- /* if the resource is idle, show that */
- /* only show it if there is more than one resource available for
- the buddy, since the "general" idleness will be shown anyway,
- this way we can see see the idleness of lower-priority resources */
- if (jbr->idle && multiple_resources) {
- gchar *idle_str =
- purple_str_seconds_to_string(time(NULL) - jbr->idle);
- label = g_strdup_printf("%s%s", _("Idle"), (res ? res : ""));
- purple_notify_user_info_add_pair_plaintext(user_info, label, idle_str);
- g_free(idle_str);
- g_free(label);
- }
- g_free(res);
-}
-
-static void
-jabber_tooltip_text(G_GNUC_UNUSED PurpleProtocolClient *client, PurpleBuddy *b,
- PurpleNotifyUserInfo *user_info, gboolean full)
-{
- JabberBuddy *jb;
- PurpleAccount *account;
- PurpleConnection *gc;
- JabberStream *js;
-
- g_return_if_fail(b != NULL);
-
- account = purple_buddy_get_account(b);
- g_return_if_fail(account != NULL);
-
- gc = purple_account_get_connection(account);
- g_return_if_fail(gc != NULL);
-
- js = purple_connection_get_protocol_data(gc);
- g_return_if_fail(js != NULL);
-
- jb = jabber_buddy_find(js, purple_buddy_get_name(b), FALSE);
-
- if(jb) {
- JabberBuddyResource *jbr = NULL;
- const char *sub;
- GList *l;
- gboolean multiple_resources =
- jb->resources && g_list_next(jb->resources);
- JabberBuddyResource *top_jbr = jabber_buddy_find_resource(jb, NULL);
-
- /* resource-specific info for the top resource */
- if (top_jbr) {
- jabber_tooltip_add_resource_text(top_jbr, user_info,
- multiple_resources);
- }
-
- for(l=jb->resources; l; l = l->next) {
- jbr = l->data;
- /* the remaining resources */
- if (jbr != top_jbr) {
- jabber_tooltip_add_resource_text(jbr, user_info,
- multiple_resources);
- }
- }
-
- if (full) {
- if(jb->subscription & JABBER_SUB_FROM) {
- if(jb->subscription & JABBER_SUB_TO)
- sub = _("Both");
- else if(jb->subscription & JABBER_SUB_PENDING)
- sub = _("From (To pending)");
- else
- sub = _("From");
- } else {
- if(jb->subscription & JABBER_SUB_TO)
- sub = _("To");
- else if(jb->subscription & JABBER_SUB_PENDING)
- sub = _("None (To pending)");
- else
- sub = _("None");
- }
-
- purple_notify_user_info_add_pair_html(user_info, _("Subscription"), sub);
-
- }
-
- if(!PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) {
- purple_notify_user_info_add_pair_html(user_info, _("Error"), jb->error_msg);
- }
- }
-}
-
static GList *
jabber_status_types(G_GNUC_UNUSED PurpleProtocol *protocol,
G_GNUC_UNUSED PurpleAccount *account)
@@ -3244,7 +3127,6 @@
jabber_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface)
{
client_iface->list_emblem = jabber_list_emblem;
- client_iface->tooltip_text = jabber_tooltip_text;
client_iface->blist_node_menu = jabber_blist_node_menu;
client_iface->convo_closed = jabber_convo_closed;
client_iface->normalize = jabber_client_normalize;
--- a/libpurple/purpleprotocolclient.c Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/purpleprotocolclient.c Mon Mar 20 22:28:16 2023 -0500
@@ -53,24 +53,6 @@
return NULL;
}
-void
-purple_protocol_client_tooltip_text(PurpleProtocolClient *client,
- PurpleBuddy *buddy,
- PurpleNotifyUserInfo *user_info,
- gboolean full)
-{
- PurpleProtocolClientInterface *iface = NULL;
-
- g_return_if_fail(PURPLE_IS_PROTOCOL_CLIENT(client));
- g_return_if_fail(PURPLE_IS_BUDDY(buddy));
- g_return_if_fail(user_info != NULL);
-
- iface = PURPLE_PROTOCOL_CLIENT_GET_IFACE(client);
- if(iface != NULL && iface->tooltip_text != NULL) {
- iface->tooltip_text(client, buddy, user_info, full);
- }
-}
-
GList *
purple_protocol_client_blist_node_menu(PurpleProtocolClient *client,
PurpleBlistNode *node)
--- a/libpurple/purpleprotocolclient.h Mon Mar 20 22:27:22 2023 -0500
+++ b/libpurple/purpleprotocolclient.h Mon Mar 20 22:28:16 2023 -0500
@@ -53,7 +53,6 @@
* @list_emblem: Fills the four <type>char**</type>'s with string identifiers
* for "emblems" that the UI will interpret and display as
* relevant.
- * @tooltip_text: Allows the protocol to add text to a buddy's tooltip.
* @blist_node_menu: Returns a list of #PurpleActionMenu structs, which
* represent extra actions to be shown in (for example) the
* right-click menu for @node.
@@ -116,9 +115,6 @@
/*< public >*/
const gchar *(*list_emblem)(PurpleProtocolClient *client, PurpleBuddy *buddy);
- void (*tooltip_text)(PurpleProtocolClient *client, PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info,
- gboolean full);
-
GList *(*blist_node_menu)(PurpleProtocolClient *client, PurpleBlistNode *node);
void (*buddy_free)(PurpleProtocolClient *client, PurpleBuddy *buddy);
@@ -155,20 +151,6 @@
const gchar *purple_protocol_client_list_emblem(PurpleProtocolClient *client, PurpleBuddy *buddy);
/**
- * purple_protocol_client_tooltip_text:
- * @client: The #PurpleProtocolClient instance.
- * @buddy: The #PurpleBuddy instance.
- * @user_info: The #PurpleNotifyUserInfo instance.
- * @full: Whether or not additional info should be added.
- *
- * Asks @client to update @user_info for @buddy. If @full is %TRUE then
- * more detailed information will added.
- *
- * Since: 3.0.0
- */
-void purple_protocol_client_tooltip_text(PurpleProtocolClient *client, PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full);
-
-/**
* purple_protocol_client_blist_node_menu:
* @client: The #PurpleProtocolClient instance.
* @node: The #PurpleBlistNode instance.