Commit 101a6fd7 authored by Vysheng's avatar Vysheng

status function to lua

parent b8bdb7ae
...@@ -71,5 +71,8 @@ Function_list (arguments are listed aside from cb_function and cb_extra, : ...@@ -71,5 +71,8 @@ Function_list (arguments are listed aside from cb_function and cb_extra, :
delete_msg (msg) delete_msg (msg)
restore_msg (number) restore_msg (number)
status_online ()
status_offline ()
Also, you have function Also, you have function
postpone (cb_function, cb_extra, timeout). It will call your cb_function in specified number of seconds (number of seconds may be double). postpone (cb_function, cb_extra, timeout). It will call your cb_function in specified number of seconds (number of seconds may be double).
...@@ -488,7 +488,9 @@ enum lua_query_type { ...@@ -488,7 +488,9 @@ enum lua_query_type {
lq_delete_msg, lq_delete_msg,
lq_restore_msg, lq_restore_msg,
lq_accept_secret_chat, lq_accept_secret_chat,
lq_send_contact lq_send_contact,
lq_status_online,
lq_status_offline
}; };
struct lua_query_extra { struct lua_query_extra {
...@@ -1030,6 +1032,14 @@ void lua_do_all (void) { ...@@ -1030,6 +1032,14 @@ void lua_do_all (void) {
free (s3); free (s3);
p += 5; p += 5;
break; break;
case lq_status_online:
tgl_do_update_status (1, lua_empty_cb, lua_ptr[p]);
p ++;
break;
case lq_status_offline:
tgl_do_update_status (0, lua_empty_cb, lua_ptr[p]);
p ++;
break;
/* /*
lq_delete_msg, lq_delete_msg,
lq_restore_msg, lq_restore_msg,
...@@ -1109,6 +1119,8 @@ struct lua_function functions[] = { ...@@ -1109,6 +1119,8 @@ struct lua_function functions[] = {
{"restore_msg", lq_restore_msg, { lfp_positive_number, lfp_none }}, {"restore_msg", lq_restore_msg, { lfp_positive_number, lfp_none }},
{"accept_secret_chat", lq_accept_secret_chat, { lfp_secret_chat, lfp_none }}, {"accept_secret_chat", lq_accept_secret_chat, { lfp_secret_chat, lfp_none }},
{"send_contact", lq_send_contact, { lfp_peer, lfp_string, lfp_string, lfp_string, lfp_none }}, {"send_contact", lq_send_contact, { lfp_peer, lfp_string, lfp_string, lfp_string, lfp_none }},
{"status_online", lq_status_online, { lfp_none }},
{"status_offline", lq_status_offline, { lfp_none }},
{ 0, 0, { lfp_none}} { 0, 0, { lfp_none}}
}; };
......
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