Added partial support for action resend. Fix crush on incorrect encrypted message in lua mode
This commit is contained in:
parent
31bd174917
commit
862ae34ba8
@ -24,6 +24,7 @@ decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = Decr
|
|||||||
decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
|
decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction;
|
||||||
decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
|
decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction;
|
||||||
|
|
||||||
|
decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction;
|
||||||
|
|
||||||
decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction;
|
decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction;
|
||||||
|
|
||||||
|
@ -2612,6 +2612,9 @@ void print_service_message (struct in_ev *ev, struct tgl_message *M) {
|
|||||||
case tgl_message_action_flush_history:
|
case tgl_message_action_flush_history:
|
||||||
mprintf (ev, " cleared history\n");
|
mprintf (ev, " cleared history\n");
|
||||||
break;
|
break;
|
||||||
|
case tgl_message_action_resend:
|
||||||
|
mprintf (ev, " resend query\n");
|
||||||
|
break;
|
||||||
case tgl_message_action_notify_layer:
|
case tgl_message_action_notify_layer:
|
||||||
mprintf (ev, " updated layer to %d\n", M->action.layer);
|
mprintf (ev, " updated layer to %d\n", M->action.layer);
|
||||||
break;
|
break;
|
||||||
|
1
lua-tg.c
1
lua-tg.c
@ -295,6 +295,7 @@ void push_message (struct tgl_message *M) {
|
|||||||
static char s[30];
|
static char s[30];
|
||||||
snprintf (s, 30, "%lld", M->id);
|
snprintf (s, 30, "%lld", M->id);
|
||||||
lua_add_string_field ("id", s);
|
lua_add_string_field ("id", s);
|
||||||
|
if (!(M->flags & FLAG_CREATED)) { return; }
|
||||||
lua_add_num_field ("flags", M->flags);
|
lua_add_num_field ("flags", M->flags);
|
||||||
|
|
||||||
if (tgl_get_peer_type (M->fwd_from_id)) {
|
if (tgl_get_peer_type (M->fwd_from_id)) {
|
||||||
|
12
structures.c
12
structures.c
@ -1010,6 +1010,11 @@ void tglf_fetch_message_action_encrypted (struct tgl_state *TLS, struct tgl_mess
|
|||||||
M->type = tgl_message_action_typing;
|
M->type = tgl_message_action_typing;
|
||||||
M->typing = tglf_fetch_typing ();
|
M->typing = tglf_fetch_typing ();
|
||||||
break;
|
break;
|
||||||
|
case CODE_decrypted_message_action_resend:
|
||||||
|
M->type = tgl_message_action_resend;
|
||||||
|
M->start_seq_no = fetch_int ();
|
||||||
|
M->end_seq_no = fetch_int ();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
vlogprintf (E_ERROR, "x = 0x%08x\n", x);
|
vlogprintf (E_ERROR, "x = 0x%08x\n", x);
|
||||||
assert (0);
|
assert (0);
|
||||||
@ -1250,10 +1255,11 @@ void tglf_fetch_encrypted_message (struct tgl_state *TLS, struct tgl_message *M)
|
|||||||
vlogprintf (E_DEBUG - 2, "layer = %d, in = %d, out = %d\n", layer, in_seq_no, out_seq_no);
|
vlogprintf (E_DEBUG - 2, "layer = %d, in = %d, out = %d\n", layer, in_seq_no, out_seq_no);
|
||||||
}
|
}
|
||||||
if (!(x == CODE_decrypted_message || x == CODE_decrypted_message_service || x == CODE_decrypted_message_l16 || x == CODE_decrypted_message_service_l16)) {
|
if (!(x == CODE_decrypted_message || x == CODE_decrypted_message_service || x == CODE_decrypted_message_l16 || x == CODE_decrypted_message_service_l16)) {
|
||||||
vlogprintf (E_ERROR, "x = 0x%08x\n", x);
|
vlogprintf (E_ERROR, "Incorrect message: x = 0x%08x\n", x);
|
||||||
assert (x == CODE_decrypted_message || x == CODE_decrypted_message_service || x == CODE_decrypted_message_l16 || x == CODE_decrypted_message_service_l16);
|
drop = 1;
|
||||||
}
|
}
|
||||||
//assert (id == fetch_long ());
|
//assert (id == fetch_long ());
|
||||||
|
if (!drop) {
|
||||||
long long new_id = fetch_long ();
|
long long new_id = fetch_long ();
|
||||||
if (P && P->encr_chat.layer >= 17) {
|
if (P && P->encr_chat.layer >= 17) {
|
||||||
assert (new_id == id);
|
assert (new_id == id);
|
||||||
@ -1280,6 +1286,7 @@ void tglf_fetch_encrypted_message (struct tgl_state *TLS, struct tgl_message *M)
|
|||||||
}
|
}
|
||||||
end = in_ptr;
|
end = in_ptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
in_ptr = save_in_ptr;
|
in_ptr = save_in_ptr;
|
||||||
in_end = save_in_end;
|
in_end = save_in_end;
|
||||||
}
|
}
|
||||||
@ -1661,6 +1668,7 @@ void tgls_free_message_action (struct tgl_state *TLS, struct tgl_message_action
|
|||||||
case tgl_message_action_delete_messages:
|
case tgl_message_action_delete_messages:
|
||||||
case tgl_message_action_screenshot_messages:
|
case tgl_message_action_screenshot_messages:
|
||||||
case tgl_message_action_flush_history:
|
case tgl_message_action_flush_history:
|
||||||
|
case tgl_message_action_resend:
|
||||||
case tgl_message_action_notify_layer:
|
case tgl_message_action_notify_layer:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@ enum tgl_message_action_type {
|
|||||||
tgl_message_action_delete_messages,
|
tgl_message_action_delete_messages,
|
||||||
tgl_message_action_screenshot_messages,
|
tgl_message_action_screenshot_messages,
|
||||||
tgl_message_action_flush_history,
|
tgl_message_action_flush_history,
|
||||||
|
tgl_message_action_resend,
|
||||||
tgl_message_action_notify_layer,
|
tgl_message_action_notify_layer,
|
||||||
tgl_message_action_typing
|
tgl_message_action_typing
|
||||||
};
|
};
|
||||||
@ -386,6 +387,10 @@ struct tgl_message_action {
|
|||||||
int delete_cnt;
|
int delete_cnt;
|
||||||
int screenshot_cnt;
|
int screenshot_cnt;
|
||||||
enum tgl_typing_status typing;
|
enum tgl_typing_status typing;
|
||||||
|
struct {
|
||||||
|
int start_seq_no;
|
||||||
|
int end_seq_no;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user