diff --git a/README-LUA b/README-LUA index 3ef81653..fd61bed9 100644 --- a/README-LUA +++ b/README-LUA @@ -58,6 +58,8 @@ Function_list (arguments are listed aside from cb_function and cb_extra, : chat_add_user (chat, user) chat_del_user (chat, user) + res_user (username) + add_contact (phone, first_name, last_name) rename_contact (phone, first_name, last_name) @@ -78,7 +80,9 @@ Function_list (arguments are listed aside from cb_function and cb_extra, : status_offline () send_location (peer, latitude, longitude) - + + import_chat_link (link) + 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). register_interface_function (name, cb_function, cb_arg, description, arg1_type, arg2_type, ...) adds function to CLI interface diff --git a/lua-tg.c b/lua-tg.c index 592df608..a4f43f31 100644 --- a/lua-tg.c +++ b/lua-tg.c @@ -1,20 +1,17 @@ /* This file is part of telegram-cli. - Telegram-cli is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. - Telegram-cli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with this telegram-cli. If not, see . - Copyright Vitaly Valtman 2013-2015 + */ #ifdef HAVE_CONFIG_H @@ -648,6 +645,7 @@ enum lua_query_type { lq_load_document_thumb, lq_delete_msg, lq_restore_msg, + lq_res_user, lq_accept_secret_chat, lq_send_contact, lq_status_online, @@ -1204,6 +1202,12 @@ void lua_do_all (void) { tgl_do_delete_msg (TLS, ((struct tgl_message *)lua_ptr[p + 1])->id, lua_empty_cb, lua_ptr[p]); p += 2; break; + case lq_res_user: + s = lua_ptr[p + 1]; + tgl_do_contact_search (TLS, s, strlen (s), lua_user_cb, lua_ptr[p]); + free (s); + p += 2; + break; case lq_restore_msg: tgl_do_delete_msg (TLS, (long)lua_ptr[p + 1], lua_empty_cb, lua_ptr[p]); p += 2; @@ -1332,6 +1336,7 @@ struct lua_function functions[] = { {"create_secret_chat", lq_create_secret_chat, { lfp_user, lfp_none }}, {"create_group_chat", lq_create_group_chat, { lfp_user, lfp_string, lfp_none }}, {"delete_msg", lq_delete_msg, { lfp_msg, lfp_none }}, + {"res_user", lq_res_user, { lfp_string, lfp_none }}, {"restore_msg", lq_restore_msg, { lfp_positive_number, 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 }},