status function to lua

This commit is contained in:
Vysheng 2014-09-09 17:27:43 +04:00
parent b8bdb7ae36
commit 101a6fd7d0
2 changed files with 16 additions and 1 deletions

View File

@ -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).

View File

@ -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) {
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[] = {
{"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}}
}; };