Commit dc38df06 authored by vvaltman's avatar vvaltman

Updated test lua script

parent 8625cb22
......@@ -418,7 +418,7 @@ void args_parse (int argc, char **argv) {
"B"
#endif
#ifdef USE_LUA
"s"
"s:"
#endif
)) != -1) {
......@@ -475,7 +475,7 @@ void args_parse (int argc, char **argv) {
break;
#ifdef USE_LUA
case 's':
lua_file = tstrdup (optarg);
lua_file = strdup (optarg);
break;
#endif
case 'W':
......
......@@ -40,7 +40,17 @@ end
print ("HI, this is lua script")
function ok_cb(extra, success, result)
if success then
print ("SUCCESS!\n")
end
end
function my_set_chat_photo (extra, success, file)
if success then
chat_set_photo (extra, file, ok_cb, false)
end
end
function on_msg_receive (msg)
if started == 0 then
......@@ -49,6 +59,10 @@ function on_msg_receive (msg)
if msg.out then
return
end
if msg.media == 'photo' and msg.to.type == 'chat' then
load_photo (msg.id, my_set_chat_photo, msg.to.print_name)
end
if (msg.text == 'ping') then
if (msg.to.id == our_id) then
print ('sending pong to ' .. tostring (msg.from.print_name))
......@@ -75,16 +89,16 @@ function on_our_id (id)
our_id = id
end
function on_secret_chat_created (peer)
--vardump (peer)
function on_user_update (user, what)
--vardump (user)
end
function on_user_update (user)
--vardump (user)
function on_chat_update (chat, what)
--vardump (chat)
end
function on_chat_update (user)
--vardump (user)
function on_secret_chat_update (schat, what)
--vardump (schat)
end
function on_get_difference_end ()
......
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