示例#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);
    }
}
示例#2
0
文件: c_api.c 项目: anossov/profanity
static int
c_api_send_stanza(char *stanza)
{
    return api_send_stanza(stanza);
}