Commit 57cff060 authored by Vysheng's avatar Vysheng

Added -W key to wait dialog list before processing input

parent 051a64fb
...@@ -326,6 +326,7 @@ extern int peer_num; ...@@ -326,6 +326,7 @@ extern int peer_num;
extern int encr_root; extern int encr_root;
extern unsigned char *encr_prime; extern unsigned char *encr_prime;
extern int encr_param_version; extern int encr_param_version;
extern int dialog_list_got;
void read_secret_chat_file (void) { void read_secret_chat_file (void) {
if (binlog_enabled) { return; } if (binlog_enabled) { return; }
...@@ -443,11 +444,16 @@ int mcs (void) { ...@@ -443,11 +444,16 @@ int mcs (void) {
extern int difference_got; extern int difference_got;
int dgot (void) { int dgot (void) {
return !difference_got; return difference_got;
}
int dlgot (void) {
return dialog_list_got;
} }
int readline_active; int readline_active;
int new_dc_num; int new_dc_num;
int wait_dialog_list;
int loop (void) { int loop (void) {
on_start (); on_start ();
if (binlog_enabled) { if (binlog_enabled) {
...@@ -598,6 +604,10 @@ int loop (void) { ...@@ -598,6 +604,10 @@ int loop (void) {
do_get_dialog_list (); do_get_dialog_list ();
if (wait_dialog_list) {
dialog_list_got = 0;
net_loop (0, dlgot);
}
return main_loop (); return main_loop ();
} }
......
...@@ -358,12 +358,13 @@ FILE *log_net_f; ...@@ -358,12 +358,13 @@ FILE *log_net_f;
int register_mode; int register_mode;
int disable_auto_accept; int disable_auto_accept;
int wait_dialog_list;
char *lua_file; char *lua_file;
void args_parse (int argc, char **argv) { void args_parse (int argc, char **argv) {
int opt = 0; int opt = 0;
while ((opt = getopt (argc, argv, "u:hk:vn:Nc:p:l:RfBL:Es:")) != -1) { while ((opt = getopt (argc, argv, "u:hk:vn:Nc:p:l:RfBL:Es:wW")) != -1) {
switch (opt) { switch (opt) {
case 'u': case 'u':
set_default_username (optarg); set_default_username (optarg);
...@@ -413,6 +414,9 @@ void args_parse (int argc, char **argv) { ...@@ -413,6 +414,9 @@ void args_parse (int argc, char **argv) {
case 's': case 's':
lua_file = tstrdup (optarg); lua_file = tstrdup (optarg);
break; break;
case 'W':
wait_dialog_list = 1;
break;
case 'h': case 'h':
default: default:
usage (); usage ();
......
...@@ -1087,6 +1087,7 @@ void do_get_history (peer_id_t id, int limit) { ...@@ -1087,6 +1087,7 @@ void do_get_history (peer_id_t id, int limit) {
/* }}} */ /* }}} */
/* {{{ Get dialogs */ /* {{{ Get dialogs */
int dialog_list_got;
int get_dialogs_on_answer (struct query *q UU) { int get_dialogs_on_answer (struct query *q UU) {
unsigned x = fetch_int (); unsigned x = fetch_int ();
assert (x == CODE_messages_dialogs || x == CODE_messages_dialogs_slice); assert (x == CODE_messages_dialogs || x == CODE_messages_dialogs_slice);
...@@ -1147,6 +1148,8 @@ int get_dialogs_on_answer (struct query *q UU) { ...@@ -1147,6 +1148,8 @@ int get_dialogs_on_answer (struct query *q UU) {
} }
pop_color (); pop_color ();
print_end (); print_end ();
dialog_list_got = 1;
return 0; return 0;
} }
......
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