added accept_secret_chat

This commit is contained in:
vvaltman 2014-08-27 19:40:21 +04:00
parent 654df2c05c
commit d954f87514
2 changed files with 12 additions and 0 deletions

View file

@ -373,6 +373,7 @@ struct command commands[] = {
{"create_group_chat", {ca_string_end}},
{"chat_set_photo", {ca_chat, ca_file_name_end}},
{"set_profile_photo", {ca_file_name_end}},
{"accept_secret_chat", {ca_secret_chat, ca_none}},
{0, {ca_none}}
};
@ -1573,6 +1574,11 @@ void interpreter (char *line UU) {
tgl_do_restore_msg (num, 0, 0);
} else if (IS_WORD ("quit")) {
exit (0);
} else if (IS_WORD ("accept_secret_chat")) {
GET_PEER_ENCR_CHAT;
tgl_peer_t *E = tgl_peer_get (id);
assert (E);
tgl_do_accept_encr_chat_request (&E->encr_chat, 0, 0);
} else if (IS_WORD ("safe_quit")) {
safe_quit = 1;
}

View file

@ -2757,6 +2757,12 @@ static struct query_methods get_dh_config_methods = {
};
void tgl_do_accept_encr_chat_request (struct tgl_secret_chat *E, void (*callback)(void *callback_extra, int success, struct tgl_secret_chat *E), void *callback_extra) {
if (E->state != sc_request) {
if (callback) {
callback (callback_extra, 0, E);
return;
}
}
assert (E->state == sc_request);
clear_packet ();