# HG changeset patch
# Node ID 93c7c8be000f48af4504ee39342fd9c99278d498
# Parent  6b0210915ee3c7b7203c33d0698cb8050c8f5738
diff --git a/protocols/demo/purpledemoprotocolconversation.c b/protocols/demo/purpledemoprotocolconversation.c
--- a/protocols/demo/purpledemoprotocolconversation.c
+++ b/protocols/demo/purpledemoprotocolconversation.c
@@ -151,11 +151,43 @@
 
 	for(guint i = 0; i < g_list_model_get_n_items(participants); i++) {
 		PurpleContactInfo *info = NULL;
+		PurpleConversationMember *member = NULL;
 		PurpleConversationMembers *members = NULL;
+		PurpleTags *tags = NULL;
+		const char *badge_id = NULL;
 
 		info = g_list_model_get_item(participants, i);
 		members = purple_conversation_get_members(conversation);
-		purple_conversation_members_add_member(members, info, FALSE, NULL);
+		member = purple_conversation_members_add_member(members, info, FALSE,
+		                                                NULL);
+
+		tags = purple_contact_info_get_tags(info);
+		badge_id = purple_tags_get(tags, "demo/badge");
+		if(!purple_strempty(badge_id)) {
+			PurpleBadge *badge = NULL;
+			PurpleBadgeManager *manager = NULL;
+			PurpleBadges *badges = NULL;
+
+			manager = purple_badge_manager_get_default();
+			badge = purple_badge_manager_find(manager, badge_id);
+			if(!PURPLE_IS_BADGE(badge)) {
+				char *icon_name = NULL;
+				char *id = NULL;
+
+				id = g_strdup_printf("demo-badge-%s", badge_id);
+				icon_name = g_strdup_printf("demo-badge-%s", badge_id);
+				badge = purple_badge_new(id, 0, icon_name, " ");
+				g_free(id);
+				g_free(icon_name);
+
+				purple_badge_manager_add(manager, badge);
+			}
+
+			badges = purple_conversation_member_get_badges(member);
+			purple_badges_add_badge(badges, badge);
+			g_clear_object(&badge);
+		}
+
 		g_clear_object(&info);
 	}
 	g_clear_object(&details);
diff --git a/protocols/demo/resources/contacts.json b/protocols/demo/resources/contacts.json
--- a/protocols/demo/resources/contacts.json
+++ b/protocols/demo/resources/contacts.json
@@ -11,6 +11,7 @@
 	},
 	"username": "Gary",
 	"tags": [
+		"demo-badge:lead-developer",
 		"group:Family"
 	],
 	"profile": "Pidgin 3 will be ready when it is ready! 🗿"
@@ -24,6 +25,7 @@
 		"primitive": "away"
 	},
 	"tags": [
+		"demo-badge:developer",
 		"group:Friends"
 	],
 	"username": "John",
@@ -38,6 +40,7 @@
 		"message": "Coding..."
 	},
 	"tags": [
+		"demo-badge:developer",
 		"group:Work"
 	],
 	"username": "Elliott"
@@ -50,6 +53,7 @@
 		"primitive": "available"
 	},
 	"tags": [
+		"demo-badge:developer",
 		"group:Work"
 	],
 	"username": "Richard"
@@ -63,6 +67,7 @@
 		"message": "Writing crazy patches!"
 	},
 	"tags": [
+		"demo-badge:crazy-patch-writer",
 		"group:School"
 	],
 	"username": "Eion"
@@ -76,6 +81,7 @@
 		"message": "Running all the things in valgrind..."
 	},
 	"tags": [
+		"demo-badge:crazy-patch-writer",
 		"group:School"
 	],
 	"username": "Markus"
diff --git a/protocols/demo/resources/icons/128x128/badges/demo-badge-crazy-patch-writer.png b/protocols/demo/resources/icons/128x128/badges/demo-badge-crazy-patch-writer.png
new file mode 100644
index 0000000000000000000000000000000000000000..6eba40f2c9e348c29d5c4cf3568d12dc4a061e53
GIT binary patch
diff --git a/protocols/demo/resources/icons/128x128/badges/demo-badge-developer.png b/protocols/demo/resources/icons/128x128/badges/demo-badge-developer.png
new file mode 100644
index 0000000000000000000000000000000000000000..f15754ac84541daab50ece39884b838bcdef08e3
GIT binary patch
diff --git a/protocols/demo/resources/icons/128x128/badges/demo-badge-lead-developer.png b/protocols/demo/resources/icons/128x128/badges/demo-badge-lead-developer.png
new file mode 100644
index 0000000000000000000000000000000000000000..c510e1676ce50d13fd05f571c002b73d14cfd3b4
GIT binary patch
diff --git a/protocols/demo/resources/purpledemo.gresource.xml b/protocols/demo/resources/purpledemo.gresource.xml
--- a/protocols/demo/resources/purpledemo.gresource.xml
+++ b/protocols/demo/resources/purpledemo.gresource.xml
@@ -2,6 +2,9 @@
 <gresources>
   <gresource prefix="/im/pidgin/purple/demo">
     <file compressed="true" preprocess="json-stripblanks">contacts.json</file>
+    <file>icons/128x128/badges/demo-badge-crazy-patch-writer.png</file>
+    <file>icons/128x128/badges/demo-badge-developer.png</file>
+    <file>icons/128x128/badges/demo-badge-lead-developer.png</file>
     <file>icons/16x16/apps/im-purple-demo.png</file>
     <file>icons/22x22/apps/im-purple-demo.png</file>
     <file>icons/48x48/apps/im-purple-demo.png</file>
