Skip to content

Commit 7e0cd1c

Browse files
author
alexbft
committed
Enabled Peer.fwd_msg for python scripts
1 parent e250f55 commit 7e0cd1c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎python-types.c

+29
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,34 @@ tgl_Peer_send_msg (tgl_Peer *self, PyObject *args, PyObject *kwargs)
406406

407407
}
408408

409+
static PyObject *
410+
tgl_Peer_fwd_msg (tgl_Peer *self, PyObject *args, PyObject *kwargs)
411+
{
412+
static char *kwlist[] = {"callback", NULL};
413+
414+
int fwd_id = 0;
415+
PyObject *callback = NULL;
416+
417+
if(PyArg_ParseTupleAndKeywords(args, kwargs, "i|O", kwlist, &fwd_id, &callback)) {
418+
PyObject *api_call;
419+
420+
if(callback)
421+
api_call = Py_BuildValue("OiO", (PyObject*) self, fwd_id, callback);
422+
else
423+
api_call = Py_BuildValue("Oi", (PyObject*) self, fwd_id);
424+
425+
Py_INCREF(Py_None);
426+
Py_XINCREF(api_call);
427+
428+
return py_fwd(Py_None, api_call);
429+
} else {
430+
PyErr_Print();
431+
Py_XINCREF(Py_False);
432+
return Py_False;
433+
}
434+
435+
}
436+
409437
static PyObject *
410438
tgl_Peer_send_typing (tgl_Peer *self, PyObject *args, PyObject *kwargs)
411439
{
@@ -932,6 +960,7 @@ static PyMethodDef tgl_Peer_methods[] = {
932960
{"send_contact", (PyCFunction)tgl_Peer_send_contact, METH_VARARGS | METH_KEYWORDS, ""},
933961
{"send_location", (PyCFunction)tgl_Peer_send_location, METH_VARARGS | METH_KEYWORDS, ""},
934962
{"mark_read", (PyCFunction)tgl_Peer_mark_read, METH_VARARGS | METH_KEYWORDS, ""},
963+
{"fwd_msg", (PyCFunction)tgl_Peer_fwd_msg, METH_VARARGS | METH_KEYWORDS, ""},
935964
{NULL} /* Sentinel */
936965
};
937966

0 commit comments

Comments
 (0)