Commit 7c9129b0 authored by Vincent Castellano's avatar Vincent Castellano

Add tgl_Msg class

parent 25ed2042
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define __PYTHON_TG_H__ #define __PYTHON_TG_H__
#include <string.h> #include <string.h>
#include <Python.h>
#include <tgl/tgl.h> #include <tgl/tgl.h>
void py_init (const char *file); void py_init (const char *file);
...@@ -32,4 +33,9 @@ void py_chat_update (struct tgl_chat *C, unsigned flags); ...@@ -32,4 +33,9 @@ void py_chat_update (struct tgl_chat *C, unsigned flags);
void py_binlog_end (void); void py_binlog_end (void);
void py_diff_end (void); void py_diff_end (void);
void py_do_all (void); void py_do_all (void);
void py_add_string_field (PyObject* dict, char *name, const char *value);
void py_add_string_field_arr (PyObject* list, int num, const char *value);
void py_add_num_field (PyObject* dict, const char *name, double value);
#endif #endif
This diff is collapsed.
...@@ -6,9 +6,16 @@ ...@@ -6,9 +6,16 @@
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
tgl_peer_t peer; tgl_peer_t *peer;
} tgl_Peer; } tgl_Peer;
typedef struct {
PyObject_HEAD
struct tgl_message *msg;
} tgl_Msg;
PyObject * tgl_Peer_FromTglPeer(tgl_peer_t *peer); PyObject * tgl_Peer_FromTglPeer(tgl_peer_t *peer);
PyObject * tgl_Msg_FromTglMsg(struct tgl_message *peer);
#endif #endif
...@@ -35,7 +35,7 @@ def on_msg_receive(msg): ...@@ -35,7 +35,7 @@ def on_msg_receive(msg):
if msg["out"] and not binlog_done: if msg["out"] and not binlog_done:
return; return;
print(msg["to"].user_id) print(msg["to"].id)
""" """
def on_msg_receive(msg): def on_msg_receive(msg):
......
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