示例#1
0
static PyObject*
python_api_notify(PyObject *self, PyObject *args)
{
    PyObject *message = NULL;
    PyObject *category = NULL;
    int timeout_ms = 5000;

    if (!PyArg_ParseTuple(args, "OiO", &message, &timeout_ms, &category)) {
        Py_RETURN_NONE;
    }

    char *message_str = python_str_or_unicode_to_string(message);
    char *category_str = python_str_or_unicode_to_string(category);

    allow_python_threads();
    api_notify(message_str, category_str, timeout_ms);
    free(message_str);
    free(category_str);
    disable_python_threads();

    Py_RETURN_NONE;
}
示例#2
0
文件: c_api.c 项目: anossov/profanity
static void
c_api_notify(const char *message, int timeout_ms, const char *category)
{
    api_notify(message, category, timeout_ms);
}