Handle get_difference case for secret chats

This commit is contained in:
Lonami Exo 2022-05-20 20:44:36 +02:00
parent af56429e78
commit d5bfb71e10

View File

@ -494,7 +494,7 @@ class MessageBox:
# Return the request that needs to be made to get the difference, if any. # Return the request that needs to be made to get the difference, if any.
def get_difference(self): def get_difference(self):
entry = ENTRY_ACCOUNT for entry in (ENTRY_ACCOUNT, ENTRY_SECRET):
if entry in self.getting_diff_for: if entry in self.getting_diff_for:
if entry in self.map: if entry in self.map:
return fn.updates.GetDifferenceRequest( return fn.updates.GetDifferenceRequest(
@ -519,9 +519,11 @@ class MessageBox:
self.date = diff.date self.date = diff.date
self.seq = diff.seq self.seq = diff.seq
self.end_get_diff(ENTRY_ACCOUNT) self.end_get_diff(ENTRY_ACCOUNT)
self.end_get_diff(ENTRY_SECRET)
return [], [], [] return [], [], []
elif isinstance(diff, tl.updates.Difference): elif isinstance(diff, tl.updates.Difference):
self.end_get_diff(ENTRY_ACCOUNT) self.end_get_diff(ENTRY_ACCOUNT)
self.end_get_diff(ENTRY_SECRET)
chat_hashes.extend(diff.users, diff.chats) chat_hashes.extend(diff.users, diff.chats)
return self.apply_difference_type(diff) return self.apply_difference_type(diff)
elif isinstance(diff, tl.updates.DifferenceSlice): elif isinstance(diff, tl.updates.DifferenceSlice):
@ -531,6 +533,7 @@ class MessageBox:
# TODO when are deadlines reset if we update the map?? # TODO when are deadlines reset if we update the map??
self.map[ENTRY_ACCOUNT].pts = diff.pts self.map[ENTRY_ACCOUNT].pts = diff.pts
self.end_get_diff(ENTRY_ACCOUNT) self.end_get_diff(ENTRY_ACCOUNT)
self.end_get_diff(ENTRY_SECRET)
return [], [], [] return [], [], []
def apply_difference_type( def apply_difference_type(