diff --git a/tests/python-test.py b/tests/python-test.py index 581ad7e..e8f5ef7 100644 --- a/tests/python-test.py +++ b/tests/python-test.py @@ -251,6 +251,13 @@ def _int(op, group, key, value): prof.settings_set_int(group, key, int(value)) prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(value)) +def _incoming(barejid, resource, message): + if not barejid or not resource or not message: + prof.cons_bad_cmd_usage("/python-test") + return + + prof.incoming_message(barejid, resource, message) + def _cmd_pythontest(subcmd=None, arg1=None, arg2=None, arg3=None, arg4=None): if subcmd == "consalert": _consalert() elif subcmd == "consshow": _consshow(arg1) @@ -267,6 +274,7 @@ def _cmd_pythontest(subcmd=None, arg1=None, arg2=None, arg3=None, arg4=None): elif subcmd == "boolean": _boolean(arg1, arg2, arg3, arg4) elif subcmd == "string": _string(arg1, arg2, arg3, arg4) elif subcmd == "int": _int(arg1, arg2, arg3, arg4) + elif subcmd == "incoming": _incoming(arg1, arg2, arg3) else: prof.cons_bad_cmd_usage("/python-test") def timed_callback(): @@ -298,7 +306,8 @@ def prof_init(version, status): "/python-test string get ", "/python-test string set ", "/python-test int get ", - "/python-test int set " + "/python-test int set ", + "/python-test incoming " ] description = "Python test plugins. All commands focus the plugin window." args = [ @@ -320,7 +329,8 @@ def prof_init(version, status): [ "string get ", "Get a string setting" ], [ "string set ", "Set a string setting" ], [ "int get ", "Get a integer setting" ], - [ "int set ", "Set a integer setting" ] + [ "int set ", "Set a integer setting" ], + [ "incoming ", "Show an incoming message." ] ] examples = [ "/python-test sendline /about", @@ -332,8 +342,24 @@ def prof_init(version, status): prof.register_command("/python-test", 1, 5, synopsis, description, args, examples, _cmd_pythontest) - prof.register_ac("/python-test", - [ "consalert", "consshow", "consshow_t", "constest", "winshow", "winshow_t", "notify", "sendline", "get", "log", "count", "ping", "boolean", "string", "int" ] + prof.register_ac("/python-test", + [ + "consalert", + "consshow", + "consshow_t", + "constest", + "winshow", + "winshow_t", + "notify", + "sendline", + "get", + "log", + "count", + "ping", + "boolean", + "string", + "int", + "incoming" ] ) prof.register_ac("/python-test get", [ "recipient", "room" ] diff --git a/tests/test-c-plugin/test-c-plugin.c b/tests/test-c-plugin/test-c-plugin.c index 05d95d0..a5afed0 100644 --- a/tests/test-c-plugin/test-c-plugin.c +++ b/tests/test-c-plugin/test-c-plugin.c @@ -394,6 +394,12 @@ intsetting(char *op, char *group, char *key, char *value) } } +void +incomingmsg(char *barejid, char *resource, char *message) +{ + prof_incoming_message(barejid, resource, message); +} + void cmd_ctest(char **args) { @@ -412,6 +418,7 @@ cmd_ctest(char **args) else if (strcmp(args[0], "boolean") == 0) booleansetting(args[1], args[2], args[3], args[4]); else if (strcmp(args[0], "string") == 0) stringsetting(args[1], args[2], args[3], args[4]); else if (strcmp(args[0], "int") == 0) intsetting(args[1], args[2], args[3], args[4]); + else if (strcmp(args[0], "incoming") == 0) incomingmsg(args[1], args[2], args[3]); else prof_cons_bad_cmd_usage("/c-test"); } @@ -448,6 +455,7 @@ prof_init(const char * const version, const char * const status) "/c-test string set ", "/c-test int get ", "/c-test int set ", + "/c-test incoming ", NULL }; const char *description = "C test plugin. All commands focus the plugin window."; @@ -471,6 +479,7 @@ prof_init(const char * const version, const char * const status) { "string set ", "Set a string setting" }, { "int get ", "Get a integer setting" }, { "int set ", "Set a integer setting" }, + { "incoming ", "Show an incoming message." }, { NULL, NULL } }; @@ -485,7 +494,25 @@ prof_init(const char * const version, const char * const status) prof_register_command("/c-test", 1, 5, synopsis, description, args, examples, cmd_ctest); - char *cmd_ac[] = { "consalert", "consshow", "consshow_t", "constest", "winshow", "winshow_t", "notify", "sendline", "get", "log", "count", "ping", "boolean", "string", "int", NULL }; + char *cmd_ac[] = { + "consalert", + "consshow", + "consshow_t", + "constest", + "winshow", + "winshow_t", + "notify", + "sendline", + "get", + "log", + "count", + "ping", + "boolean", + "string", + "int", + "incoming", + NULL + }; prof_register_ac("/c-test", cmd_ac); char *get_ac[] = { "recipient", "room", NULL };