Commit fa26c2b6 authored by Vincent Castellano's avatar Vincent Castellano

Completed initial tgl_Peer type implementation

parent d6dec6f8
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#ifdef USE_PYTHON #ifdef USE_PYTHON
#include "python-tg.h" #include "python-tg.h"
#include "python-types.h"
#endif #endif
#include <string.h> #include <string.h>
...@@ -74,6 +73,11 @@ ...@@ -74,6 +73,11 @@
// Python Imports // Python Imports
#include "datetime.h" #include "datetime.h"
// Custom Types
#include "python-types.h"
//#include "interface.h" //#include "interface.h"
//#include "auto/constants.h" //#include "auto/constants.h"
#include <tgl/tgl.h> #include <tgl/tgl.h>
...@@ -269,7 +273,7 @@ PyObject* get_update_types (unsigned flags) { ...@@ -269,7 +273,7 @@ PyObject* get_update_types (unsigned flags) {
PyObject* get_peer (tgl_peer_id_t id, tgl_peer_t *P) { PyObject* get_peer (tgl_peer_id_t id, tgl_peer_t *P) {
PyObject *peer; PyObject *peer;
/*
peer = PyDict_New(); peer = PyDict_New();
if(peer == NULL) if(peer == NULL)
assert(0); // TODO handle python exception; assert(0); // TODO handle python exception;
...@@ -320,7 +324,9 @@ PyObject* get_peer (tgl_peer_id_t id, tgl_peer_t *P) { ...@@ -320,7 +324,9 @@ PyObject* get_peer (tgl_peer_id_t id, tgl_peer_t *P) {
} }
PyDict_SetItemString (peer, "peer", peer_obj); PyDict_SetItemString (peer, "peer", peer_obj);
} }
*/
peer = tgl_Peer_FromTglPeer(P);
return peer; return peer;
} }
......
This diff is collapsed.
...@@ -31,6 +31,13 @@ def history_cb(msg_list, ptype, pid, success, msgs): ...@@ -31,6 +31,13 @@ def history_cb(msg_list, ptype, pid, success, msgs):
if len(msgs) == HISTORY_QUERY_SIZE: if len(msgs) == HISTORY_QUERY_SIZE:
tgl.get_history(ptype, pid, len(msg_list), HISTORY_QUERY_SIZE, partial(history_cb, msg_list, ptype, pid)); tgl.get_history(ptype, pid, len(msg_list), HISTORY_QUERY_SIZE, partial(history_cb, msg_list, ptype, pid));
def on_msg_receive(msg):
if msg["out"] and not binlog_done:
return;
print(msg["to"].user_id)
"""
def on_msg_receive(msg): def on_msg_receive(msg):
if msg["out"] and not binlog_done: if msg["out"] and not binlog_done:
return; return;
...@@ -53,7 +60,7 @@ def on_msg_receive(msg): ...@@ -53,7 +60,7 @@ def on_msg_receive(msg):
if text.startswith("!loadhistory"): if text.startswith("!loadhistory"):
msg_list = [] msg_list = []
tgl.get_history_ext(ptype, pid, 0, HISTORY_QUERY_SIZE, partial(history_cb, msg_list, ptype, pid)); tgl.get_history_ext(ptype, pid, 0, HISTORY_QUERY_SIZE, partial(history_cb, msg_list, ptype, pid));
"""
def on_secret_chat_update(peer, types): def on_secret_chat_update(peer, types):
return "on_secret_chat_update" return "on_secret_chat_update"
......
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