Commit ff704275 authored by Vincent Castellano's avatar Vincent Castellano

Implement msg.load_*

parent 49951819
...@@ -1221,6 +1221,8 @@ tgl_Msg_gettext (tgl_Msg *self, void *closure) ...@@ -1221,6 +1221,8 @@ tgl_Msg_gettext (tgl_Msg *self, void *closure)
return ret; return ret;
} }
static PyObject * static PyObject *
tgl_Msg_getmedia (tgl_Msg *self, void *closure) tgl_Msg_getmedia (tgl_Msg *self, void *closure)
{ {
...@@ -1368,6 +1370,55 @@ tgl_Msg_getreply_id (tgl_Msg *self, void *closure) ...@@ -1368,6 +1370,55 @@ tgl_Msg_getreply_id (tgl_Msg *self, void *closure)
return ret; return ret;
} }
// All load methods are implemented the same, just alias load_document
static PyObject *
tgl_Msg_load_document (tgl_Msg *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"callback", NULL};
PyObject *callback = NULL;
if(PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &callback)) {
PyObject *api_call;
api_call = Py_BuildValue("OO", (PyObject*) self, callback);
Py_INCREF(Py_None);
Py_XINCREF(api_call);
return py_load_document(Py_None, api_call);
} else {
PyErr_Print();
Py_XINCREF(Py_False);
return Py_False;
}
}
static PyObject *
tgl_Msg_load_document_thumb (tgl_Msg *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = {"callback", NULL};
PyObject *callback = NULL;
if(PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &callback)) {
PyObject *api_call;
api_call = Py_BuildValue("OO", (PyObject*) self, callback);
Py_INCREF(Py_None);
Py_XINCREF(api_call);
return py_load_document_thumb(Py_None, api_call);
} else {
PyErr_Print();
Py_XINCREF(Py_False);
return Py_False;
}
}
static PyObject * static PyObject *
tgl_Msg_repr(tgl_Msg *self) tgl_Msg_repr(tgl_Msg *self)
{ {
...@@ -1422,6 +1473,12 @@ static PyMemberDef tgl_Msg_members[] = { ...@@ -1422,6 +1473,12 @@ static PyMemberDef tgl_Msg_members[] = {
static PyMethodDef tgl_Msg_methods[] = { static PyMethodDef tgl_Msg_methods[] = {
{"load_document", (PyCFunction)tgl_Msg_load_document, METH_VARARGS | METH_KEYWORDS, ""},
{"load_photo", (PyCFunction)tgl_Msg_load_document, METH_VARARGS | METH_KEYWORDS, ""},
{"load_audio", (PyCFunction)tgl_Msg_load_document, METH_VARARGS | METH_KEYWORDS, ""},
{"load_video", (PyCFunction)tgl_Msg_load_document, METH_VARARGS | METH_KEYWORDS, ""},
{"load_document_thumb", (PyCFunction)tgl_Msg_load_document_thumb, METH_VARARGS | METH_KEYWORDS, ""},
{"load_video_thumb", (PyCFunction)tgl_Msg_load_document_thumb, METH_VARARGS | METH_KEYWORDS, ""},
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment