Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for deleting encrypted chats #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions queries-encrypted.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ void tgl_do_send_encr_msg_action (struct tgl_state *TLS, struct tgl_message *M,
out_int (CODE_decrypted_message_action_abort_key);
out_long (M->action.exchange_id);
break;
case tgl_message_action_delete_messages:
out_int (CODE_decrypted_message_action_delete_messages);
out_int(CODE_vector);
out_int(1);
out_long (M->id);
break;
case tgl_message_action_noop:
out_int (CODE_decrypted_message_action_noop);
break;
Expand Down
7 changes: 7 additions & 0 deletions queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -3096,6 +3096,13 @@ static struct query_methods delete_msg_methods = {
};

void tgl_do_delete_msg (struct tgl_state *TLS, long long id, void (*callback)(struct tgl_state *TLS, void *callback_extra, int success), void *callback_extra) {
struct tgl_message *M = tgl_message_get (TLS, id);
if (tgl_get_peer_type (M->to_id) == TGL_PEER_ENCR_CHAT) {
M->action.type=tgl_message_action_delete_messages;
M->flags |=TGLMF_SERVICE;
tgl_do_send_msg (TLS, M, 0, 0);
return;
}
clear_packet ();
out_int (CODE_messages_delete_messages);
out_int (CODE_vector);
Expand Down