Ejemplo n.º 1
0
static PyObject*
python_api_send_stanza(PyObject *self, PyObject *args)
{
    PyObject *stanza = NULL;
    if (!PyArg_ParseTuple(args, "O", &stanza)) {
        return Py_BuildValue("O", Py_False);
    }

    char *stanza_str = python_str_or_unicode_to_string(stanza);

    allow_python_threads();
    int res = api_send_stanza(stanza_str);
    free(stanza_str);
    disable_python_threads();
    if (res) {
        return Py_BuildValue("O", Py_True);
    } else {
        return Py_BuildValue("O", Py_False);
    }
}
Ejemplo n.º 2
0
static int
c_api_send_stanza(char *stanza)
{
    return api_send_stanza(stanza);
}