コード例 #1
0
static PyObject*
python_api_incoming_message(PyObject *self, PyObject *args)
{
    PyObject *barejid = NULL;
    PyObject *resource = NULL;
    PyObject *message = NULL;

    if (!PyArg_ParseTuple(args, "OOO", &barejid, &resource, &message)) {
        Py_RETURN_NONE;
    }

    char *barejid_str = python_str_or_unicode_to_string(barejid);
    char *resource_str = python_str_or_unicode_to_string(resource);
    char *message_str = python_str_or_unicode_to_string(message);

    allow_python_threads();
    api_incoming_message(barejid_str, resource_str, message_str);
    free(barejid_str);
    free(resource_str);
    free(message_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
コード例 #2
0
ファイル: c_api.c プロジェクト: anossov/profanity
static void
c_api_incoming_message(char *barejid, char *resource, char *message)
{
    api_incoming_message(barejid, resource, message);
}