Ask dialog list at start. Try resend query on timeout

This commit is contained in:
Vysheng 2013-10-25 02:32:13 +04:00
parent 7d61e25a3b
commit 2961f108ec
3 changed files with 16 additions and 1 deletions

2
loop.c
View File

@ -254,6 +254,8 @@ int loop (void) {
rl_attempted_completion_function = (CPPFunction *) complete_text; rl_attempted_completion_function = (CPPFunction *) complete_text;
rl_completion_entry_function = complete_none; rl_completion_entry_function = complete_none;
do_get_dialog_list ();
return main_loop (); return main_loop ();
} }

View File

@ -61,7 +61,16 @@ int alarm_query (struct query *q) {
} }
tree_delete_query (queries_tree, q); tree_delete_query (queries_tree, q);
q->ev.timeout = get_double_time () + QUERY_TIMEOUT; q->ev.timeout = get_double_time () + QUERY_TIMEOUT;
//insert_event_timer (&q->ev); insert_event_timer (&q->ev);
clear_packet ();
out_int (CODE_msg_container);
out_long (q->msg_id);
out_int (q->seq_no);
out_int (4 * q->data_len);
out_ints (q->data, q->data_len);
encrypt_send_message (q->session->c, packet_buffer, packet_ptr - packet_buffer, 0);
return 0; return 0;
} }
@ -80,6 +89,8 @@ struct query *send_query (struct dc *DC, int ints, void *data, struct query_meth
q->data = malloc (4 * ints); q->data = malloc (4 * ints);
memcpy (q->data, data, 4 * ints); memcpy (q->data, data, 4 * ints);
q->msg_id = encrypt_send_message (DC->sessions[0]->c, data, ints, 1); q->msg_id = encrypt_send_message (DC->sessions[0]->c, data, ints, 1);
q->session = DC->sessions[0];
q->seq_no = DC->sessions[0]->seq_no - 1;
if (verbosity) { if (verbosity) {
logprintf ( "Msg_id is %lld %p\n", q->msg_id, q); logprintf ( "Msg_id is %lld %p\n", q->msg_id, q);
} }

View File

@ -39,10 +39,12 @@ struct query {
long long msg_id; long long msg_id;
int data_len; int data_len;
int flags; int flags;
int seq_no;
void *data; void *data;
struct query_methods *methods; struct query_methods *methods;
struct event_timer ev; struct event_timer ev;
struct dc *DC; struct dc *DC;
struct session *session;
void *extra; void *extra;
}; };