Commit 96325e2e authored by Vincent Castellano's avatar Vincent Castellano

send_msg implemented

parent c7a66e64
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include "telegram.h" #include "telegram.h"
#include "loop.h" #include "loop.h"
#include "lua-tg.h" #include "lua-tg.h"
#include "python-tg.h"
#include <tgl/tgl.h> #include <tgl/tgl.h>
#include <tgl/tgl-binlog.h> #include <tgl/tgl-binlog.h>
#include <tgl/tgl-net.h> #include <tgl/tgl-net.h>
...@@ -214,6 +215,10 @@ void net_loop (void) { ...@@ -214,6 +215,10 @@ void net_loop (void) {
lua_do_all (); lua_do_all ();
#endif #endif
#ifdef USE_PYTHON
py_do_all ();
#endif
if (safe_quit && !TLS->active_queries) { if (safe_quit && !TLS->active_queries) {
printf ("All done. Exit\n"); printf ("All done. Exit\n");
do_halt (0); do_halt (0);
......
...@@ -16,9 +16,10 @@ def on_our_id(id): ...@@ -16,9 +16,10 @@ def on_our_id(id):
return "Set ID: " + str(our_id) return "Set ID: " + str(our_id)
def on_msg_receive(msg): def on_msg_receive(msg):
pp.pprint(msg) if msg["out"]:
return;
tgl.send_msg(msg["from"]["type"], msg["from"]["id"], "PONG!") tgl.send_msg(msg["from"]["type"], msg["from"]["id"], "PONG!")
return "Got msg from " + msg["from"]["peer"]["first_name"]
def on_secret_chat_update(peer, types): def on_secret_chat_update(peer, types):
return "on_secret_chat_update" return "on_secret_chat_update"
......
This diff is collapsed.
...@@ -57,17 +57,6 @@ function get_title (P, Q) ...@@ -57,17 +57,6 @@ function get_title (P, Q)
end end
end end
local lgi = require ('lgi')
local notify = lgi.require('Notify')
notify.init ("Telegram updates")
local icon = os.getenv("HOME") .. "/.telegram-cli/telegram-pics/telegram_64.png"
function do_notify (user, msg)
local n = notify.Notification.new(user, msg, icon)
n:show ()
end
-- }}}
function on_msg_receive (msg) function on_msg_receive (msg)
if started == 0 then if started == 0 then
...@@ -76,7 +65,6 @@ function on_msg_receive (msg) ...@@ -76,7 +65,6 @@ function on_msg_receive (msg)
if msg.out then if msg.out then
return return
end end
do_notify (get_title (msg.from, msg.to), msg.text)
if (msg.text == 'ping') then if (msg.text == 'ping') then
if (msg.to.id == our_id) then if (msg.to.id == our_id) then
......
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