# HG changeset patch # User Gary Kramlich # Date 1753999037 18000 # Node ID b008934818f53404dd1960d6a30adec26b133213 # Parent 5eab84f697de680e253b7c5f3100be7f19c214b9 Use the presence message of a contact for the subtitle of DM's Testing Done: Loaded a demo account and opened a conversation with someone that has a status message and also verified that the topic was still shown for IRC channels. And of course, called in the turtles as well. Reviewed at https://reviews.imfreedom.org/r/4081/ diff -r 5eab84f697de -r b008934818f5 pidgin/pidginconversation.c --- a/pidgin/pidginconversation.c Thu Jul 31 16:55:45 2025 -0500 +++ b/pidgin/pidginconversation.c Thu Jul 31 16:57:17 2025 -0500 @@ -132,19 +132,59 @@ } } -/* This is used to call g_markup_escape_text for the topic before displaying it - * in its normal label and the tool tip for that label. - */ static char * -pidgin_conversation_escape_topic(G_GNUC_UNUSED GObject *self, - const char *topic, +pidgin_conversation_get_subtitle(G_GNUC_UNUSED GObject *self, + PurpleConversation *conversation, G_GNUC_UNUSED gpointer data) { - if(topic == NULL) { + PurpleConversationType type = 0; + const char *subtitle = NULL; + + if(!PURPLE_IS_CONVERSATION(conversation)) { return g_strdup(""); } - return g_markup_escape_text(topic, -1); + type = purple_conversation_get_conversation_type(conversation); + + if(type == PURPLE_CONVERSATION_TYPE_DM) { + PurpleAccount *account = NULL; + PurpleContactInfo *account_info = NULL; + PurpleConversationMembers *members = NULL; + guint n_items = 0; + + account = purple_conversation_get_account(conversation); + account_info = purple_account_get_contact_info(account); + + members = purple_conversation_get_members(conversation); + n_items = g_list_model_get_n_items(G_LIST_MODEL(members)); + for(guint i = 0; i < n_items; i++) { + PurpleConversationMember *member = NULL; + PurpleContactInfo *info = NULL; + + member = g_list_model_get_item(G_LIST_MODEL(members), i); + info = purple_conversation_member_get_contact_info(member); + if(!purple_contact_info_equal(info, account_info)) { + PurplePresence *presence = NULL; + + presence = purple_contact_info_get_presence(info); + subtitle = purple_presence_get_message(presence); + + g_clear_object(&member); + + break; + } + + g_clear_object(&member); + } + } else { + subtitle = purple_conversation_get_topic(conversation); + } + + if(subtitle == NULL) { + return g_strdup(""); + } + + return g_markup_escape_text(subtitle, -1); } static char * @@ -659,7 +699,7 @@ status_label); gtk_widget_class_bind_template_callback(widget_class, - pidgin_conversation_escape_topic); + pidgin_conversation_get_subtitle); gtk_widget_class_bind_template_callback(widget_class, pidgin_conversation_members_search_changed_cb); gtk_widget_class_bind_template_callback(widget_class, diff -r 5eab84f697de -r b008934818f5 pidgin/resources/Conversations/conversation.ui --- a/pidgin/resources/Conversations/conversation.ui Thu Jul 31 16:55:45 2025 -0500 +++ b/pidgin/resources/Conversations/conversation.ui Thu Jul 31 16:57:17 2025 -0500 @@ -37,10 +37,8 @@ - - - PidginConversation - + + PidginConversation