Commit a515e0c9 authored by Vincent Castellano's avatar Vincent Castellano

Implement load_ functions

parent f37588b1
...@@ -774,16 +774,21 @@ void py_do_all (void) { ...@@ -774,16 +774,21 @@ void py_do_all (void) {
int preview = 0; int preview = 0;
int reply_id = 0; int reply_id = 0;
unsigned long long flags = 0; unsigned long long flags = 0;
Py_ssize_t i; Py_ssize_t i;
tgl_user_id_t *ids; tgl_user_id_t *ids;
struct tgl_message *M;
int len, len1, len2, len3; int len, len1, len2, len3;
int limit, offset; int limit, offset;
long msg_id = 0; long msg_id = 0;
PyObject *pyObj1 = NULL; PyObject *pyObj1 = NULL;
PyObject *pyObj2 = NULL; PyObject *pyObj2 = NULL;
PyObject *cb_extra = NULL; PyObject *cb_extra = NULL;
PyObject *msg = NULL;
PyObject *peer = NULL; PyObject *peer = NULL;
PyObject *peer1 = NULL; PyObject *peer1 = NULL;
...@@ -877,33 +882,40 @@ void py_do_all (void) { ...@@ -877,33 +882,40 @@ void py_do_all (void) {
else else
PyErr_Print(); PyErr_Print();
break; break;
/* case pq_load_photo: case pq_load_photo:
case pq_load_video: case pq_load_video:
case pq_load_audio: case pq_load_audio:
case pq_load_document: case pq_load_document:
M = py_ptr[p + 1]; if(PyArg_ParseTuple(args, "O!O", &tgl_MsgType, &msg, &cb_extra))
if (!M || (M->media.type != tgl_message_media_photo && M->media.type != tgl_message_media_photo_encr && M->media.type != tgl_message_media_document && M->media.type != tgl_message_media_document_encr)) { {
py_file_cb (TLS, py_ptr[p], 0, 0); M = ((tgl_Msg*)msg)->msg;
if (!M || (M->media.type != tgl_message_media_photo && M->media.type != tgl_message_media_document && M->media.type != tgl_message_media_document_encr)) {
py_file_cb (TLS, cb_extra, 0, 0);
} else { } else {
, limit, offse, limit, offsettif (M->media.type == tgl_message_media_photo) { if (M->media.type == tgl_message_media_photo) {
tgl_do_load_photo (TLS, &M->media.photo, py_file_cb, py_ptr[p]); assert (M->media.photo);
tgl_do_load_photo (TLS, M->media.photo, py_file_cb, cb_extra);
} else if (M->media.type == tgl_message_media_document) { } else if (M->media.type == tgl_message_media_document) {
tgl_do_load_document (TLS, &M->media.document, py_file_cb, py_ptr[p]); tgl_do_load_document (TLS, M->media.document, py_file_cb, cb_extra);
} else { } else {
tgl_do_load_encr_document (TLS, &M->media.encr_document, py_file_cb, py_ptr[p]); tgl_do_load_encr_document (TLS, M->media.encr_document, py_file_cb, cb_extra);
}
} }
} }
break; break;
case pq_load_video_thumb: case pq_load_video_thumb:
case pq_load_document_thumb: case pq_load_document_thumb:
M = py_ptr[p + 1]; if(PyArg_ParseTuple(args, "O!O", &tgl_MsgType, &msg, &cb_extra))
{
M = ((tgl_Msg*)msg)->msg;
if (!M || (M->media.type != tgl_message_media_document)) { if (!M || (M->media.type != tgl_message_media_document)) {
py_file_cb (TLS, py_ptr[p], 0, 0); py_file_cb (TLS, cb_extra, 0, 0);
} else { } else {
tgl_do_load_document_thumb (TLS, &M->media.document, py_file_cb, py_ptr[p]); tgl_do_load_document_thumb (TLS, M->media.document, py_file_cb, cb_extra);
}
} }
break; break;
*/
case pq_fwd: case pq_fwd:
if(PyArg_ParseTuple(args, "O!l|O", &tgl_PeerType, &peer, &msg_id, &cb_extra)) if(PyArg_ParseTuple(args, "O!l|O", &tgl_PeerType, &peer, &msg_id, &cb_extra))
tgl_do_forward_message (TLS, PY_PEER_ID(peer), msg_id, 0, py_msg_cb, cb_extra); tgl_do_forward_message (TLS, PY_PEER_ID(peer), msg_id, 0, py_msg_cb, cb_extra);
......
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