Thu, 22 Feb 2024 22:14:22 -0600
Add an offline contact in the Demo protocol
So that one may test things like /r/2961.
Testing Done:
Toggled the Show offline button, and the contact appeared/disappeared.
Reviewed at https://reviews.imfreedom.org/r/2967/
--- a/libpurple/protocols/demo/purpledemoprotocolconversation.c Thu Feb 22 06:05:56 2024 -0600 +++ b/libpurple/protocols/demo/purpledemoprotocolconversation.c Thu Feb 22 22:14:22 2024 -0600 @@ -85,6 +85,25 @@ g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, purple_demo_protocol_echo_im_cb, info, (GDestroyNotify)purple_demo_protocol_im_info_free); + } else if(purple_strequal(who, "Aegina")) { + PurpleDemoProtocolIMInfo *info = g_new(PurpleDemoProtocolIMInfo, 1); + const char *author = purple_message_get_author(message); + const char *contents = NULL; + + if(purple_strequal(author, "Hades")) { + contents = "🫥️"; + } else { + /* TRANSLATORS: This is a reference to the Cap of Invisibility owned by + * various Greek gods, such as Hades, as mentioned. */ + contents = _("Don't tell Hades I have his Cap"); + } + + info->conversation = g_object_ref(conversation); + info->message = purple_message_new_outgoing(author, who, contents, + PURPLE_MESSAGE_SEND); + + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, purple_demo_protocol_echo_im_cb, + info, (GDestroyNotify)purple_demo_protocol_im_info_free); } purple_conversation_write_message(conversation, message);
--- a/libpurple/protocols/demo/resources/contacts.json Thu Feb 22 06:05:56 2024 -0600 +++ b/libpurple/protocols/demo/resources/contacts.json Thu Feb 22 22:14:22 2024 -0600 @@ -92,4 +92,18 @@ "group:Nymphs" ], "username": "Echo" +}, { + "id": "aegina", + "person": { + "id": "aegina" + }, + "presence": { + "primitive": "offline", + "emoji": "🫥️", + "message": "Stole the Cap of Invisibility from Hades" + }, + "tags": [ + "group:Nymphs" + ], + "username": "Aegina" }]
--- a/libpurple/protocols/demo/resources/purpledemo.gresource.xml Thu Feb 22 06:05:56 2024 -0600 +++ b/libpurple/protocols/demo/resources/purpledemo.gresource.xml Thu Feb 22 22:14:22 2024 -0600 @@ -6,6 +6,7 @@ <file>icons/22x22/apps/im-purple-demo.png</file> <file>icons/48x48/apps/im-purple-demo.png</file> <file>icons/scalable/apps/im-purple-demo.svg</file> + <file>buddy_icons/Aegina.png</file> <file>buddy_icons/Echo.png</file> <file>buddy_icons/Eion.png</file> <file>buddy_icons/Elliott.png</file>