mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-24 16:24:15 +03:00
Remove TODOs
This commit is contained in:
parent
b31f4fe063
commit
236c2f7e7c
|
@ -81,7 +81,7 @@ async def resolve_to_packed(self: Client, chat: ChatLike) -> PackedChat:
|
|||
return PackedChat(
|
||||
ty=PackedType.BOT if self._session.user.bot else PackedType.USER,
|
||||
id=self._chat_hashes.self_id,
|
||||
access_hash=0, # TODO get hash
|
||||
access_hash=0,
|
||||
)
|
||||
elif isinstance(chat, types.InputPeerChat):
|
||||
return PackedChat(
|
||||
|
|
|
@ -73,7 +73,9 @@ def decrypt_data_v2(ciphertext: bytes, auth_key: AuthKey) -> bytes:
|
|||
if len(ciphertext) < 24 or (len(ciphertext) - 24) % 16 != 0:
|
||||
raise ValueError("invalid ciphertext buffer length")
|
||||
|
||||
# TODO Check salt, session_id and sequence_number
|
||||
# salt, session_id and sequence_number should also be checked.
|
||||
# However, not doing so has worked fine for years.
|
||||
|
||||
key_id = ciphertext[:8]
|
||||
if auth_key.key_id != key_id:
|
||||
raise ValueError("server authkey mismatches with ours")
|
||||
|
|
|
@ -207,7 +207,7 @@ def _do_step3(
|
|||
ClientDhInnerData(
|
||||
nonce=nonce,
|
||||
server_nonce=server_nonce,
|
||||
retry_id=0, # TODO use an actual retry_id
|
||||
retry_id=0,
|
||||
g_b=g_b.to_bytes((g_b.bit_length() + 7) // 8),
|
||||
)
|
||||
)
|
||||
|
|
|
@ -188,7 +188,6 @@ class Encrypted(Mtp):
|
|||
|
||||
# https://core.telegram.org/mtproto/service_messages
|
||||
# https://core.telegram.org/mtproto/service_messages_about_messages
|
||||
# TODO verify what needs ack and what doesn't
|
||||
constructor_id = struct.unpack_from("<I", message.body)[0]
|
||||
self._handlers.get(constructor_id, self._handle_update)(message)
|
||||
|
||||
|
@ -227,7 +226,6 @@ class Encrypted(Mtp):
|
|||
self._updates.append(body)
|
||||
|
||||
def _handle_ack(self, message: Message) -> None:
|
||||
# TODO notify about this somehow
|
||||
MsgsAck.from_bytes(message.body)
|
||||
|
||||
def _handle_bad_notification(self, message: Message) -> None:
|
||||
|
@ -265,19 +263,15 @@ class Encrypted(Mtp):
|
|||
self._sequence -= 16
|
||||
|
||||
def _handle_state_req(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
MsgsStateReq.from_bytes(message.body)
|
||||
|
||||
def _handle_state_info(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
MsgsStateInfo.from_bytes(message.body)
|
||||
|
||||
def _handle_msg_all(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
MsgsAllInfo.from_bytes(message.body)
|
||||
|
||||
def _handle_detailed_info(self, message: Message) -> None:
|
||||
# TODO properly implement
|
||||
msg_detailed = AbcMsgDetailedInfo.from_bytes(message.body)
|
||||
if isinstance(msg_detailed, MsgDetailedInfo):
|
||||
self._pending_ack.append(msg_detailed.answer_msg_id)
|
||||
|
@ -287,11 +281,9 @@ class Encrypted(Mtp):
|
|||
assert False
|
||||
|
||||
def _handle_msg_resend(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
MsgResendReq.from_bytes(message.body)
|
||||
|
||||
def _handle_future_salts(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
salts = FutureSalts.from_bytes(message.body)
|
||||
self._rpc_results.append((MsgId(salts.req_msg_id), message.body))
|
||||
|
||||
|
@ -308,11 +300,9 @@ class Encrypted(Mtp):
|
|||
self._rpc_results.append((MsgId(pong.msg_id), message.body))
|
||||
|
||||
def _handle_destroy_session(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
DestroySessionRes.from_bytes(message.body)
|
||||
|
||||
def _handle_new_session_created(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
new_session = NewSessionCreated.from_bytes(message.body)
|
||||
self._salts.clear()
|
||||
self._salts.append(
|
||||
|
@ -339,11 +329,9 @@ class Encrypted(Mtp):
|
|||
)
|
||||
|
||||
def _handle_http_wait(self, message: Message) -> None:
|
||||
# TODO implement
|
||||
HttpWait.from_bytes(message.body)
|
||||
|
||||
def _handle_update(self, message: Message) -> None:
|
||||
# TODO if this `Updates` cannot be deserialized, `getDifference` should be used
|
||||
self._updates.append(message.body)
|
||||
|
||||
def push(self, request: bytes) -> Optional[MsgId]:
|
||||
|
|
|
@ -195,15 +195,6 @@ class ChatHashCache:
|
|||
elif isinstance(peer, abcs.NotifyPeer):
|
||||
success &= self._has_notify_peer(peer)
|
||||
|
||||
# TODO cover?:
|
||||
# ChatParticipants.participants
|
||||
# PinnedDialogs.order
|
||||
# FolderPeers.folder_peers
|
||||
# PeerLocated.peers
|
||||
# GroupCallParticipants.participants
|
||||
# ChatParticipant and ChannelParticipant .prev_participant, new_participant, invite
|
||||
# BotChatInviteRequester.invite
|
||||
|
||||
return success
|
||||
elif isinstance(updates, types.UpdatesCombined):
|
||||
return self.extend(updates.users, updates.chats)
|
||||
|
|
|
@ -360,7 +360,6 @@ class MessageBox:
|
|||
)
|
||||
return pts.entry, None
|
||||
elif local_pts + pts.pts_count < pts.pts:
|
||||
# TODO store chats too?
|
||||
if __debug__:
|
||||
self._trace(
|
||||
"Possible gap since local pts %r < %r: %s",
|
||||
|
|
Loading…
Reference in New Issue
Block a user