Commit Graph

500 Commits

Author SHA1 Message Date
Lonami Exo
6759beac21 Add __str__ methods to TLMessage and MessageContainer 2017-10-21 20:23:53 +02:00
Lonami Exo
d7f917ebfc Update docstrings 2017-10-21 16:59:20 +02:00
Lonami Exo
7596f2b797 Fix and enhance "no workers set" warning 2017-10-21 13:48:57 +02:00
Lonami Exo
5cdf92e509 Update to v0.15.3 2017-10-20 23:33:08 +02:00
Lonami Exo
d70811b693 Fix infinite loop when invoking on update handlers (fix #336)
Every update that hadn't been acknowledged on the main connection
yet would be resent on any new connection. These new connections
are made temporary when invoking anything from any thread that's
not the main thread. It would also process all the updates, hence,
Telegram would be resending these not-acknowledged updates to the
temporary connection, and the updates would be processed again,
then the update handler would react to the duplicated updates over
and over.

To fix this, simply don't process updates on the temporary thread
at all. With this reasoning, if we don't acknowledge updates on
the temporary connections, Telegram will resend them on the main
connection, so we should not lose any.
2017-10-20 23:30:02 +02:00
Lonami Exo
2782a08ed0 Add note for future self when handling gzip packed data 2017-10-20 22:44:00 +02:00
Lonami Exo
1a91c024fc Revert 63dfb1e as many updates were being dropped 2017-10-20 22:12:03 +02:00
Lonami Exo
033119e9b8 Make MtProtoSender._need_confirmation a set
This will avoid adding duplicated items to it
2017-10-20 22:07:45 +02:00
Lonami Exo
38ccd6d1d9 Generate errors from PWRTelegram's API 2017-10-20 17:20:05 +02:00
Andrey Egorov
f37b9ed20e Fix new salt not being saved to session file (#362) 2017-10-20 16:48:54 +02:00
Andrey Egorov
050cd95d32 Remove unnecessary .disconnect() from ._invoke() (#356) 2017-10-19 10:51:34 +02:00
Andrey Egorov
e349910eb9 Fix attribute access order being swapped (#353) 2017-10-18 15:34:04 +02:00
Andrey Egorov
16cf94c9ad Fix ._clear_all_pending failing due to a wrong call (#352) 2017-10-18 14:47:03 +02:00
Lonami Exo
87dc476dae Fix ReadThread not starting on reconnect if already authorized 2017-10-18 14:45:08 +02:00
Lonami Exo
5a1074dc7c Avoid calling .sync_updates when not needed 2017-10-18 12:17:13 +02:00
Lonami Exo
adb79b21cf Replace .to_bytes() with the special .__bytes__ function 2017-10-17 19:54:59 +02:00
Lonami Exo
63dfb1e3ea Fix processing messages pending of acknowledge many times 2017-10-17 10:15:13 +02:00
Andrey Egorov
ed77ba6f8f Likely fix .log_out crashing "calling Event" (#349) 2017-10-17 00:39:04 +02:00
Lonami Exo
27728be242 Revert "Attempt at not calling .connect for every file chunk"
This reverts commit 280a700655.
The reason for this is that it was causing a lot of files to
be downloaded corrupted for some reason. This should be
revisited to avoid creating a new connection for every chunk.
2017-10-15 11:05:56 +02:00
Lonami Exo
d92e8e11ad Update to v0.15.2 2017-10-14 12:05:28 +02:00
Lonami Exo
280a700655 Attempt at not calling .connect for every file chunk 2017-10-14 12:03:01 +02:00
Nikolay
9907d763a8 Use peer as key instead top_message on .get_dialogs (fix #329) 2017-10-14 11:50:48 +02:00
Lonami Exo
f4b8772a85 Temporary fix for abusive duplicated updates (closes #336) 2017-10-14 11:37:47 +02:00
Lonami Exo
4fd9d361f0 Replace redundant isinstance calls with a tuple parameter 2017-10-13 11:39:34 +02:00
88ee55
db63b5e39a Fix .send_message not expecting UpdateNewChannelMessage (#331) 2017-10-13 10:53:36 +02:00
Lonami Exo
9cf5506ee4 Don't .disconnect() on FloodWaitError
Since other requests can still be invoked, it makes no
sense to call .disconnect().
2017-10-13 09:59:37 +02:00
Lonami Exo
bec5f9fb89 Add stub methods for more server responses 2017-10-12 21:09:09 +02:00
Lonami Exo
f2338e49ae Allow using a callable key on EntityDatabase 2017-10-12 19:54:23 +02:00
Lonami Exo
16a0cecf46 Fix EntityDatabase.__delitem__ 2017-10-12 19:47:13 +02:00
Lonami Exo
6242cc8159 Fix .tgread_object not seeking back on TypeNotFoundError 2017-10-12 18:52:04 +02:00
Lonami Exo
59c61cab2f Replace int.from_bytes with struct.unpack for consistency 2017-10-12 18:41:58 +02:00
Lonami Exo
bff2e6981e Fix ._pop_request_of_type failing on not-found requests 2017-10-12 18:03:10 +02:00
Lonami Exo
7bb7cb039f Fix handle RpcResult not always returning a bool 2017-10-12 17:58:37 +02:00
Lonami Exo
0c1170ee61 Replace hardcoded reads with TLObject's .read() 2017-10-12 16:40:59 +02:00
Lonami Exo
3a4662c3bf Remove forgotten print call from authenticator.py 2017-10-12 16:07:25 +02:00
Lonami Exo
301da16f29 Fix pong response not reading all data from the buffer 2017-10-11 21:09:09 +02:00
Lonami Exo
da51e71def Fix .get_input_entity returning marked IDs (closes #314) 2017-10-09 19:40:39 +02:00
Lonami Exo
db623e37fd Except ConnectionResetError on ._reconnect (fix #309) 2017-10-09 13:23:39 +02:00
Lonami Exo
e2ac18b7bc Use larger chunks when downloading/uploading files 2017-10-09 13:19:03 +02:00
Lonami Exo
a7622324dd Remove unnecessary offset_index variable on .download_file 2017-10-09 12:00:14 +02:00
Lonami Exo
6f1c05633e Join all threads when calling .disconnect() (fix #252) 2017-10-09 11:47:10 +02:00
Lonami Exo
f984aae391 Except ProxyConnectionError on ReadThread (fix #307) 2017-10-09 11:37:08 +02:00
Lonami Exo
2a1a4508b8 Allow overriding DocumentAttributes on .send_file (fix #294) 2017-10-09 11:20:31 +02:00
Lonami Exo
4673a02ce6 Stop calling .process_entities where not needed 2017-10-09 11:20:31 +02:00
Lonami Exo
401de913af Fix EntityDatabase failing with InputPeer keys 2017-10-09 11:20:31 +02:00
Joscha Götzer
4a482b3506 .get_drafts() and a custom Draft class (#310) 2017-10-09 09:54:48 +02:00
Lonami Exo
1f54cbfb5a Make str(TLObject) return valid code to generate it back 2017-10-08 17:51:29 +02:00
Lonami Exo
48c8837f19 Don't look on all dialogs on .get_entity miss 2017-10-08 16:25:50 +02:00
Lonami Exo
15e90dcb69 Allow specifying a threshold to handle flood waits 2017-10-08 16:15:30 +02:00
Lonami Exo
83677fc927 Enhance and use .get_input_photo on the generated code 2017-10-08 13:45:14 +02:00