diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/api.c | 7 | ||||
-rw-r--r-- | src/plugins/api.h | 1 | ||||
-rw-r--r-- | src/plugins/c_api.c | 7 | ||||
-rw-r--r-- | src/plugins/profapi.c | 1 | ||||
-rw-r--r-- | src/plugins/profapi.h | 2 | ||||
-rw-r--r-- | src/plugins/python_api.c | 19 |
6 files changed, 37 insertions, 0 deletions
diff --git a/src/plugins/api.c b/src/plugins/api.c index e81467a9..81b464ca 100644 --- a/src/plugins/api.c +++ b/src/plugins/api.c @@ -325,3 +325,10 @@ api_win_show_themed(const char *tag, const char *const group, const char *const return 1; } + +int +api_send_stanza(const char *const stanza) +{ + return jabber_send_stanza(stanza); +} + diff --git a/src/plugins/api.h b/src/plugins/api.h index 6494097e..2ded857c 100644 --- a/src/plugins/api.h +++ b/src/plugins/api.h @@ -70,5 +70,6 @@ int api_win_focus(const char *tag); int api_win_show(const char *tag, const char *line); int api_win_show_themed(const char *tag, const char *const group, const char *const key, const char *const def, const char *line); +int api_send_stanza(const char *const stanza); #endif diff --git a/src/plugins/c_api.c b/src/plugins/c_api.c index f2cce6a6..82b89bfd 100644 --- a/src/plugins/c_api.c +++ b/src/plugins/c_api.c @@ -188,6 +188,12 @@ c_api_win_show_themed(char *tag, char *group, char *key, char *def, char *line) return api_win_show_themed(tag, group, key, def, line); } +static int +c_api_send_stanza(char *stanza) +{ + return api_send_stanza(stanza); +} + void c_command_callback(PluginCommand *command, gchar **args) { @@ -236,4 +242,5 @@ c_api_init(void) prof_win_focus = c_api_win_focus; prof_win_show = c_api_win_show; prof_win_show_themed = c_api_win_show_themed; + prof_send_stanza = c_api_send_stanza; } diff --git a/src/plugins/profapi.c b/src/plugins/profapi.c index 84670c33..33bc1694 100644 --- a/src/plugins/profapi.c +++ b/src/plugins/profapi.c @@ -69,3 +69,4 @@ int (*prof_win_focus)(PROF_WIN_TAG win) = NULL; int (*prof_win_show)(PROF_WIN_TAG win, char *line) = NULL; int (*prof_win_show_themed)(PROF_WIN_TAG tag, char *group, char *key, char *def, char *line) = NULL; +int (*prof_send_stanza)(char *stanza) = NULL; diff --git a/src/plugins/profapi.h b/src/plugins/profapi.h index 77288f94..5e212110 100644 --- a/src/plugins/profapi.h +++ b/src/plugins/profapi.h @@ -69,5 +69,7 @@ int (*prof_win_focus)(PROF_WIN_TAG win); int (*prof_win_show)(PROF_WIN_TAG win, char *line); int (*prof_win_show_themed)(PROF_WIN_TAG tag, char *group, char *key, char *def, char *line); +int (*prof_send_stanza)(char *stanza); + #endif diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c index 42222065..7d0ebc89 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c @@ -433,6 +433,24 @@ python_api_win_show_themed(PyObject *self, PyObject *args) return Py_BuildValue(""); } +static PyObject* +python_api_send_stanza(PyObject *self, PyObject *args) +{ + const char *stanza = NULL; + if (!PyArg_ParseTuple(args, "s", &stanza)) { + return Py_BuildValue("i", 0); + } + + allow_python_threads(); + int res = api_send_stanza(stanza); + disable_python_threads(); + if (res) { + return Py_BuildValue("i", 1); + } else { + return Py_BuildValue("i", 0); + } +} + void python_command_callback(PluginCommand *command, gchar **args) { @@ -522,6 +540,7 @@ static PyMethodDef apiMethods[] = { { "win_focus", python_api_win_focus, METH_VARARGS, "Focus a window." }, { "win_show", python_api_win_show, METH_VARARGS, "Show text in the window." }, { "win_show_themed", python_api_win_show_themed, METH_VARARGS, "Show themed text in the window." }, + { "send_stanza", python_api_send_stanza, METH_VARARGS, "Send an XMPP stanza." }, { NULL, NULL, 0, NULL } }; |