Commit Graph

86 Commits

Author SHA1 Message Date
Lonami Exo
238198db5a Create a convenient class to wrap Dialog instances 2017-12-24 16:18:09 +01:00
Lonami Exo
23ab70fc29 Remove unused request_msg_id from the TLObject class 2017-12-20 17:48:41 +01:00
Lonami Exo
7d189119f4 Fix salt migration failing with valid signed salts 2017-12-20 12:47:39 +01:00
Lonami Exo
d4d7aa9063 Use signed salt 2017-12-03 21:10:22 +01:00
Dmitry D. Chernov
5a4d6d4a57 tlobject: Represent timestamp as 'int' instead of 'float' 2017-11-23 22:39:35 +10:00
Dmitry D. Chernov
f99d14558f binary_reader: Parse TL 'date' to UTC datetime instead of local 2017-11-23 02:06:43 +10:00
Vladislav Kolesnichenko
ee5915e86d Add support for connecting through IPv6 (#425 for #112) 2017-11-16 13:30:18 +01:00
Lonami Exo
81baced12b Support t.me/ links when resolving usernames/joinchat links
Closes #419
2017-11-10 13:27:51 +01:00
Lonami Exo
cad1e883a6 Don't save full entities unless they have access_hash 2017-11-10 09:32:40 +01:00
Lonami Exo
f65322af18 Fix entity database not using the phone on {phone: id}
Closes #412
2017-11-07 10:15:55 +01:00
Lonami Exo
05f7f076d5 Fix InputPeer* with None hash, drop them off database (closes #354) 2017-10-30 10:33:45 +01:00
Lonami Exo
05626c8274 Implement missing .to_dict() and .stringify() on message/container 2017-10-29 20:13:36 +01:00
Lonami Exo
3db13ccdd2 Add a more descriptive error when serializing bytes 2017-10-25 12:43:57 +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
adb79b21cf Replace .to_bytes() with the special .__bytes__ function 2017-10-17 19:54:59 +02:00
Lonami Exo
4fd9d361f0 Replace redundant isinstance calls with a tuple parameter 2017-10-13 11:39:34 +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
0c1170ee61 Replace hardcoded reads with TLObject's .read() 2017-10-12 16:40:59 +02:00
Lonami Exo
da51e71def Fix .get_input_entity returning marked IDs (closes #314) 2017-10-09 19:40:39 +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
15e90dcb69 Allow specifying a threshold to handle flood waits 2017-10-08 16:15:30 +02:00
Lonami Exo
91a5d20e93 Replace .on_response with static .from_reader for all types 2017-10-07 13:26:09 +02:00
Lonami Exo
79e36c98bd Fix EntityDatabase.get_input_peer not actually working 2017-10-06 21:42:04 +02:00
Lonami Exo
dde196d8e4 Swallow errors when processing entities
Some bug was causing an infinite lock due to the entity
database failing with InputPeerSelf, since adding a full
entity to the database wasn't disallowing self, and so
wasn't utils get_peer_id. Although last commit fixed that,
just in case, swallow errors there.
2017-10-05 13:34:44 +02:00
Lonami Exo
1fb3d0d00c Fix EntityDatabase failing to cache self user 2017-10-05 13:34:11 +02:00
Lonami Exo
4f2a44231a Allow disabling the EntityDatabase fully or partially 2017-10-05 13:06:51 +02:00
Lonami Exo
99cc0778bb Allow EntityDatabase to be accessed by phone 2017-10-05 13:01:00 +02:00
Lonami Exo
10eca82143 Fix process_entities not working on list of entities 2017-10-05 12:29:52 +02:00
Lonami Exo
d2e244817a Make EntityDatabase.get a no-op if key is an entity already 2017-10-05 12:28:04 +02:00
Lonami Exo
e5c4df98df Use EntityDatabase on TelegramClient.get_entity instead lru_cache 2017-10-05 12:27:32 +02:00
Lonami Exo
a0fc5ed54e Use EntityDatabase in the Session class 2017-10-04 21:02:45 +02:00
Lonami Exo
36dabc4928 Process entities from the MtProtoSender instead TelegramBareClient
This way, update objects will also be processed when they occur.
2017-10-01 16:02:29 +02:00
Lonami Exo
9bccd17881 Add an option to allow not saving/processing found entities 2017-10-01 13:32:27 +02:00
Lonami Exo
e4c5396c04 Add cross-thread safety when saving the session 2017-10-01 13:27:08 +02:00
Lonami Exo
a737f33324 Save all found entities to the session file 2017-10-01 13:27:08 +02:00
Lonami Exo
6df38da793 Fix session failing to load if no auth_key present 2017-09-29 19:54:40 +02:00
Lonami Exo
afc4bd9cab Rename constructor/subclass_of_id to upper case, keep only static 2017-09-29 13:11:33 +02:00
Lonami Exo
cc337328c6 Rename handmade Message class to TLMessage to avoid confusion 2017-09-28 11:59:24 +02:00
Lonami Exo
fb0898b9cb Don't distinguish between str and bytes when serializing
This makes it easier to use some requests like ReqPqRequest which
needs a string of bytes, not a valid utf-8 string per se.
2017-09-28 09:55:29 +02:00
Lonami Exo
c667a00281 Avoid using BinaryWriter where possible 2017-09-27 21:23:59 +02:00
Lonami Exo
8a605f21e6 Remove BinaryWriter dependency on MessageContainer 2017-09-27 21:06:01 +02:00
Lonami Exo
bd3dd371a2 Create a proper Message class (msg_id, seqno, body; only .to_bytes()) 2017-09-27 21:01:20 +02:00
Lonami Exo
795cb98909 Move MessageContainer.on_send inside its .to_bytes 2017-09-27 13:49:58 +02:00
Lonami Exo
6df9fc558e Create and use a new GzipPacked class, also when sending 2017-09-27 13:46:53 +02:00
Lonami Exo
7b736aa6ef Fix MessageContainer having the wrong constructor id 2017-09-27 13:46:02 +02:00