Fixing typos

This commit is contained in:
Daniil Gentili 2018-03-20 20:43:11 +01:00
parent 5d57935c37
commit b04f5065e5
23 changed files with 105 additions and 58 deletions

View File

@ -39,7 +39,7 @@ $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K
echo 'OK, done!'.PHP_EOL;
```
Run this code in a browser or in a console.
Run this code in a browser or in a console.
Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgroup) the error message and the `MadelineProto.log` file that was created in the same directory (if running from a browser).
@ -107,7 +107,7 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
* [Full chat info with full list of participants](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_pwr_chat)
* [Full chat info](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_full_info)
* [Reduced chat info (very fast)](https://docs.madelineproto.xyz/docs/CHAT_INFO.html#get_info)
* [Getting all chats](https://docs.madelineproto.xyz/docs/DIALOGS.html)
* [Getting all chats (dialogs)](https://docs.madelineproto.xyz/docs/DIALOGS.html)
* [As user](https://docs.madelineproto.xyz/docs/DIALOGS.html#user-get_dialogs)
* [As bot](https://docs.madelineproto.xyz/docs/DIALOGS.html#bot-internal-peer-database)
* [Inline buttons](https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html)

View File

@ -53,13 +53,17 @@ foreach ($files as $file) {
ksort($orderedfiles);
foreach ($orderedfiles as $key => $filename) {
$lines = explode("\n", file_get_contents($filename));
while (end($lines) === '') {
unset($lines[count($lines)-1]);
}
if (strpos(end($lines), "Next")) {
unset($lines[count($lines)-1]);
unset($lines[count($lines)-2]);
}
if (isset($orderedfiles[$key+1])) {
$nextfile = "https://docs.madelineproto.xyz/docs/".basename($orderedfiles[$key+1], '.md').".html";
$lines[count($lines)] = "\n<form action=\"$nextfile\"><input type=\"submit\" value=\"Next section\" /></form>";
} else {
$lines[count($lines)] = "\n<form action=\"https://docs.madelineproto.xyz/#very-complex-and-complete-examples\"><input type=\"submit\" value=\"Next section\" /></form>";
}
file_put_contents($filename, implode("\n", $lines));

View File

@ -68,12 +68,12 @@ $controller->parseConfig();
Do this before accepting a call or right after requesting one.
It is best to set an initial bitrate not much smaller than the maximum bitrate, since libtgvoip tends to always increase it, initially, and when it does that, slight sound distortions occur.
The maximum bitrate can be set to any value, really, as long as it's smaller than 110*1000 (temporary limit that I'm trying to work around).
It is best to set the minumum bitrate to a value smaller than or equal to 20*1000.
The maximum bitrate can be set to any value, really, as long as it's smaller than `110*1000` (temporary limit that I'm trying to work around).
It is best to set the minumum bitrate to a value smaller than or equal to `20*1000`.
Of course, you can't set the initial bitrate to a value higher than the maximum bitrate or lower than the minimum bitrate, and you can't set the minimum bitrate to a value higher than the maximum bitrate, or the maximum bitrate to a value lower than the minimum bitrate.
You can also tweak the steps to speed up/slow down automatic increasing/decreasing of the bitrates, or stop it altogether by settings both steps to 0 (in this case, the bitrate will always be equal to the initial bitrate).
Try to find out what works best for you.
If you manually set the network type to NET_TYPE_GPRS, NET_TYPE_EDGE, or enabled data saving mode, you must append a _gprs, _edge, _saving to the audio_init/max/min bitrate keys.
If you manually set the network type to `NET_TYPE_GPRS`, `NET_TYPE_EDGE`, or enabled data saving mode, you must append a `_gprs`, `_edge`, `_saving` to the audio_init/max/min bitrate keys.
## Putting it all together
@ -115,4 +115,7 @@ foreach ($updates as $update) {
<form action="https://docs.madelineproto.xyz/docs/SECRET_CHATS.html"><input type="submit" value="Next section" /></form>

View File

@ -42,4 +42,5 @@ You can also use `get_info` to get chat info, see [here for the parameters and t
* Speed: very fast
* Caching: full
<form action="https://docs.madelineproto.xyz/docs/DIALOGS.html"><input type="submit" value="Next section" /></form>

View File

@ -89,3 +89,5 @@ While writing this client, I looked at many projects for inspiration and help. H
Thanks to the devs that contributed to these projects, MadelineProto is now an easy, well-written and complete MTProto client.
<form action="https://docs.madelineproto.xyz/#very-complex-and-complete-examples"><input type="submit" value="Next section" /></form>

View File

@ -18,6 +18,7 @@ $MadelineProto = new \danog\MadelineProto\API('session.madeline', $settings); /
To change the session file after starting MadelineProto, do the following:
```php
$MadelineProto->session = 'newsession.madeline';
```
```
<form action="https://docs.madelineproto.xyz/docs/LOGIN.html"><input type="submit" value="Next section" /></form>

View File

@ -1,4 +1,4 @@
# Getting all chats
# Getting all chats (dialogs)
There are two ways to get a list of all chats, depending if you logged in as a user, or as a bot.
@ -29,4 +29,7 @@ foreach ($MadelineProto->API->chats as $bot_api_id => $chat) {
Since bots cannot run `get_dialogs`, you must make use of the internal MadelineProto database to get a list of all users, chats and channels MadelineProto has seen.
`$MadelineProto->API->chats` contains a list of [Chat](../API_docs/types/Chat.md) and [User](../API_docs/types/User.md) objects, indexed by bot API id.
<form action="https://docs.madelineproto.xyz/docs/INLINE_BUTTONS.html"><input type="submit" value="Next section" /></form>

View File

@ -23,7 +23,7 @@ MadelineProto can throw lots of different exceptions.
* \danog\MadelineProto\Exception - Default exception, thrown when a php error occures and in a lot of other cases
* \danog\MadelineProto\RPCErrorException - Thrown when an RPC error occurres (an error received via the mtproto API): **note** that the error message of this exception is localized in English, and may vary: to fetch the original API error message use `$e->rpc`.
* \danog\MadelineProto\RPCErrorException - Thrown when an RPC error occurres (an error received via the MTProto API): **note** that the error message of this exception is localized in English, and may vary: to fetch the original API error message use `$e->rpc`.
* \danog\MadelineProto\TL\Exception - Thrown on TL serialization/deserialization errors
@ -102,4 +102,9 @@ try {
}
```
<form action="https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html"><input type="submit" value="Next section" /></form>
<form action="https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html"><input type="submit" value="Next section" /></form>

View File

@ -42,4 +42,5 @@
<form action="https://docs.madelineproto.xyz/docs/REQUIREMENTS.html"><input type="submit" value="Next section" /></form>

View File

@ -426,4 +426,6 @@ $output_file_name = $MadelineProto->download_to_file(
);
```
<form action="https://docs.madelineproto.xyz/docs/CHAT_INFO.html"><input type="submit" value="Next section" /></form>

View File

@ -11,4 +11,7 @@ floodwaitrate = time it took you to make the method calls + X
Use sleep to execute max N calls in `floodwaitrate` seconds, this way you won't get flood waited!
<form action="https://docs.madelineproto.xyz/docs/LOGGING.html"><input type="submit" value="Next section" /></form>

View File

@ -51,4 +51,6 @@ $button->click();
```
<form action="https://docs.madelineproto.xyz/docs/CALLS.html"><input type="submit" value="Next section" /></form>

View File

@ -121,4 +121,5 @@ Now open `.env` and edit its values as needed.
<form action="https://docs.madelineproto.xyz/docs/UPDATES.html"><input type="submit" value="Next section" /></form>

View File

@ -14,6 +14,9 @@ MadelineProto provides a unified class for logging messages to the logging desti
* `\danog\MadelineProto\Logger:VERBOSE` - Indicates a verbose info message
* `\danog\MadelineProto\Logger:ULTRA_VERBOSE` - Indicates an ultra verbose
By default, `$level` is `\danog\MadelineProto\Logger:NOTICE`.
<form action="https://docs.madelineproto.xyz/docs/USING_METHODS.html"><input type="submit" value="Next section" /></form>

View File

@ -59,4 +59,5 @@ Use `logout` to logout, see [here for the parameters and the result](https://doc
<form action="https://docs.madelineproto.xyz/docs/FEATURES.html"><input type="submit" value="Next section" /></form>

View File

@ -14,6 +14,8 @@ Passing lua callables to a parameter of a PHP callable will throw an exception d
All MadelineProto wrapper methods (for example upload, download, upload_encrypted, get_self, and others) are imported in the Lua environment, as well as all MTProto wrappers (see the API docs for more info).
td-cli wrappers are also present: you can use the tdcli_function in lua and pass mtproto updates to the tdcli_update_callback via PHP, they will be automatically converted to/from td objects. Please note that the object conversion is not complete, feel free to contribute to the conversion module in [`src/danog/MadelineProto/Conversion/TD.php`](https://github.com/danog/MadelineProto/raw/master/src/danog/MadelineProto/TL/Conversion/TD.php).
td-cli wrappers are also present: you can use the tdcli_function in lua and pass mtproto updates to the tdcli_update_callback via PHP, they will be automatically converted to/from td objects. Please note that the object conversion is not complete, feel free to contribute to the conversion module in [`src/danog/MadelineProto/Conversion/TD.php`](https://github.com/danog/MadelineProto/raw/master/src/danog/MadelineProto/TL/Conversion/TD.php).
<form action="https://docs.madelineproto.xyz/docs/PROXY.html"><input type="submit" value="Next section" /></form>

View File

@ -120,4 +120,6 @@ Works like [socket_getsockname](http://php.net/manual/en/function.socket-getsock
Can return additional HTTP headers to use when the HTTP protocol is being used.
<form action="https://docs.madelineproto.xyz/docs/CONTRIBUTING.html"><input type="submit" value="Next section" /></form>

View File

@ -13,4 +13,6 @@ sudo apt-get install php7.2 php7.2-dev php7.2-fpm php7.2-curl php7.2-xml php7.2-
Next, follow the instructions on voip.madelineproto.xyz and prime.madelineproto.xyz to install libtgvoip and PrimeModule.
<form action="https://docs.madelineproto.xyz/docs/INSTALLATION.html"><input type="submit" value="Next section" /></form>

View File

@ -13,7 +13,7 @@ MadelineProto provides wrappers to work with secret chats.
$secret_chat = $MadelineProto->request_secret_chat($InputUser);
```
Use [`request_secret_chat`] requests a secret secret chat to the [InputUser](https://docs.madelineproto.xyz/API_docs/types/InputUser.html), ID, or username specified, and returns the secret chat ID.
[`request_secret_chat`](https://docs.madelineproto.xyz/request_secret_chat.html) requests a secret secret chat to the [InputUser](https://docs.madelineproto.xyz/API_docs/types/InputUser.html), ID, or username specified, and returns the secret chat ID.
## Accepting secret chats
@ -67,4 +67,7 @@ $secret_chat = $MadelineProto->get_secret_chat($chat);
This method gets info about a certain chat.
<form action="https://docs.madelineproto.xyz/docs/LUA.html"><input type="submit" value="Next section" /></form>

View File

@ -8,4 +8,6 @@ $me = $MadelineProto->get_self();
[`get_self`](https://docs.madelineproto.xyz/get_self.html) returns a [User object](API_docs/types/User.md) that contains info about the currently logged in user/bot, or false if the current instance is not logged in.
<form action="https://docs.madelineproto.xyz/docs/EXCEPTIONS.html"><input type="submit" value="Next section" /></form>

View File

@ -109,64 +109,63 @@ Cons:
* obfuscated2: Like tcp_abridged, but obfuscated
Overhead: Medium-high
Pros:
- All Telegram DCs support it
- Minimum envelope length: 1 byte (length)
- Maximum envelope length: 4 bytes (length)
- Obfuscation to prevent ISP blocks
* All Telegram DCs support it
* Minimum envelope length: 1 byte (length)
* Maximum envelope length: 4 bytes (length)
* Obfuscation to prevent ISP blocks
Cons:
- Initial payload of 64 bytes must be sent on every connection
- Additional round of encryption is required
- No initial integrity check
- No transport sequence number
* Initial payload of 64 bytes must be sent on every connection
* Additional round of encryption is required
* No initial integrity check
* No transport sequence number
* tcp_intermediate: I guess they like having multiple protocols
Overhead: small
Pros:
- Minimum envelope length: 4 bytes (length)
- Maximum envelope length: 4 bytes (length)
* Overhead: small
* Pros:
* Minimum envelope length: 4 bytes (length)
* Maximum envelope length: 4 bytes (length)
Cons:
- No obfuscation
- No initial integrity check
- Not all Telegram DCs support it
- No transport sequence number
* Cons:
* No obfuscation
* No initial integrity check
* Not all Telegram DCs support it
* No transport sequence number
* tcp_full: The basic MTProto transport protocol, supported by all clients
Overhead: medium
Pros:
- All Telegram DCs support it
- Initial integrity check with crc32
- Transport sequence number check
* Overhead: medium
* Pros:
* All Telegram DCs support it
* Initial integrity check with crc32
* Transport sequence number check
Cons:
- Minimum envelope length: 12 bytes (length+seqno+crc)
- Maximum envelope length: 12 bytes (length+seqno+crc)
- Initial integrity check with crc32 is not that useful since the TCP protocol already uses it internally
- Transport sequence number check is also not that useful since transport sequence numbers are not encrypted and thus cannot be used to avoid replay attacks, and MadelineProto already uses MTProto sequence numbers and message ids for that
* Cons:
* Minimum envelope length: 12 bytes (length+seqno+crc)
* Maximum envelope length: 12 bytes (length+seqno+crc)
* Initial integrity check with crc32 is not that useful since the TCP protocol already uses it internally
* Transport sequence number check is also not that useful since transport sequence numbers are not encrypted and thus cannot be used to avoid replay attacks, and MadelineProto already uses MTProto sequence numbers and message ids for that
* http: MTProto over HTTP for browsers and webhosts
Overhead: medium
Pros:
- Can be used on restricted webhosts or browsers
* Overhead: medium
* Pros:
* Can be used on restricted webhosts or browsers
Cons:
- Not all telegram DCs support it
- Very big envelope length
- No Initial integrity check
- No transport sequence number check
* Cons:
* Very big envelope length
* No Initial integrity check
* No transport sequence number check
* https: MTProto over HTTPS for browsers and webhosts, very secure
Overhead: high
Pros:
- Can be used on restricted webhosts or browsers
- Provides an additional layer of security by trasmitting data over TLS
- Integrity checks with HMAC built into TLS
- Sequence number checks built into TLS
Cons:
- Very big envelope length
- Requires an additional round of encryption
* Overhead: high
* Pros:
* Can be used on restricted webhosts or browsers
* Provides an additional layer of security by trasmitting data over TLS
* Integrity checks with HMAC built into TLS
* Sequence number checks built into TLS
* Cons:
* Very big envelope length
* Requires an additional round of encryption
### `$settings['connection_settings']['all']['test_mode']`
Default: false
@ -277,7 +276,7 @@ Description: How many times should I try to call a method or send an object befo
### `$settings['max_tries']['query']`
Default: 5
Description: How many times should I try to generate an authorizatio key before throwing an exception?
Description: How many times should I try to generate an authorization key before throwing an exception?
### `$settings['max_tries']['response']`
Default: 5
@ -397,4 +396,7 @@ The settings array can be accessed and modified in the instantiated class by acc
$MadelineProto->settings['updates']['handle_updates'] = true; // reenable update fetching
```
<form action="https://docs.madelineproto.xyz/docs/SELF.html"><input type="submit" value="Next section" /></form>

View File

@ -196,7 +196,8 @@ Note that multiprocessing is not the same as multithreading, and should be avoid
<button href="https://docs.madelineproto.xyz/docs/SETTINGS.html">Next section</button>
<form action="https://docs.madelineproto.xyz/docs/SETTINGS.html"><input type="submit" value="Next section" /></form>

View File

@ -98,4 +98,5 @@ $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => 'l
If the queue if the specified queue name does not exist, it will be created.
<form action="https://docs.madelineproto.xyz/docs/FILES.html"><input type="submit" value="Next section" /></form>