Added incoming message calls to test plugins
This commit is contained in:
@@ -251,6 +251,13 @@ def _int(op, group, key, value):
|
|||||||
prof.settings_set_int(group, key, int(value))
|
prof.settings_set_int(group, key, int(value))
|
||||||
prof.win_show(plugin_win, "Set [" + group + "] " + key + " to " + str(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):
|
def _cmd_pythontest(subcmd=None, arg1=None, arg2=None, arg3=None, arg4=None):
|
||||||
if subcmd == "consalert": _consalert()
|
if subcmd == "consalert": _consalert()
|
||||||
elif subcmd == "consshow": _consshow(arg1)
|
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 == "boolean": _boolean(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "string": _string(arg1, arg2, arg3, arg4)
|
elif subcmd == "string": _string(arg1, arg2, arg3, arg4)
|
||||||
elif subcmd == "int": _int(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")
|
else: prof.cons_bad_cmd_usage("/python-test")
|
||||||
|
|
||||||
def timed_callback():
|
def timed_callback():
|
||||||
@@ -298,7 +306,8 @@ def prof_init(version, status):
|
|||||||
"/python-test string get <group> <key>",
|
"/python-test string get <group> <key>",
|
||||||
"/python-test string set <group> <key> <value>",
|
"/python-test string set <group> <key> <value>",
|
||||||
"/python-test int get <group> <key>",
|
"/python-test int get <group> <key>",
|
||||||
"/python-test int set <group> <key> <value>"
|
"/python-test int set <group> <key> <value>",
|
||||||
|
"/python-test incoming <barejid> <resource> <message>"
|
||||||
]
|
]
|
||||||
description = "Python test plugins. All commands focus the plugin window."
|
description = "Python test plugins. All commands focus the plugin window."
|
||||||
args = [
|
args = [
|
||||||
@@ -320,7 +329,8 @@ def prof_init(version, status):
|
|||||||
[ "string get <group> <key>", "Get a string setting" ],
|
[ "string get <group> <key>", "Get a string setting" ],
|
||||||
[ "string set <group> <key> <value>", "Set a string setting" ],
|
[ "string set <group> <key> <value>", "Set a string setting" ],
|
||||||
[ "int get <group> <key>", "Get a integer setting" ],
|
[ "int get <group> <key>", "Get a integer setting" ],
|
||||||
[ "int set <group> <key> <value>", "Set a integer setting" ]
|
[ "int set <group> <key> <value>", "Set a integer setting" ],
|
||||||
|
[ "incoming <barejid> <resource> <message>", "Show an incoming message." ]
|
||||||
]
|
]
|
||||||
examples = [
|
examples = [
|
||||||
"/python-test sendline /about",
|
"/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_command("/python-test", 1, 5, synopsis, description, args, examples, _cmd_pythontest)
|
||||||
|
|
||||||
prof.register_ac("/python-test",
|
prof.register_ac("/python-test",
|
||||||
[ "consalert", "consshow", "consshow_t", "constest", "winshow", "winshow_t", "notify", "sendline", "get", "log", "count", "ping", "boolean", "string", "int" ]
|
[
|
||||||
|
"consalert",
|
||||||
|
"consshow",
|
||||||
|
"consshow_t",
|
||||||
|
"constest",
|
||||||
|
"winshow",
|
||||||
|
"winshow_t",
|
||||||
|
"notify",
|
||||||
|
"sendline",
|
||||||
|
"get",
|
||||||
|
"log",
|
||||||
|
"count",
|
||||||
|
"ping",
|
||||||
|
"boolean",
|
||||||
|
"string",
|
||||||
|
"int",
|
||||||
|
"incoming" ]
|
||||||
)
|
)
|
||||||
prof.register_ac("/python-test get",
|
prof.register_ac("/python-test get",
|
||||||
[ "recipient", "room" ]
|
[ "recipient", "room" ]
|
||||||
|
|||||||
@@ -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
|
void
|
||||||
cmd_ctest(char **args)
|
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], "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], "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], "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");
|
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 <group> <key> <value>",
|
"/c-test string set <group> <key> <value>",
|
||||||
"/c-test int get <group> <key>",
|
"/c-test int get <group> <key>",
|
||||||
"/c-test int set <group> <key> <value>",
|
"/c-test int set <group> <key> <value>",
|
||||||
|
"/c-test incoming <barejid> <resource> <message>",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
const char *description = "C test plugin. All commands focus the plugin window.";
|
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 <group> <key> <value>", "Set a string setting" },
|
{ "string set <group> <key> <value>", "Set a string setting" },
|
||||||
{ "int get <group> <key>", "Get a integer setting" },
|
{ "int get <group> <key>", "Get a integer setting" },
|
||||||
{ "int set <group> <key> <value>", "Set a integer setting" },
|
{ "int set <group> <key> <value>", "Set a integer setting" },
|
||||||
|
{ "incoming <barejid> <resource> <message>", "Show an incoming message." },
|
||||||
{ NULL, NULL }
|
{ 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);
|
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);
|
prof_register_ac("/c-test", cmd_ac);
|
||||||
|
|
||||||
char *get_ac[] = { "recipient", "room", NULL };
|
char *get_ac[] = { "recipient", "room", NULL };
|
||||||
|
|||||||
Reference in New Issue
Block a user