--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/plugins/psychic/im.pidgin.Purple.plugin.Psychic.gschema.xml Mon Sep 12 10:03:45 2022 -0500
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?> + <schema path="/plugins/psychic/" id="im.pidgin.Purple.plugin.Psychic"> + <key name="buddies-only" type="b"> + <default>false</default> + <summary>Buddies only</summary> + Only enable for users on the buddy list. + <key name="show-notice" type="b"> + <default>true</default> + <summary>Show notice in conversations</summary> + Display notification message in conversations. + <key name="activate-online" type="b"> + <default>true</default> + <summary>Online only</summary> + <key name="raise-conv" type="b"> + <default>false</default> + <summary>Raise conversation</summary> + Raise psychic conversations when opened. --- a/libpurple/plugins/psychic/meson.build Mon Sep 12 10:02:35 2022 -0500
+++ b/libpurple/plugins/psychic/meson.build Mon Sep 12 10:03:45 2022 -0500
@@ -4,4 +4,14 @@
install : true, install_dir : PURPLE_PLUGINDIR)
+ 'im.pidgin.Purple.plugin.Psychic.gschema.xml', +install_data(settings_schemas, install_dir: schemas_dir) +gnome.post_install(glib_compile_schemas: true) +# Compile the schemas in the current directory; this is only useful for testing +gnome.compile_schemas(depend_files: files(settings_schemas)) devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
--- a/libpurple/plugins/psychic/psychic.c Mon Sep 12 10:02:35 2022 -0500
+++ b/libpurple/plugins/psychic/psychic.c Mon Sep 12 10:03:45 2022 -0500
@@ -32,60 +32,69 @@
#define PLUGIN_AUTHORS { "Christopher O'Brien <siege@preoccupied.net>", NULL }
-#define PREFS_BASE "/plugins/core/psychic"
-#define PREF_BUDDIES PREFS_BASE "/buddies_only"
-#define PREF_NOTICE PREFS_BASE "/show_notice"
-#define PREF_STATUS PREFS_BASE "/activate_online"
-#define PREF_RAISE PREFS_BASE "/raise_conv"
+#define SETTINGS_SCHEMA_ID "im.pidgin.Purple.plugin.Psychic" +#define PREF_BUDDIES "buddies-only" +#define PREF_NOTICE "show-notice" +#define PREF_STATUS "activate-online" +#define PREF_RAISE "raise-conv" buddy_typing_cb(PurpleAccount *acct, const char *name, void *data) {
- PurpleConversation *im;
- PurpleConversationManager *manager;
+ GSettings *settings = NULL; + PurpleConversation *im; + PurpleConversationManager *manager; - if(purple_prefs_get_bool(PREF_STATUS) &&
- ! purple_status_is_available(purple_account_get_active_status(acct))) {
- purple_debug_info("psychic", "not available, doing nothing\n");
+ settings = g_settings_new_with_backend(SETTINGS_SCHEMA_ID, + purple_core_get_settings_backend()); - if(purple_prefs_get_bool(PREF_BUDDIES) &&
- ! purple_blist_find_buddy(acct, name)) {
- purple_debug_info("psychic", "not in blist, doing nothing\n");
+ if(g_settings_get_boolean(settings, PREF_STATUS) && + !purple_status_is_available(purple_account_get_active_status(acct))) { + purple_debug_info("psychic", "not available, doing nothing"); + g_object_unref(settings); - if(FALSE == purple_account_privacy_check(acct, name)) {
- purple_debug_info("psychic", "user %s is blocked\n", name);
+ if(g_settings_get_boolean(settings, PREF_BUDDIES) && + !purple_blist_find_buddy(acct, name)) { + purple_debug_info("psychic", "not in blist, doing nothing"); + g_object_unref(settings); + if(!purple_account_privacy_check(acct, name)) { + purple_debug_info("psychic", "user %s is blocked", name); + g_object_unref(settings); - manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, acct, name);
- purple_debug_info("psychic", "no previous conversation exists\n");
- im = purple_im_conversation_new(acct, name);
+ manager = purple_conversation_manager_get_default(); + im = purple_conversation_manager_find_im(manager, acct, name); + purple_debug_info("psychic", "no previous conversation exists"); + im = purple_im_conversation_new(acct, name); - if(purple_prefs_get_bool(PREF_RAISE)) {
- purple_conversation_present(im);
- if(purple_prefs_get_bool(PREF_NOTICE)) {
+ if(g_settings_get_boolean(settings, PREF_RAISE)) { + purple_conversation_present(im); - /* This is a quote from Star Wars. You should probably not
- translate it literally. If you can't find a fitting cultural
- reference in your language, consider translating something
- like this instead: "You feel a new message coming." */
- purple_conversation_write_system_message(im,
- _("You feel a disturbance in the force..."),
- PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY);
+ if(g_settings_get_boolean(settings, PREF_NOTICE)) { + /* This is a quote from Star Wars. You should probably not + translate it literally. If you can't find a fitting cultural + reference in your language, consider translating something + like this instead: "You feel a new message coming." */ + purple_conversation_write_system_message( + _("You feel a disturbance in the force..."), + PURPLE_MESSAGE_NO_LOG | PURPLE_MESSAGE_ACTIVE_ONLY); - /* Necessary because we may be creating a new conversation window. */
- purple_im_conversation_set_typing_state(PURPLE_IM_CONVERSATION(im),
+ /* Necessary because we may be creating a new conversation window. */ + purple_im_conversation_set_typing_state(PURPLE_IM_CONVERSATION(im), + g_object_unref(settings); @@ -144,11 +153,6 @@
- purple_prefs_add_none(PREFS_BASE);
- purple_prefs_add_bool(PREF_BUDDIES, FALSE);
- purple_prefs_add_bool(PREF_NOTICE, TRUE);
- purple_prefs_add_bool(PREF_STATUS, TRUE);
convs_handle = purple_conversations_get_handle();
purple_signal_connect(convs_handle, "buddy-typing", plugin,