diff --git a/interface.c b/interface.c index 21218a6..126152e 100644 --- a/interface.c +++ b/interface.c @@ -639,9 +639,9 @@ void do_history (int arg_num, struct arg args[], struct in_ev *ev) { } void do_dialog_list (int arg_num, struct arg args[], struct in_ev *ev) { - assert (arg_num == 0); + assert (arg_num <= 2); if (ev) { ev->refcnt ++; } - tgl_do_get_dialog_list (TLS, print_dialog_list_gw, ev); + tgl_do_get_dialog_list (TLS, args[0].num != NOT_FOUND ? args[0].num : 100, args[1].num != NOT_FOUND ? args[1].num : 0, print_dialog_list_gw, ev); } void do_send_photo (int arg_num, struct arg args[], struct in_ev *ev) { @@ -1160,7 +1160,7 @@ struct command commands[] = { {"create_secret_chat", {ca_user, ca_none}, do_create_secret_chat, "create_secret_chat \tStarts creation of secret chat"}, {"del_contact", {ca_user, ca_none}, do_del_contact, "del_contact \tDeletes contact from contact list"}, {"delete_msg", {ca_number, ca_none}, do_delete_msg, "delete_msg \tDeletes message"}, - {"dialog_list", {ca_none}, do_dialog_list, "dialog_list\tList of last conversations"}, + {"dialog_list", {ca_number | ca_optional, ca_number | ca_optional, ca_none}, do_dialog_list, "dialog_list [limit=100] [offset=0]\tList of last conversations"}, {"export_card", {ca_none}, do_export_card, "export_card\tPrints card that can be imported by another user with import_card method"}, {"fwd", {ca_peer, ca_number, ca_none}, do_fwd, "fwd \tForwards message to peer. Forward to secret chats is forbidden"}, {"fwd_media", {ca_peer, ca_number, ca_none}, do_fwd_media, "fwd \tForwards message media to peer. Forward to secret chats is forbidden. Result slightly differs from fwd"}, diff --git a/loop.c b/loop.c index a6daff0..69a8bb9 100644 --- a/loop.c +++ b/loop.c @@ -647,7 +647,7 @@ void dlist_cb (struct tgl_state *TLSR, void *callback_extra, int success, int si void on_started (struct tgl_state *TLS) { if (wait_dialog_list) { wait_dialog_list = 0; - tgl_do_get_dialog_list (TLS, dlist_cb, 0); + tgl_do_get_dialog_list (TLS, 100, 0, dlist_cb, 0); } #ifdef USE_LUA lua_diff_end (); diff --git a/lua-tg.c b/lua-tg.c index 4c6e803..1ba970c 100644 --- a/lua-tg.c +++ b/lua-tg.c @@ -873,7 +873,7 @@ void lua_do_all (void) { tgl_do_update_contact_list (TLS, lua_contact_list_cb, lua_ptr[p ++]); break; case lq_dialog_list: - tgl_do_get_dialog_list (TLS, lua_dialog_list_cb, lua_ptr[p ++]); + tgl_do_get_dialog_list (TLS, 100, 0, lua_dialog_list_cb, lua_ptr[p ++]); break; case lq_msg: tgl_do_send_message (TLS, ((tgl_peer_t *)lua_ptr[p + 1])->id, lua_ptr[p + 2], strlen (lua_ptr[p + 2]), lua_msg_cb, lua_ptr[p]); diff --git a/tgl b/tgl index 01a4d84..58c5c6a 160000 --- a/tgl +++ b/tgl @@ -1 +1 @@ -Subproject commit 01a4d84afefc8aabbb2785e84c1f5d91b55d3e25 +Subproject commit 58c5c6a57272773df63e285162536f4ce53c5230