How is Pidgin::DisplayItem::id supposed to be unique?

I’m working on the problem that new conversations open when double clicking a contact with an already open conversation. Following code does the job when testing with the Demo plugin, but the IDs are only the names of the contacts so how is it or should it be guaranteed that they are unique as the doc says they are?

diff --git a/pidgin/pidgindisplaywindow.c b/pidgin/pidgindisplaywindow.c
--- a/pidgin/pidgindisplaywindow.c
+++ b/pidgin/pidgindisplaywindow.c
@@ -101,6 +101,18 @@ pidgin_display_window_find_conversation(
 	return (conversation_a == conversation_b);
 }
 
+static gboolean
+pidgin_display_window_find_conversation_by_id(gconstpointer a,
+                                              G_GNUC_UNUSED gconstpointer b,
+                                              gpointer user_data)
+{
+	PidginDisplayItem *item_a = PIDGIN_DISPLAY_ITEM((gpointer)a);
+	const char *a_id = pidgin_display_item_get_id(item_a);
+	const char *id = user_data;
+
+	return g_strcmp0(a_id, id) == 0;
+}
+
 /******************************************************************************
  * Actions
  *****************************************************************************/
@@ -461,6 +473,8 @@ pidgin_display_window_add(PidginDisplayW
 	if(PIDGIN_IS_CONVERSATION(pidgin_conversation)) {
 		PidginDisplayItem *item = NULL;
 		const char *id = NULL;
+		guint position = 0;
+		gboolean found = FALSE;
 
 		GtkWidget *parent = gtk_widget_get_parent(pidgin_conversation);
 
@@ -470,6 +484,13 @@ pidgin_display_window_add(PidginDisplayW
 		}
 
 		id = purple_conversation_get_name(purple_conversation);
+		found = g_list_store_find_with_equal_func_full(window->conversation_model,
+		                                               NULL,
+		                                               pidgin_display_window_find_conversation_by_id,
+		                                               (char*)id,
+		                                               &position);
+
+		if (!found) {
 		item = pidgin_display_item_new(pidgin_conversation, id);
 		g_object_set_data(G_OBJECT(item), "conversation", purple_conversation);
 
@@ -479,6 +500,7 @@ pidgin_display_window_add(PidginDisplayW
 
 		g_list_store_append(window->conversation_model, item);
 		g_clear_object(&item);
+		}
 
 		if(GTK_IS_WIDGET(parent)) {
 			g_object_unref(pidgin_conversation);

The ids need to be unique for the account as well. I think the demo protocol plugin just hacked it together, but it should probably be a string like {account-id}-{contact-id} to make sure it stays globally unique.

As far as I can tell this is currently not done. I made an RR (RR 2980).

Yeah, stuff gets overlooked sometimes… Sorry about that! I’ll take a look at the RR in a bit.

Yeah of course, no problem!

I think this can be marked as solved since the RR got merged. But I don’t see an option to do that.

We only enabled the solved plugin in the support forum. Not sure if that’s the best call… thoughts?

Oh I didn’t realize that plugin was only available in the support section. I don’t really need it, I just wanted to mark it solved for completeness.

You’re probably the one who will answer most of these development questions if you don’t need the solved mark for a better overview, we can leave it as it is.

we could add a solved tag too for general stuff like this?