1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-07-02 17:16:45 +02:00

get_status returns a string rather than an integer.

This commit is contained in:
jakob
2017-05-17 08:37:05 -04:00
parent 7d3d129624
commit 02ea0fac44
3 changed files with 20 additions and 7 deletions

View File

@ -64,14 +64,25 @@ static PyObject *python_api_get_nick(PyObject *self, PyObject *args)
static PyObject *python_api_get_status(PyObject *self, PyObject *args)
{
TOX_USER_STATUS status;
PyObject *ret;
if (!PyArg_ParseTuple(args, ""))
return NULL;
status = api_get_status();
ret = Py_BuildValue("i", status);
switch (api_get_status()) {
case TOX_USER_STATUS_NONE:
ret = Py_BuildValue("s", "online");
break;
case TOX_USER_STATUS_AWAY:
ret = Py_BuildValue("s", "away");
break;
case TOX_USER_STATUS_BUSY:
ret = Py_BuildValue("s", "busy");
break;
}
return ret;
}