pidgin/pidgin

Parents d6ed63c2508e
Children c185b8801e1a
use a globally unique id when creating new Pidgin::DisplayItem's

Use a globally unique id when creating new `Pidgin::DisplayItem`s as the doc demands and as discussed on [discourse](https://discourse.imfreedom.org/t/how-is-pidgin-id-supposed-to-be-unique/134/2)

Testing Done:
Ran Pidgin and opened a conversation.

Reviewed at https://reviews.imfreedom.org/r/2980/
--- a/pidgin/pidgindisplaywindow.c Fri Feb 23 06:13:40 2024 -0600
+++ b/pidgin/pidgindisplaywindow.c Wed Feb 28 00:11:14 2024 -0600
@@ -466,10 +466,14 @@
PurpleConversation *purple_conversation)
{
GtkWidget *pidgin_conversation = NULL;
+ const char *conversation_id = NULL;
g_return_if_fail(PIDGIN_IS_DISPLAY_WINDOW(window));
g_return_if_fail(PURPLE_IS_CONVERSATION(purple_conversation));
+ conversation_id = purple_conversation_get_id(purple_conversation);
+ g_return_if_fail(conversation_id != NULL);
+
pidgin_conversation = pidgin_conversation_from_purple_conversation(purple_conversation);
if(!PIDGIN_IS_CONVERSATION(pidgin_conversation)) {
@@ -478,7 +482,10 @@
if(PIDGIN_IS_CONVERSATION(pidgin_conversation)) {
PidginDisplayItem *item = NULL;
- const char *id = NULL;
+ PurpleAccount *account = purple_conversation_get_account(purple_conversation);
+ PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
+ const char *account_id = NULL;
+ char *id = NULL;
GtkWidget *parent = gtk_widget_get_parent(pidgin_conversation);
@@ -487,8 +494,10 @@
gtk_widget_unparent(pidgin_conversation);
}
- id = purple_conversation_get_name(purple_conversation);
+ account_id = purple_contact_info_get_id(info);
+ id = g_strdup_printf("%s-%s", account_id, conversation_id);
item = pidgin_display_item_new(pidgin_conversation, id);
+ g_free(id);
g_object_set_data(G_OBJECT(item), "conversation", purple_conversation);
g_object_bind_property(purple_conversation, "title",