Commit Graph

516 Commits

Author SHA1 Message Date
Lonami Exo
2609bd9bd1 Use constants and allow empty URL regex when parsing markdown 2017-10-29 18:21:21 +01:00
Lonami Exo
d47a9f83d0 Fix some special cases which are not treated as emojis (offset 1) 2017-10-29 17:07:37 +01:00
Lonami Exo
bcaa8007a3 Fix inline URL matching swallowing all parse entities 2017-10-29 16:43:30 +01:00
Lonami Exo
f5fafc6a27 Enhance emoji detection 2017-10-29 16:41:30 +01:00
Lonami Exo
368269cb11 Add ability to parse inline URLs 2017-10-29 16:33:10 +01:00
Lonami Exo
9600a9ea0b Fix markdown parsing failing if delimiter was last character 2017-10-28 19:17:18 +02:00
Lonami Exo
5adec2e1ab Initial attempt at parsing Markdown-like syntax 2017-10-28 19:06:41 +02:00
Lonami Exo
e48f15be80 Fix-up af08d59 (missing parenthesis) 2017-10-28 11:11:51 +02:00
Tanuj
af08d59cb7 Fix bug with semicolons when downloading contacts (#319) 2017-10-28 11:09:46 +02:00
Lonami Exo
c6d30ffceb Fix exception when logging exceptions 2017-10-25 13:06:51 +02:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +02:00
Lonami Exo
ceb37cd4c5 Move auth_key generation and InitConnection logic to .invoke()
The reasoning behind this is that .connect() should not call
any request at all, it should only connect to the servers
although it currently still calls GetStateRequest.

There were some issues (#291, #360) where the auth_key was None
(possibly due to .connect() returning False), so this may
fix some of the cases where it returned False. This way we also
ensure that we always have an auth_key, or even if it "breaks"
(it's not the right key for the server anymore).

A few additional changes have been introduced to accommodate
this, such as moving InitConnection logic too or importing auths.
2017-10-24 15:40:51 +02:00
Lonami Exo
d58c729af0 Add missing InputPeerSelf case to .get_input_user 2017-10-24 09:43:59 +02:00
Lonami Exo
b04eed82eb Add new .idle() method to listen for updates from MainThread 2017-10-22 13:16:34 +02:00
Andrey Egorov
8057cea294 Fix resending requests on bad salt/msg notification (#369)
These responses from the server could indicate container IDs,
which weren't being saved. This fix also accounts for that case.
2017-10-22 13:13:49 +02:00
Lonami Exo
5de8350d85 Reorder another import for #357 2017-10-22 11:23:15 +02:00
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