Commit Graph

1523 Commits

Author SHA1 Message Date
Lonami Exo
3648f7c756 Log outgoing message types and incoming message IDs 2018-06-18 17:14:04 +02:00
Lonami Exo
51d8ea0fa8 Shield disconnected Future in the MTProtoSender instead 2018-06-18 15:55:24 +02:00
Lonami Exo
efc48ee3b0 Shield self.disconnected and log RpcCallFail 2018-06-18 14:28:30 +02:00
Lonami Exo
ee7a44d447 Return an empty list from get_entities_text if no entities 2018-06-18 13:54:09 +02:00
Lonami Exo
3c1d7d2da2 Fix MessageEmpty when searching for messages 2018-06-18 13:48:50 +02:00
Lonami Exo
7641ba2d32 Fix sleep on the wrong indent and handle CancelledError
This was causing a huge slow-down every time a request was
received delaying all the subsequent incoming messages too
2018-06-18 13:29:12 +02:00
Lonami Exo
374f5e2aab Periodically send ping/getState 2018-06-18 13:22:25 +02:00
Lonami Exo
94d6c339c4 Add more logging in the MTProtoSender 2018-06-18 11:29:54 +02:00
Lonami Exo
e36aff51dd Raise ConnectionError when sending without connection
Otherwise the program could potentially block on await client(...)
since this has no timeout (unless asyncio.wait_for() was used) and
would give no further hint that the program was halted there.
2018-06-17 20:25:22 +02:00
Dan Elkouby
d5b349e031 Implement a mechanism to notify of connection failures (#852) 2018-06-17 19:29:41 +02:00
Lonami Exo
d9d586171f Fix MTProtoSender should not send content-related queries 2018-06-17 16:23:22 +02:00
Lonami Exo
145d4b7105 Remove socket fd from the loop reader upon closing 2018-06-17 15:48:26 +02:00
Lonami Exo
aaa7ec757b Support start() retrying on PasswordHashInvalidError 2018-06-17 14:07:45 +02:00
Lonami Exo
4d1272f1d2 Fix __ is invalid in usernames (cc @Kyle2142) 2018-06-17 12:08:55 +02:00
Lonami Exo
b65cbd8647 Validate to_id when iterating over messages by ID 2018-06-17 11:57:11 +02:00
Lonami Exo
226c35ff8f Pump up default timeout from 5 to 10s 2018-06-17 11:46:56 +02:00
Lonami Exo
d18ee9ecc5 Handle (re)connection errors more gracefully 2018-06-17 11:41:35 +02:00
Lonami Exo
9c63def14c Fix docs' typos 2018-06-16 21:51:13 +02:00
Lonami Exo
8086772506 Make sure not to include sentinel in containers 2018-06-16 18:40:08 +02:00
Lonami Exo
bb2cacd525 Fix automatic reconnection by unblocking the send queue 2018-06-16 18:34:36 +02:00
Lonami Exo
56ddaaee6f Make non-fwded messages sent to yourself outgoing 2018-06-16 17:35:24 +02:00
Lonami Exo
7cfecfaf21 Support pathlib.Path on download/upload 2018-06-16 17:01:20 +02:00
Lonami Exo
cbd5594dba Use the correct clock time when sleeping on iter_messages 2018-06-15 17:09:16 +02:00
Lonami Exo
509fba8bcc Fix-up isinstance/is_user_authorized from 06cdf1f 2018-06-15 13:01:16 +02:00
Lonami Exo
b7286be3b0 Get the "correct" chat in private incoming messages 2018-06-15 12:46:41 +02:00
Lonami Exo
31c94ec184 Add a lock for resolving events 2018-06-15 10:11:43 +02:00
Dan Elkouby
df15ee421c Except connection timeouts in MTProtoSender 2018-06-15 10:58:29 +03:00
Lonami Exo
24d2074e0c Set _input_chat on custom.Message creation/fixup input_chat 2018-06-14 23:40:44 +02:00
Lonami Exo
091b03c635 Use create_task instead ensure_future 2018-06-14 23:33:56 +02:00
Lonami Exo
f95400ea7e Try again to get input_chat on EventsCommon 2018-06-14 23:26:04 +02:00
Lonami Exo
06cdf1fdb0 Raise on phone/network migrate if authorized 2018-06-14 23:16:00 +02:00
Lonami Exo
c788e17c22 Fix _handle_update not expanding Updates 2018-06-14 22:51:57 +02:00
Lonami Exo
179af9894f Add missing parenthesis around await 2018-06-14 22:25:03 +02:00
Lonami Exo
0f14f3b16a Support custom event loops 2018-06-14 19:35:12 +02:00
Lonami Exo
908dfa148b Revisit codebase to add missing async/await 2018-06-14 17:09:20 +02:00
Lonami Exo
1247d050ab Remove unused fields from the Sessions
Most of the stuff didn't actually need to be saved and only
belong to the MTProtoState which is not a separate class from
the sessions.
2018-06-14 17:04:15 +02:00
Lonami
bb3a564500
Merge pull request #843 from LonamiWebs/core-rewrite
Core rewrite
2018-06-14 16:25:28 +02:00
Lonami Exo
5bb2f50232 Handle Msg state/resend/all (from 7c0af2c by @andr-04) 2018-06-14 16:23:16 +02:00
Lonami Exo
4a9eb5b085 Handle OSError on MTProtoSender 2018-06-14 16:16:11 +02:00
Lonami Exo
df1dfdf8ea Remove some redundant except 2018-06-14 16:13:46 +02:00
Lonami Exo
c9ea1bafc0 Apply @andr-04 asyncio commits to TcpClient 2018-06-14 16:08:23 +02:00
Lonami Exo
3ce8b17193 Dispatch updates to event handlers 2018-06-13 16:20:15 +02:00
Lonami Exo
898ce34c65 Set __all__ on telethon.__init__.py 2018-06-13 11:50:36 +02:00
Lonami Exo
a91109c9fa Retry send_code_request on AuthRestartError 2018-06-13 10:55:37 +02:00
Lonami Exo
f3f0c28505 Support converting .tl -> .json 2018-06-13 10:48:35 +02:00
Lonami Exo
8a787e90c2 Remove send/recv locks
There is only one method sending and one method receiving,
so it doesn't make sense to lock-protect those operations.
2018-06-13 10:04:27 +02:00
Lonami Exo
3324090c96 Fix non-asyncio sleep 2018-06-13 09:59:30 +02:00
Lonami Exo
3f16c92eb3 Subclass TLRequest for content-related objects 2018-06-12 20:14:21 +02:00
Lonami Exo
d1afc70963 Fix setting Pong results 2018-06-12 19:46:37 +02:00
Lonami Exo
d4dc147459 Handle DraftMessageEmpty (closes #844) 2018-06-12 19:25:13 +02:00