Commit Graph

3084 Commits

Author SHA1 Message Date
Lonami
7e78b1b6dc Added ability to upload and send media, and more fixes
Uploading and sending media are different things.
Once you have uploaded a media file, you can send
it to many users without uploading it again, since
you have a handle to the uploaded file.

Other fixes include not showing additional data
on error messages and not generating correct
code for sending bytes
2016-09-11 13:10:27 +02:00
Lonami
cdb1674a27 Minor improvement to updates handling
Now the updates thread won't start unless you add,
at least, one updates handler. Also, if the TcpClient
was receiving (i.e., from an update), it will let the
update to be received first instead of crashing
2016-09-11 11:50:38 +02:00
Lonami
c11795f294 Added native support for Python's datetime object
Now you can make up your Telegram Requests by using
the built-in `datetime` instead of manually parsing it
2016-09-11 10:35:02 +02:00
Lonami
5b4be5b85e Fixed bugs when handling updates
GZipPacked updates are now handled correctly.
Also, fixed another bug which did not allow
resending a request when BadServerSalt occured.
2016-09-10 20:06:37 +02:00
Lonami
0068c0fd8b Updated README.md 2016-09-10 14:10:47 +02:00
Lonami
72bc9df683 Made MtProtoSender multi-thread safe
This will allow you to, for example, send requests
when you get an update (if someone tells you something,
you can automatically reply something else). Beware,
this may lead to an infinite loop so add conditions!
2016-09-10 11:01:03 +02:00
Lonami
e47344c0f0 Added a thread lock to the TcpClient
This gives multi-threading safety without giving up on speed
(now there's no need for additional sleeps)
2016-09-10 10:17:15 +02:00
Lonami
fd14a5a49a Added an updates thread and construtor_id to TLObjects
A new thread is now created when MtProtoSender is created.
This thread constantly listens for Telegram updates (such as
incoming messages), so the updates can be received any time
rather than only when sending another request.
2016-09-09 11:47:37 +02:00
Lonami
e9e44795ec Attempt at removing cyclic dependencies 2016-09-08 16:55:46 +02:00
Lonami
b2425eeea9 Completely refactored unit tests, removed unused code 2016-09-08 16:11:37 +02:00
Lonami
a4f68dd29a Ability to retrieve message history, example improved
The example has been improved with more options (such as print
message history), and the TelegramClient now can retrieve the
message history from any given point in time or other offsets
2016-09-08 12:13:31 +02:00
Lonami
e6706080ad Improved TcpClient receive 2016-09-07 19:48:49 +02:00
Lonami
7abe53e063 Added full* markdown support and updated README
* Although the markdown parser works perfectly,
the official Telegram client does not fully reflect it.
However, if you still think that this is a lie, go check
the markdown parser and test it yourself!
2016-09-07 19:32:18 +02:00
Lonami
81e8ae5bea Added an interactive example, more doc, fixes and improvements
The interactive example allows you to list the top
dialogs and send messages to them until "!q" is entered

More documetation has been added
Fixes when representing TLObjects (lists did not represent well)
The `send_code_request` now allows to use multiple phone numbers at once
2016-09-07 11:36:34 +02:00
Lonami
e705dc48bb Handle any auto-generated code when processing updates 2016-09-06 19:39:25 +02:00
Lonami
6b8a347426 Several updates, fixes and additions (TcpClient, MtProto...)
README.md was updated to reflect more useful information
More errors from the official Telegrm website have been added
MtProtoSender now handles updates (and doesn't crash!)
Fixes on TcpClient to be able to receive whole large packets
Updated scheme.tl to the layer 55
Session is now saved more often (to prevent damages from crashes)
Fixes to the code generator (generated invalid code for reading "bytes")
2016-09-06 18:54:49 +02:00
Lonami
7802fe5487 Improved auto-generated source code readability 2016-09-05 19:12:14 +02:00
Lonami
251c1830a5 Added custom errors, fixes to code generator
The code generator now handles okay the flags using True type
Also, double checking for the flag is now avoided in cases where the
flag was a Vector type
2016-09-05 18:35:12 +02:00
Lonami
b027dd2c8f Fixed tiny bugs with authentication, added more unit tests 2016-09-04 21:07:09 +02:00
Lonami
7c8c65560e Refactored imports 2016-09-04 13:04:45 +02:00
Lonami
39a23559f0 First attempt at TelegramClient. Added fixes and doc 2016-09-04 11:07:18 +02:00
Lonami
c863537b7b Finished authenticator (now it works!) 2016-09-03 20:34:24 +02:00
Lonami
75892afb2e Reached Authenticator's step 3 2016-09-03 16:46:40 +02:00
Lonami
75a648f438 Several fixes to authenticator, added more unit tests
Some fixes include, in more detail:
- Using little over big endianess in some parts
- Flagging all the constructor numbers as unsigned
- Fixed bugs with factorizer
- Implemented TLSharp's RSA
2016-09-03 10:54:58 +02:00
Lonami
12cb66ab2c Reviewed authenticator.py 2016-08-30 17:40:49 +02:00
Lonami
e712a9bf61 Wrote unit tests and found and fixed bugs 2016-08-30 13:12:59 +02:00
Lonami
557ec70237 Added authenticator 2016-08-28 19:26:06 +02:00
Lonami
e00a4e9b4b Added a Session class 2016-08-28 14:16:52 +02:00
Lonami
bd1fee4048 Added and updated documentation 2016-08-28 13:55:05 +02:00
Lonami
5af1a4a5fc Added more docstrings, edited readme 2016-08-28 10:38:46 +02:00
Lonami
f00329265d Implemented read code on TLObjects Generator
The code generated by the generator now also writes the files
on_response(...) method. Also, all the generated files are
saved in a dictionary containing `constructorId: class`
2016-08-27 21:49:38 +02:00
Lonami
06832f8108 Implemented init and write code on TLObjects Generator
The code generated by the generator now classifies the output files
in their corresponding categories, also writing their __init__(...)
with documented arguments, and the on_send(...) method
2016-08-27 11:59:23 +02:00
Lonami
1974569927 Added a .tl file tokenizer and parser
A TLObject class has been added, as well as a method for tokenizen .tl files.
A TLObject can be created by simply calling `TLObject.from_tl(tl_line)`,
  this will tokenize the .tl line and return a new TLObject with all
  the required properties extracted.
Also added another method to load .tl files and yield TLObjects, including
  a SourceBuilder that can be later used to generate Python code.
2016-08-26 19:12:20 +02:00
Lonami
1dac866118 Initial release
The initial release contains the most basic implementation of TLSharp core.
This is also fully untested, since no test can be done until more work is done.
2016-08-26 12:58:53 +02:00