--- a/libpurple/protocols/demo/purpledemoprotocolactions.c Mon Mar 11 21:25:28 2024 -0500
+++ b/libpurple/protocols/demo/purpledemoprotocolactions.c Mon Mar 11 21:27:23 2024 -0500
@@ -744,6 +744,45 @@
g_clear_object(&account);
+static const char *puns[] = { + "Toucan play at that game!", + "As long as it's not too much of a birden...", + "Sounds like a bit of ostrich...", + "People can't stop raven!", + "Have you heard about the bird?", +purple_demo_protocol_generic_notification(G_GNUC_UNUSED GSimpleAction *action, + G_GNUC_UNUSED gpointer data) + PurpleAccount *account = NULL; + PurpleAccountManager *account_manager = NULL; + PurpleNotification *notification = NULL; + PurpleNotificationManager *notification_manager = NULL; + const char *account_id = NULL; + static guint counter = 0; + account_id = g_variant_get_string(parameter, NULL); + account_manager = purple_account_manager_get_default(); + account = purple_account_manager_find_by_id(account_manager, account_id); + notification = purple_notification_new(PURPLE_NOTIFICATION_TYPE_GENERIC, + account, g_strdup(puns[counter]), + notification_manager = purple_notification_manager_get_default(); + purple_notification_manager_add(notification_manager, notification); + if(counter >= G_N_ELEMENTS(puns)) { + g_clear_object(&account); /******************************************************************************
* PurpleProtocolActions Implementation
*****************************************************************************/
@@ -767,6 +806,10 @@
.activate = purple_demo_protocol_fatal_failure_action_activate,
+ .name = "generic-notification", + .activate = purple_demo_protocol_generic_notification, .activate = purple_demo_protocol_remote_add,
@@ -833,6 +876,13 @@
g_menu_append_item(menu, item);
+ item = g_menu_item_new(_("Trigger a generic notification"), + "prpl-demo.generic-notification"); + g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s", + g_menu_append_item(menu, item); item = g_menu_item_new(_("Trigger a contact adding you"),
g_menu_item_set_attribute(item, PURPLE_MENU_ATTRIBUTE_DYNAMIC_TARGET, "s",