@@ -33,6 +33,7 @@ use crate::message_box::defs::PossibleGap;
33
33
pub ( crate ) use defs:: Entry ;
34
34
pub use defs:: { Gap , MessageBox } ;
35
35
use defs:: { NO_DATE , NO_PTS , NO_SEQ , POSSIBLE_GAP_TIMEOUT , PtsInfo , State } ;
36
+ use grammers_tl_types:: enums:: Update ;
36
37
use grammers_tl_types as tl;
37
38
use log:: { debug, info, trace, warn} ;
38
39
use std:: cmp:: Ordering ;
@@ -485,6 +486,7 @@ impl MessageBox {
485
486
// which the deadlines should be reset, and determines whether any local pts was changed
486
487
// so that the seq can be updated too (which could otherwise have been done earlier).
487
488
let mut any_pts_applied = false ;
489
+ let mut force_update_seq = false ;
488
490
let mut reset_deadlines_for = mem:: take ( & mut self . tmp_entries ) ;
489
491
for update in updates {
490
492
let ( entry, update) = self . apply_pts_info ( update) ;
@@ -495,8 +497,16 @@ impl MessageBox {
495
497
reset_deadlines_for. insert ( entry) ;
496
498
}
497
499
if let Some ( update) = update {
500
+ // BotInlineSend updates are sent with `seq` != NO_SEQ. `seq` must be updated in
501
+ // that case, otherwise every other BotInlineSend update will be counted as a gap
502
+ // and dropped.
503
+ match update {
504
+ Update :: BotInlineSend ( _) => force_update_seq = true ,
505
+ _ => { } ,
506
+ }
498
507
result. push ( update) ;
499
508
any_pts_applied |= entry. is_some ( ) ;
509
+
500
510
}
501
511
}
502
512
self . reset_deadlines ( & reset_deadlines_for, next_updates_deadline ( ) ) ;
@@ -510,7 +520,7 @@ impl MessageBox {
510
520
// Updates which can be applied in any order, such as `UpdateChat`,
511
521
// should not cause `seq` to be updated (or upcoming updates such as
512
522
// `UpdateChatParticipant` could be missed).
513
- if any_pts_applied {
523
+ if any_pts_applied || force_update_seq {
514
524
if date != NO_DATE {
515
525
self . date = date;
516
526
}
0 commit comments