Bugfixes to secret chats
This commit is contained in:
parent
7e729ada7b
commit
6b5eb75f4f
@ -24,6 +24,8 @@ Features:
|
||||
|
||||
* It allows you to do everything official clients can do, programmatically!
|
||||
|
||||
* It can be proxied!
|
||||
|
||||
* It is very fast!
|
||||
|
||||
* It can be easily serialized!
|
||||
|
4
ab.php
4
ab.php
@ -1,4 +0,0 @@
|
||||
<?php
|
||||
|
||||
$packet = file_get_contents('t');
|
||||
var_dump(strrev(hash('crc32b', substr($packet, 0, -4), true)) !== substr($packet, -4));
|
@ -367,7 +367,7 @@ description: List of constructors
|
||||
<br><br>[$documentAttributeAnimated\_23](../constructors/documentAttributeAnimated_23.md) = \[\];<a name="documentAttributeAnimated_23"></a>
|
||||
|
||||
***
|
||||
<br><br>[$documentAttributeAudio\_23](../constructors/documentAttributeAudio_23.md) = \['duration' => [int](../types/int.md), \];<a name="documentAttributeAudio_23"></a>
|
||||
<br><br>[$documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md) = \['duration' => [int](../types/int.md), 'title' => [string](../types/string.md), 'performer' => [string](../types/string.md), \];<a name="documentAttributeAudio_46"></a>
|
||||
|
||||
***
|
||||
<br><br>[$documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md) = \['file_name' => [string](../types/string.md), \];<a name="documentAttributeFilename_23"></a>
|
||||
@ -379,10 +379,10 @@ description: List of constructors
|
||||
<br><br>[$documentAttributeImageSize\_23](../constructors/documentAttributeImageSize_23.md) = \['w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];<a name="documentAttributeImageSize_23"></a>
|
||||
|
||||
***
|
||||
<br><br>[$documentAttributeSticker\_23](../constructors/documentAttributeSticker_23.md) = \[\];<a name="documentAttributeSticker_23"></a>
|
||||
<br><br>[$documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md) = \['alt' => [string](../types/string.md), 'stickerset' => [InputStickerSet](../types/InputStickerSet.md), \];<a name="documentAttributeSticker_55"></a>
|
||||
|
||||
***
|
||||
<br><br>[$documentAttributeVideo\_23](../constructors/documentAttributeVideo_23.md) = \['duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];<a name="documentAttributeVideo_23"></a>
|
||||
<br><br>[$documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md) = \['round_message' => [Bool](../types/Bool.md), 'duration' => [int](../types/int.md), 'w' => [int](../types/int.md), 'h' => [int](../types/int.md), \];<a name="documentAttributeVideo_66"></a>
|
||||
|
||||
***
|
||||
<br><br>[$documentEmpty](../constructors/documentEmpty.md) = \['id' => [long](../types/long.md), \];<a name="documentEmpty"></a>
|
||||
|
@ -35,6 +35,12 @@ description: constructors and methods of type DocumentAttribute
|
||||
|
||||
[documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md)
|
||||
|
||||
[documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md)
|
||||
|
||||
[documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md)
|
||||
|
||||
[documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md)
|
||||
|
||||
|
||||
|
||||
### Methods that return an object of this type (methods):
|
||||
|
@ -1,3 +1,7 @@
|
||||
---
|
||||
title: MadelineProto documentation
|
||||
description: PHP implementation of telegram's MTProto protocol
|
||||
---
|
||||
# MadelineProto
|
||||
[![StyleCI](https://styleci.io/repos/61838413/shield)](https://styleci.io/repos/61838413)
|
||||
[![Build Status](https://travis-ci.org/danog/MadelineProto.svg?branch=master)](https://travis-ci.org/danog/MadelineProto)
|
||||
@ -24,6 +28,8 @@ Features:
|
||||
|
||||
* It allows you to do everything official clients can do, programmatically!
|
||||
|
||||
* It can be proxied!
|
||||
|
||||
* It is very fast!
|
||||
|
||||
* It can be easily serialized!
|
||||
|
@ -80,6 +80,7 @@ while (true) {
|
||||
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
|
||||
//\danog\MadelineProto\Logger::log([$updates]);
|
||||
foreach ($updates as $update) {
|
||||
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('s.madeline', $MadelineProto).' bytes'.PHP_EOL;
|
||||
$offset = $update['update_id'] + 1; // Just like in the bot API, the offset must be set to the last update_id
|
||||
switch ($update['update']['_']) {
|
||||
/*case 'updateNewChannelMessage':
|
||||
@ -88,9 +89,9 @@ while (true) {
|
||||
break;*/
|
||||
case 'updateNewMessage':
|
||||
if ($update['update']['message']['out'] || $update['update']['message']['message'] === '') continue;
|
||||
var_dump($update);
|
||||
break;
|
||||
case 'updateNewEncryptedMessage':
|
||||
var_dump($MadelineProto->download_to_dir($update['update']['message'], '.'));
|
||||
if (isset($sent[$update['update']['message']['chat_id']])) continue;
|
||||
$i = 0;
|
||||
while ($i < $argv[1]) {
|
||||
|
@ -95,6 +95,9 @@ trait Files
|
||||
$res = [];
|
||||
switch ($message_media['_']) {
|
||||
case 'encryptedMessage':
|
||||
if ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaExternalDocument') {
|
||||
return $this->get_download_info($message_media['decrypted_message']['media']);
|
||||
}
|
||||
$res['InputFileLocation'] = ['_' => 'inputEncryptedFileLocation', 'id' => $message_media['file']['id'], 'access_hash' => $message_media['file']['access_hash'], 'dc_id' => $message_media['file']['dc_id']];
|
||||
$res['size'] = $message_media['decrypted_message']['media']['size'];
|
||||
$res['key_fingerprint'] = $message_media['file']['key_fingerprint'];
|
||||
@ -109,7 +112,10 @@ trait Files
|
||||
}
|
||||
if (isset($message_media['decrypted_message']['media']['mime_type'])) {
|
||||
$res['mime'] = $message_media['decrypted_message']['media']['mime_type'];
|
||||
} else if ($message_media['decrypted_message']['media']['_'] === 'decryptedMessageMediaPhoto') {
|
||||
$res['mime'] = 'image/jpeg';
|
||||
}
|
||||
|
||||
if (isset($message_media['decrypted_message']['media']['attributes'])) {
|
||||
foreach ($message_media['decrypted_message']['media']['attributes'] as $attribute) {
|
||||
switch ($attribute['_']) {
|
||||
|
@ -26,9 +26,9 @@ trait PeerHandler
|
||||
switch ($user['_']) {
|
||||
case 'user':
|
||||
if (!isset($this->chats[$user['id']]) || $this->chats[$user['id']] !== $user) {
|
||||
foreach (str_split(pack('q', $user['access_hash'])) as $char) {
|
||||
/*foreach (str_split(pack('q', $user['access_hash'])) as $char) {
|
||||
var_dump(ord($char));
|
||||
}
|
||||
}*/
|
||||
$this->chats[$user['id']] = $user;
|
||||
try {
|
||||
$this->get_pwr_chat($user['id'], false, true);
|
||||
|
@ -22,8 +22,7 @@ trait AuthKeyHandler
|
||||
protected $temp_requested_secret_chats = [];
|
||||
protected $secret_chats = [];
|
||||
|
||||
public function accept_secret_chat($params)
|
||||
{
|
||||
public function accept_secret_chat($params) {
|
||||
//var_dump($params['id'],$this->secret_chat_status($params['id']));
|
||||
if ($this->secret_chat_status($params['id']) !== 0) {
|
||||
//var_dump($this->secret_chat_status($params['id']));
|
||||
|
@ -94,7 +94,7 @@ var_dump($MadelineProto->get_call($call));
|
||||
$InputEncryptedChat = $MadelineProto->get_secret_chat($secret)['InputEncryptedChat'];
|
||||
$sentMessage = $MadelineProto->messages->sendEncrypted(['peer' => $InputEncryptedChat, 'message' => ['_' => 'decryptedMessage', 'media' => ['_' => 'decryptedMessageMediaEmpty'], 'ttl' => 10, 'message' => $message, 'entities' => [['_' => 'messageEntityCode', 'offset' => 0, 'length' => mb_strlen($message)]]]]); // should work with all layers
|
||||
\danog\MadelineProto\Logger::log([$sentMessage], \danog\MadelineProto\Logger::NOTICE);
|
||||
|
||||
/*
|
||||
while (true) {
|
||||
$updates = $MadelineProto->API->get_updates(['offset' => $offset, 'limit' => 50, 'timeout' => 0]); // Just like in the bot API, you can specify an offset, a limit and a timeout
|
||||
//\danog\MadelineProto\Logger::log([$updates]);
|
||||
@ -106,7 +106,7 @@ var_dump($MadelineProto->get_call($call));
|
||||
}
|
||||
echo 'Wrote '.\danog\MadelineProto\Serialization::serialize('session.madeline', $MadelineProto).' bytes'.PHP_EOL;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$secret_media = [];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user