diff --git a/presence_notify.py b/presence_notify.py index 1d4573d..77307b8 100644 --- a/presence_notify.py +++ b/presence_notify.py @@ -6,16 +6,16 @@ def _show_settings(): prof.cons_show("") prof.cons_show("Presence notify plugin settings:") - mode = prof.settings_get_string("presence_notify", "mode", "all") + mode = prof.settings_string_get("presence_notify", "mode", "all") prof.cons_show("Mode: {mode}".format(mode=mode)) - resource = prof.settings_get_boolean("presence_notify", "resource", False) + resource = prof.settings_boolean_get("presence_notify", "resource", False) if resource: prof.cons_show("Resource: ON") else: prof.cons_show("Resource: OFF") - ignored_list = prof.settings_get_string_list("presence_notify", "ignored") + ignored_list = prof.settings_string_list_get("presence_notify", "ignored") if ignored_list and len(ignored_list) > 0: prof.cons_show("Ignored:") for contact in ignored_list: @@ -24,23 +24,23 @@ def _show_settings(): def _cmd_presence_notify(arg1=None, arg2=None, arg3=None): if arg1 == "all": - prof.settings_set_string("presence_notify", "mode", "all") + prof.settings_string_set("presence_notify", "mode", "all") prof.cons_show("Notifying on all presence changes") return if arg1 == "online": - prof.settings_set_string("presence_notify", "mode", "online") + prof.settings_string_set("presence_notify", "mode", "online") prof.cons_show("Notifying on online/offline presence changes only") return if arg1 == "off": - prof.settings_set_string("presence_notify", "mode", "off") + prof.settings_string_set("presence_notify", "mode", "off") prof.cons_show("Presence notifications disabled") return if arg1 == "ignored": if arg2 == "clear": - prof.settings_string_list_remove_all("presence_notify", "ignored") + prof.settings_string_list_clear("presence_notify", "ignored") prof.cons_show("Removed all ignored contacts for presence notifications") return @@ -68,11 +68,11 @@ def _cmd_presence_notify(arg1=None, arg2=None, arg3=None): if arg1 == "resource": if arg2 == "on": - prof.settings_set_boolean("presence_notify", "resource", True) + prof.settings_boolean_set("presence_notify", "resource", True) prof.cons_show("Showing resource in presence notifications") return; if arg2 == "off": - prof.settings_set_boolean("presence_notify", "resource", False) + prof.settings_boolean_set("presence_notify", "resource", False) prof.cons_show("Hiding resource in presence notifications") return; @@ -116,11 +116,11 @@ def prof_init(version, status, account_name, fulljid): def _do_notify(barejid, presence): - ignored = prof.settings_get_string_list("presence_notify", "ignored") + ignored = prof.settings_string_list_get("presence_notify", "ignored") if ignored and barejid in ignored: return False - mode = prof.settings_get_string("presence_notify", "mode", "all") + mode = prof.settings_string_get("presence_notify", "mode", "all") if mode == "all": return True elif mode == "online": @@ -143,7 +143,7 @@ def _do_notify(barejid, presence): def prof_on_contact_presence(barejid, resource, presence, status, priority): if _do_notify(barejid, presence): jid = barejid - if prof.settings_get_boolean("presence_notify", "resource", False): + if prof.settings_boolean_get("presence_notify", "resource", False): jid = jid + "/" + resource message = "{jid} is {presence}".format(jid=jid, presence=presence) if status: @@ -155,7 +155,7 @@ def prof_on_contact_presence(barejid, resource, presence, status, priority): def prof_on_contact_offline(barejid, resource, status): if _do_notify(barejid, "offline"): jid = barejid - if prof.settings_get_boolean("presence_notify", "resource", False): + if prof.settings_boolean_get("presence_notify", "resource", False): jid = jid + "/" + resource message = "{jid} is offline".format(jid=jid) if status: diff --git a/say.py b/say.py index 9049ef3..c46ab99 100644 --- a/say.py +++ b/say.py @@ -12,7 +12,7 @@ import os from sys import platform def say(message): - args = prof.settings_get_string("say", "args", "") + args = prof.settings_string_get("say", "args", "") if platform == "darwin": os.system("say " + args + " '" + message + "' 2>/dev/null") @@ -21,7 +21,7 @@ def say(message): def prof_post_chat_message_display(jid, message): - enabled = prof.settings_get_string("say", "enabled", "off") + enabled = prof.settings_string_get("say", "enabled", "off") current_recipient = prof.get_current_recipient() if enabled == "on" or (enabled == "active" and current_recipient == jid): say(jid + " says " + message) @@ -30,7 +30,7 @@ def prof_post_chat_message_display(jid, message): def prof_post_room_message_display(room, nick, message): - enabled = prof.settings_get_string("say", "enabled", "off") + enabled = prof.settings_string_get("say", "enabled", "off") current_muc = prof.get_current_muc() if enabled == "on": say(nick + " in " + room + " says " + message) @@ -50,22 +50,22 @@ def prof_post_priv_message_display(room, nick, message): def _cmd_say(arg1=None, arg2=None): if arg1 == "on": - prof.settings_set_string("say", "enabled", "on") + prof.settings_string_set("say", "enabled", "on") prof.cons_show("Say plugin enabled") elif arg1 == "off": - prof.settings_set_string("say", "enabled", "off") + prof.settings_string_set("say", "enabled", "off") prof.cons_show("Say plugin disabled") elif arg1 == "active": - prof.settings_set_string("say", "enabled", "active") + prof.settings_string_set("say", "enabled", "active") prof.cons_show("Say plugin enabled for active window only") elif arg1 == "args": if arg2 == None: prof.cons_bad_cmd_usage("/say") else: - prof.settings_set_string("say", "args", arg2) + prof.settings_string_set("say", "args", arg2) prof.cons_show("Say plugin arguments set to: " + arg2) elif arg1 == "clearargs": - prof.settings_set_string("say", "args", "") + prof.settings_string_set("say", "args", "") prof.cons_show("Say plugin arguments cleared") elif arg1 == "test": if arg2 == None: @@ -73,8 +73,8 @@ def _cmd_say(arg1=None, arg2=None): else: say(arg2) else: - enabled = prof.settings_get_string("say", "enabled", "off") - args = prof.settings_get_string("say", "args", "") + enabled = prof.settings_string_get("say", "enabled", "off") + args = prof.settings_string_get("say", "args", "") prof.cons_show("Say plugin settings:") prof.cons_show("enabled : " + enabled) if args != "": diff --git a/tests/python-test.py b/tests/python-test.py index fb7eba5..7db540d 100644 --- a/tests/python-test.py +++ b/tests/python-test.py @@ -224,7 +224,7 @@ def _boolean(op, group, key, value_str): dflt = False prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - res = prof.settings_get_boolean(group, key, dflt) + res = prof.settings_boolean_get(group, key, dflt) if res: prof.win_show(plugin_win, "Boolean setting: TRUE") else: @@ -235,7 +235,7 @@ def _boolean(op, group, key, value_str): value = True prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - prof.settings_set_boolean(group, key, value) + prof.settings_boolean_set(group, key, value) prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value)) @@ -255,7 +255,7 @@ def _string(op, group, key, value): if op == "get": prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - res = prof.settings_get_string(group, key, None) + res = prof.settings_string_get(group, key, None) if res: prof.win_show(plugin_win, "String setting: " + res) else: @@ -263,7 +263,7 @@ def _string(op, group, key, value): elif op == "set": prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - prof.settings_set_string(group, key, value) + prof.settings_string_set(group, key, value) prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + value) @@ -276,7 +276,7 @@ def _string_list(op, group, key, value): if group == None or key == None: prof.cons_bad_cmd_usage("/python-test") return - res = prof.settings_get_string_list(group, key) + res = prof.settings_string_list_get(group, key) prof.win_focus(plugin_win) if res is None: prof.win_show(plugin_win, "No list found") @@ -311,7 +311,7 @@ def _string_list(op, group, key, value): if group == None or key == None: prof.cons_bad_cmd_usage("/python-test") return - res = prof.settings_string_list_remove_all(group, key) + res = prof.settings_string_list_clear(group, key) prof.win_focus(plugin_win) if res: prof.win_show(plugin_win, "Removed all items from [" + group + "]" + " " + key) @@ -332,12 +332,12 @@ def _int(op, group, key, value): if op == "get": prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - res = prof.settings_get_int(group, key, 0) + res = prof.settings_int_get(group, key, 0) prof.win_show(plugin_win, "Integer setting: " + str(res)) elif op == "set": prof.win_create(plugin_win, _handle_win_input) prof.win_focus(plugin_win) - prof.settings_set_int(group, key, int(value)) + prof.settings_int_set(group, key, int(value)) prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value)) diff --git a/tests/test-c-plugin/test-c-plugin.c b/tests/test-c-plugin/test-c-plugin.c index ec13e19..424c2af 100644 --- a/tests/test-c-plugin/test-c-plugin.c +++ b/tests/test-c-plugin/test-c-plugin.c @@ -324,7 +324,7 @@ booleansetting(char *op, char *group, char *key, char *value_str) int dflt = 0; prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); - int res = prof_settings_get_boolean(group, key, dflt); + int res = prof_settings_boolean_get(group, key, dflt); if (res) { prof_win_show(plugin_win, "Boolean setting: TRUE"); } else { @@ -337,7 +337,7 @@ booleansetting(char *op, char *group, char *key, char *value_str) } prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); - prof_settings_set_boolean(group, key, value); + prof_settings_boolean_set(group, key, value); char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value_str)]; sprintf(buf, "Set [%s] %s to %s", group, key, value_str); prof_win_show(plugin_win, buf); @@ -365,7 +365,7 @@ stringsetting(char *op, char *group, char *key, char *value) if (strcmp(op, "get") == 0) { prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); - char *res = prof_settings_get_string(group, key, NULL); + char *res = prof_settings_string_get(group, key, NULL); if (res) { char buf[16 + strlen(res)]; sprintf(buf, "String setting: %s", res); @@ -376,7 +376,7 @@ stringsetting(char *op, char *group, char *key, char *value) } else if (strcmp(op, "set") == 0) { prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); - prof_settings_set_string(group, key, value); + prof_settings_string_set(group, key, value); char buf[5 + strlen(group) + 2 + strlen(key) + 4 + strlen(value)]; sprintf(buf, "Set [%s] %s to %s", group, key, value); prof_win_show(plugin_win, buf); @@ -396,7 +396,7 @@ stringlistsetting(char *op, char *group, char *key, char *value) prof_cons_bad_cmd_usage("/c-test"); return; } - char** res = prof_settings_get_string_list(group, key); + char** res = prof_settings_string_list_get(group, key); prof_win_focus(plugin_win); if (res == NULL) { prof_win_show(plugin_win, "No list found"); @@ -448,7 +448,7 @@ stringlistsetting(char *op, char *group, char *key, char *value) prof_cons_bad_cmd_usage("/c-test"); return; } - int res = prof_settings_string_list_remove_all(group, key); + int res = prof_settings_string_list_clear(group, key); prof_win_focus(plugin_win); if (res) { char buf[24 + strlen(group) + 2 + strlen(key) + 1]; @@ -480,7 +480,7 @@ intsetting(char *op, char *group, char *key, char *value) if (strcmp(op, "get") == 0) { prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); - int res = prof_settings_get_int(group, key, 0); + int res = prof_settings_int_get(group, key, 0); char buf[256]; sprintf(buf, "Integer setting: %d", res); prof_win_show(plugin_win, buf); @@ -488,7 +488,7 @@ intsetting(char *op, char *group, char *key, char *value) prof_win_create(plugin_win, handle_win_input); prof_win_focus(plugin_win); int int_value = atoi(value); - prof_settings_set_int(group, key, int_value); + prof_settings_int_set(group, key, int_value); char buf[256]; sprintf(buf, "Set [%s] %s to %d", group, key, int_value); prof_win_show(plugin_win, buf);