Merge pull request #387 from asdofindia/lua_send_typing

add send_typing and send_typing_abort to lua
This commit is contained in:
vysheng 2015-01-12 18:41:08 +03:00
commit 886cc484c0
2 changed files with 15 additions and 0 deletions

View File

@ -31,6 +31,9 @@ Function_list (arguments are listed aside from cb_function and cb_extra, :
rename_chat (chat, new_name)
chat_set_photo (chat, file)
send_typing (peer)
send_typing_abort (peer)
send_msg (peer, text)
fwd_msg (peer, msg)

View File

@ -464,6 +464,8 @@ enum lua_query_type {
lq_contact_list,
lq_dialog_list,
lq_msg,
lq_send_typing,
lq_send_typing_abort,
lq_rename_chat,
lq_send_photo,
lq_chat_set_photo,
@ -878,6 +880,14 @@ void lua_do_all (void) {
free (lua_ptr[p + 2]);
p += 3;
break;
case lq_send_typing:
tgl_do_send_typing (TLS, ((tgl_peer_t *)lua_ptr[p + 1])->id, tgl_typing_typing, lua_empty_cb, lua_ptr[p]);
p += 2;
break;
case lq_send_typing_abort:
tgl_do_send_typing (TLS, ((tgl_peer_t *)lua_ptr[p + 1])->id, tgl_typing_cancel, lua_empty_cb, lua_ptr[p]);
p += 2;
break;
case lq_rename_chat:
tgl_do_rename_chat (TLS, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], lua_msg_cb, lua_ptr[p]);
free (lua_ptr[p + 2]);
@ -1131,6 +1141,8 @@ struct lua_function functions[] = {
{"get_dialog_list", lq_dialog_list, { lfp_none }},
{"rename_chat", lq_rename_chat, { lfp_chat, lfp_string, lfp_none }},
{"send_msg", lq_msg, { lfp_peer, lfp_string, lfp_none }},
{"send_typing", lq_send_typing, { lfp_peer, lfp_none }},
{"send_typing_abort", lq_send_typing_abort, { lfp_peer, lfp_none }},
{"send_photo", lq_send_photo, { lfp_peer, lfp_string, lfp_none }},
{"send_video", lq_send_video, { lfp_peer, lfp_string, lfp_none }},
{"send_audio", lq_send_audio, { lfp_peer, lfp_string, lfp_none }},