From a11c19eca0d4823b546bc23915a1b2964b0f9cf4 Mon Sep 17 00:00:00 2001 From: Vysheng Date: Tue, 12 Nov 2013 19:47:41 +0400 Subject: [PATCH] Supoort for layer 10 --- constants.h | 6 ++++++ mtproto-client.c | 40 ++++++++++++++++++++++++++++++++++++++++ queries.c | 3 +-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/constants.h b/constants.h index 419f1f9..7998efc 100644 --- a/constants.h +++ b/constants.h @@ -203,6 +203,8 @@ #define CODE_dc_option 0x2ec2a43c #define CODE_config 0x232d5905 #define CODE_nearest_dc 0x8e1a1775 +#define CODE_help_app_update 0x8987f311 +#define CODE_help_no_app_update 0xc45a6536 #define CODE_help_invite_text 0x18cb9f78 #define CODE_messages_stated_messages_links 0x3e74f5c6 #define CODE_messages_stated_message_link 0xa9af2881 @@ -254,6 +256,8 @@ #define CODE_messages_sent_encrypted_file 0x9493ff32 #define CODE_input_file_big 0xfa4f0bb5 #define CODE_input_encrypted_file_big_uploaded 0x2dc173c8 +#define CODE_update_chat_participant_add 0x3a0eeb22 +#define CODE_update_chat_participant_delete 0x6e5f8c22 #define CODE_invoke_after_msg 0xcb9f372d #define CODE_invoke_after_msgs 0x3dc4b4f0 #define CODE_invoke_with_layer1 0x53835315 @@ -315,6 +319,7 @@ #define CODE_upload_get_file 0xe3a6cfb5 #define CODE_help_get_config 0xc4f9186b #define CODE_help_get_nearest_dc 0x1fb33026 +#define CODE_help_get_app_update 0xc812ac7e #define CODE_help_save_app_log 0x6f02f748 #define CODE_help_get_invite_text 0xa4a95186 #define CODE_photos_get_user_photos 0xb7ee553c @@ -352,4 +357,5 @@ #define CODE_upload_save_big_file_part 0xde7b673d #define CODE_init_connection 0x69796de9 #define CODE_invoke_with_layer9 0x76715a63 +#define CODE_invoke_with_layer10 0x39620c41 #endif diff --git a/mtproto-client.c b/mtproto-client.c index 8435e34..32e9567 100644 --- a/mtproto-client.c +++ b/mtproto-client.c @@ -1088,6 +1088,45 @@ void work_update (struct connection *c UU, long long msg_id UU) { print_end (); } break; + case CODE_update_chat_participant_add: + { + peer_id_t chat_id = MK_CHAT (fetch_int ()); + peer_id_t user_id = MK_USER (fetch_int ()); + peer_id_t inviter_id = MK_USER (fetch_int ()); + fetch_int (); // version + + print_start (); + push_color (COLOR_YELLOW); + print_date (time (0)); + printf (" Chat "); + print_chat_name (chat_id, user_chat_get (chat_id)); + printf (": user "); + print_user_name (user_id, user_chat_get (user_id)); + printf (" added by user "); + print_user_name (inviter_id, user_chat_get (inviter_id)); + printf ("\n"); + pop_color (); + print_end (); + } + break; + case CODE_update_chat_participant_delete: + { + peer_id_t chat_id = MK_CHAT (fetch_int ()); + peer_id_t user_id = MK_USER (fetch_int ()); + fetch_int (); // version + + print_start (); + push_color (COLOR_YELLOW); + print_date (time (0)); + printf (" Chat "); + print_chat_name (chat_id, user_chat_get (chat_id)); + printf (": user "); + print_user_name (user_id, user_chat_get (user_id)); + printf (" deleted\n"); + pop_color (); + print_end (); + } + break; default: logprintf ("Unknown update type %08x\n", op); } @@ -1273,6 +1312,7 @@ void work_detained_info (struct connection *c UU, long long msg_id UU) { void work_updates_to_long (struct connection *c UU, long long msg_id UU) { assert (fetch_int () == (int)CODE_updates_too_long); + logprintf ("updates to long... Getting difference\n"); do_get_difference (); } void rpc_execute_answer (struct connection *c, long long msg_id UU) { diff --git a/queries.c b/queries.c index 33c2166..ed3fb47 100644 --- a/queries.c +++ b/queries.c @@ -1489,7 +1489,6 @@ void do_forward_message (peer_id_t id, int n) { return; } clear_packet (); - out_int (CODE_invoke_with_layer9); out_int (CODE_messages_forward_message); out_peer_id (id); out_int (n); @@ -2408,7 +2407,7 @@ struct query_methods get_difference_methods = { void do_get_difference (void) { difference_got = 0; clear_packet (); - out_int (CODE_invoke_with_layer9); + out_int (CODE_invoke_with_layer10); out_int (CODE_init_connection); out_int (TG_APP_ID); if (allow_send_linux_version) {