Updated layer 17

This commit is contained in:
Vysheng 2014-10-06 14:06:48 +04:00
parent 7a9764f24a
commit 62d3c07f34
3 changed files with 20 additions and 16 deletions

View File

@ -2304,7 +2304,7 @@ void print_media (struct in_ev *ev, struct tgl_message_media *M) {
} }
return; return;
case tgl_message_media_geo: case tgl_message_media_geo:
mprintf (ev, "[geo] https://maps.google.com/?q=%.6lf,%.6lf", M->geo.latitude, M->geo.longitude); mprintf (ev, "[geo] https://maps.google.com/?q=%.6lf,%.6lf", M->geo.longitude, M->geo.latitude);
return; return;
case tgl_message_media_contact: case tgl_message_media_contact:
mprintf (ev, "[contact] "); mprintf (ev, "[contact] ");

View File

@ -994,13 +994,13 @@ void tgl_do_send_encr_msg_action (struct tgl_message *M, void (*callback)(void *
out_int (CODE_decrypted_message_service_l16); out_int (CODE_decrypted_message_service_l16);
} else { } else {
out_int (CODE_decrypted_message_service); out_int (CODE_decrypted_message_service);
}
out_long (M->id);
out_random (15 + 4 * (lrand48 () % 3));
if (P->encr_chat.layer >= 17) {
out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id)); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id));
out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id)); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id));
} }
out_long (M->id);
static int buf[4];
tglt_secure_random (buf, 16);
out_cstring ((void *)buf, 16);
switch (M->action.type) { switch (M->action.type) {
case tgl_message_action_notify_layer: case tgl_message_action_notify_layer:
@ -1044,14 +1044,14 @@ void tgl_do_send_encr_msg (struct tgl_message *M, void (*callback)(void *callbac
out_int (CODE_decrypted_message_l16); out_int (CODE_decrypted_message_l16);
} else { } else {
out_int (CODE_decrypted_message); out_int (CODE_decrypted_message);
}
out_long (M->id);
out_random (15 + 4 * (lrand48 () % 3));
if (P->encr_chat.layer >= 17) {
out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id)); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id));
out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id)); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id));
out_int (0); out_int (0);
} }
out_long (M->id);
static int buf[4];
tglt_secure_random (buf, 16);
out_cstring ((void *)buf, 16);
out_cstring ((void *)M->message, M->message_len); out_cstring ((void *)M->message, M->message_len);
out_int (CODE_decrypted_message_media_empty); out_int (CODE_decrypted_message_media_empty);
encr_finish (&P->encr_chat); encr_finish (&P->encr_chat);
@ -1789,12 +1789,14 @@ static void send_part (struct send_file *f, void *callback, void *callback_extra
out_int (CODE_decrypted_message_l16); out_int (CODE_decrypted_message_l16);
} else { } else {
out_int (CODE_decrypted_message); out_int (CODE_decrypted_message);
}
out_long (r);
out_random (15 + 4 * (lrand48 () % 3));
if (P->encr_chat.layer >= 17) {
out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id)); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id));
out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id) + 2); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id) + 2);
out_int (0); out_int (0);
} }
out_long (r);
out_random (15 + 4 * (lrand48 () % 3));
out_string (""); out_string ("");
int *save_ptr = packet_ptr; int *save_ptr = packet_ptr;
if (f->media_type == CODE_input_media_uploaded_photo) { if (f->media_type == CODE_input_media_uploaded_photo) {
@ -2166,12 +2168,14 @@ void tgl_do_send_location(tgl_peer_id_t id, double latitude, double longitude, v
out_int (CODE_decrypted_message_l16); out_int (CODE_decrypted_message_l16);
} else { } else {
out_int (CODE_decrypted_message); out_int (CODE_decrypted_message);
}
out_long (r);
out_random (15 + 4 * (lrand48 () % 3));
if (P->encr_chat.layer >= 17) {
out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id)); out_int (2 * P->encr_chat.in_seq_no + (P->encr_chat.admin_id != tgl_state.our_id));
out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id) + 2); out_int (2 * P->encr_chat.out_seq_no + (P->encr_chat.admin_id == tgl_state.our_id) + 2);
out_int (0); out_int (0);
} }
out_long (r);
out_random (15 + 4 * (lrand48 () % 3));
out_string (""); out_string ("");
int *save_ptr = packet_ptr; int *save_ptr = packet_ptr;
out_int (CODE_decrypted_message_media_geo_point); out_int (CODE_decrypted_message_media_geo_point);

View File

@ -1229,6 +1229,9 @@ void tglf_fetch_encrypted_message (struct tgl_message *M) {
} }
assert (x == CODE_decrypted_message || x == CODE_decrypted_message_service || x == CODE_decrypted_message_l16 || x == CODE_decrypted_message_service_l16); assert (x == CODE_decrypted_message || x == CODE_decrypted_message_service || x == CODE_decrypted_message_l16 || x == CODE_decrypted_message_service_l16);
//assert (id == fetch_long ()); //assert (id == fetch_long ());
fetch_long ();
ll = prefetch_strlen ();
fetch_str (ll); // random_bytes
if (x == CODE_decrypted_message || x == CODE_decrypted_message_service) { if (x == CODE_decrypted_message || x == CODE_decrypted_message_service) {
int out_seq_no = fetch_int (); int out_seq_no = fetch_int ();
int in_seq_no = fetch_int (); int in_seq_no = fetch_int ();
@ -1247,9 +1250,6 @@ void tglf_fetch_encrypted_message (struct tgl_message *M) {
} else { } else {
P->encr_chat.in_seq_no ++; P->encr_chat.in_seq_no ++;
} }
fetch_long ();
ll = prefetch_strlen ();
fetch_str (ll); // random_bytes
if (x == CODE_decrypted_message || x == CODE_decrypted_message_l16) { if (x == CODE_decrypted_message || x == CODE_decrypted_message_l16) {
l = prefetch_strlen (); l = prefetch_strlen ();
s = fetch_str (l); s = fetch_str (l);