Fixes for bad message notifications, ignore constructors from old layers and different flags

This commit is contained in:
Daniil Gentili 2018-02-28 12:43:45 +00:00
parent bbe24e70d9
commit 34592383ed
26 changed files with 42 additions and 689 deletions

View File

@ -1,37 +0,0 @@
---
title: documentAttributeAnimated
description: documentAttributeAnimated attributes, type and example
---
## Constructor: documentAttributeAnimated\_23
[Back to constructors index](index.md)
### Type: [DocumentAttribute](../types/DocumentAttribute.md)
### Example:
```
$documentAttributeAnimated_23 = ['_' => 'documentAttributeAnimated'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "documentAttributeAnimated"}
```
Or, if you're into Lua:
```
documentAttributeAnimated_23={_='documentAttributeAnimated'}
```

View File

@ -1,42 +0,0 @@
---
title: documentAttributeFilename
description: documentAttributeFilename attributes, type and example
---
## Constructor: documentAttributeFilename\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|file\_name|[string](../types/string.md) | Yes|
### Type: [DocumentAttribute](../types/DocumentAttribute.md)
### Example:
```
$documentAttributeFilename_23 = ['_' => 'documentAttributeFilename', 'file_name' => 'string'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "documentAttributeFilename", "file_name": "string"}
```
Or, if you're into Lua:
```
documentAttributeFilename_23={_='documentAttributeFilename', file_name='string'}
```

View File

@ -1,43 +0,0 @@
---
title: documentAttributeImageSize
description: documentAttributeImageSize attributes, type and example
---
## Constructor: documentAttributeImageSize\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|w|[int](../types/int.md) | Yes|
|h|[int](../types/int.md) | Yes|
### Type: [DocumentAttribute](../types/DocumentAttribute.md)
### Example:
```
$documentAttributeImageSize_23 = ['_' => 'documentAttributeImageSize', 'w' => int, 'h' => int];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "documentAttributeImageSize", "w": int, "h": int}
```
Or, if you're into Lua:
```
documentAttributeImageSize_23={_='documentAttributeImageSize', w=int, h=int}
```

View File

@ -12,6 +12,7 @@ description: documentAttributeVideo attributes, type and example
| Name | Type | Required |
|----------|---------------|----------|
|round\_message|[Bool](../types/Bool.md) | Optional|
|supports\_streaming|[Bool](../types/Bool.md) | Optional|
|duration|[int](../types/int.md) | Yes|
|w|[int](../types/int.md) | Yes|
|h|[int](../types/int.md) | Yes|
@ -24,13 +25,13 @@ description: documentAttributeVideo attributes, type and example
### Example:
```
$documentAttributeVideo = ['_' => 'documentAttributeVideo', 'round_message' => Bool, 'duration' => int, 'w' => int, 'h' => int];
$documentAttributeVideo = ['_' => 'documentAttributeVideo', 'round_message' => Bool, 'supports_streaming' => Bool, 'duration' => int, 'w' => int, 'h' => int];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "documentAttributeVideo", "round_message": Bool, "duration": int, "w": int, "h": int}
{"_": "documentAttributeVideo", "round_message": Bool, "supports_streaming": Bool, "duration": int, "w": int, "h": int}
```
@ -38,7 +39,7 @@ Or, if you're into Lua:
```
documentAttributeVideo={_='documentAttributeVideo', round_message=Bool, duration=int, w=int, h=int}
documentAttributeVideo={_='documentAttributeVideo', round_message=Bool, supports_streaming=Bool, duration=int, w=int, h=int}
```

View File

@ -1,45 +0,0 @@
---
title: documentAttributeVideo
description: documentAttributeVideo attributes, type and example
---
## Constructor: documentAttributeVideo\_66
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|round\_message|[Bool](../types/Bool.md) | Optional|
|duration|[int](../types/int.md) | Yes|
|w|[int](../types/int.md) | Yes|
|h|[int](../types/int.md) | Yes|
### Type: [DocumentAttribute](../types/DocumentAttribute.md)
### Example:
```
$documentAttributeVideo_66 = ['_' => 'documentAttributeVideo', 'round_message' => Bool, 'duration' => int, 'w' => int, 'h' => int];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "documentAttributeVideo", "round_message": Bool, "duration": int, "w": int, "h": int}
```
Or, if you're into Lua:
```
documentAttributeVideo_66={_='documentAttributeVideo', round_message=Bool, duration=int, w=int, h=int}
```

View File

@ -1,44 +0,0 @@
---
title: fileLocationUnavailable
description: fileLocationUnavailable attributes, type and example
---
## Constructor: fileLocationUnavailable\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|volume\_id|[long](../types/long.md) | Yes|
|local\_id|[int](../types/int.md) | Yes|
|secret|[long](../types/long.md) | Yes|
### Type: [FileLocation](../types/FileLocation.md)
### Example:
```
$fileLocationUnavailable_23 = ['_' => 'fileLocationUnavailable', 'volume_id' => long, 'local_id' => int, 'secret' => long];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "fileLocationUnavailable", "volume_id": long, "local_id": int, "secret": long}
```
Or, if you're into Lua:
```
fileLocationUnavailable_23={_='fileLocationUnavailable', volume_id=long, local_id=int, secret=long}
```

View File

@ -1,45 +0,0 @@
---
title: fileLocation
description: fileLocation attributes, type and example
---
## Constructor: fileLocation\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|dc\_id|[int](../types/int.md) | Yes|
|volume\_id|[long](../types/long.md) | Yes|
|local\_id|[int](../types/int.md) | Yes|
|secret|[long](../types/long.md) | Yes|
### Type: [FileLocation](../types/FileLocation.md)
### Example:
```
$fileLocation_23 = ['_' => 'fileLocation', 'dc_id' => int, 'volume_id' => long, 'local_id' => int, 'secret' => long];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "fileLocation", "dc_id": int, "volume_id": long, "local_id": int, "secret": long}
```
Or, if you're into Lua:
```
fileLocation_23={_='fileLocation', dc_id=int, volume_id=long, local_id=int, secret=long}
```

View File

@ -417,7 +417,7 @@ description: List of constructors
<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](../constructors/documentAttributeVideo.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"></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>[$documentEmpty](../constructors/documentEmpty.md) = \['id' => [long](../types/long.md), \];<a name="documentEmpty"></a>

View File

@ -1,46 +0,0 @@
---
title: photoCachedSize
description: photoCachedSize attributes, type and example
---
## Constructor: photoCachedSize\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|type|[string](../types/string.md) | Yes|
|location|[FileLocation](../types/FileLocation.md) | Yes|
|w|[int](../types/int.md) | Yes|
|h|[int](../types/int.md) | Yes|
|bytes|[bytes](../types/bytes.md) | Yes|
### Type: [PhotoSize](../types/PhotoSize.md)
### Example:
```
$photoCachedSize_23 = ['_' => 'photoCachedSize', 'type' => 'string', 'location' => FileLocation, 'w' => int, 'h' => int, 'bytes' => 'bytes'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "photoCachedSize", "type": "string", "location": FileLocation, "w": int, "h": int, "bytes": "bytes"}
```
Or, if you're into Lua:
```
photoCachedSize_23={_='photoCachedSize', type='string', location=FileLocation, w=int, h=int, bytes='bytes'}
```

View File

@ -1,42 +0,0 @@
---
title: photoSizeEmpty
description: photoSizeEmpty attributes, type and example
---
## Constructor: photoSizeEmpty\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|type|[string](../types/string.md) | Yes|
### Type: [PhotoSize](../types/PhotoSize.md)
### Example:
```
$photoSizeEmpty_23 = ['_' => 'photoSizeEmpty', 'type' => 'string'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "photoSizeEmpty", "type": "string"}
```
Or, if you're into Lua:
```
photoSizeEmpty_23={_='photoSizeEmpty', type='string'}
```

View File

@ -1,46 +0,0 @@
---
title: photoSize
description: photoSize attributes, type and example
---
## Constructor: photoSize\_23
[Back to constructors index](index.md)
### Attributes:
| Name | Type | Required |
|----------|---------------|----------|
|type|[string](../types/string.md) | Yes|
|location|[FileLocation](../types/FileLocation.md) | Yes|
|w|[int](../types/int.md) | Yes|
|h|[int](../types/int.md) | Yes|
|size|[int](../types/int.md) | Yes|
### Type: [PhotoSize](../types/PhotoSize.md)
### Example:
```
$photoSize_23 = ['_' => 'photoSize', 'type' => 'string', 'location' => FileLocation, 'w' => int, 'h' => int, 'size' => int];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "photoSize", "type": "string", "location": FileLocation, "w": int, "h": int, "size": int}
```
Or, if you're into Lua:
```
photoSize_23={_='photoSize', type='string', location=FileLocation, w=int, h=int, size=int}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageCancelAction
description: sendMessageCancelAction attributes, type and example
---
## Constructor: sendMessageCancelAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageCancelAction_17 = ['_' => 'sendMessageCancelAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageCancelAction"}
```
Or, if you're into Lua:
```
sendMessageCancelAction_17={_='sendMessageCancelAction'}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageChooseContactAction
description: sendMessageChooseContactAction attributes, type and example
---
## Constructor: sendMessageChooseContactAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageChooseContactAction_17 = ['_' => 'sendMessageChooseContactAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageChooseContactAction"}
```
Or, if you're into Lua:
```
sendMessageChooseContactAction_17={_='sendMessageChooseContactAction'}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageGeoLocationAction
description: sendMessageGeoLocationAction attributes, type and example
---
## Constructor: sendMessageGeoLocationAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageGeoLocationAction_17 = ['_' => 'sendMessageGeoLocationAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageGeoLocationAction"}
```
Or, if you're into Lua:
```
sendMessageGeoLocationAction_17={_='sendMessageGeoLocationAction'}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageRecordAudioAction
description: sendMessageRecordAudioAction attributes, type and example
---
## Constructor: sendMessageRecordAudioAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageRecordAudioAction_17 = ['_' => 'sendMessageRecordAudioAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageRecordAudioAction"}
```
Or, if you're into Lua:
```
sendMessageRecordAudioAction_17={_='sendMessageRecordAudioAction'}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageRecordVideoAction
description: sendMessageRecordVideoAction attributes, type and example
---
## Constructor: sendMessageRecordVideoAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageRecordVideoAction_17 = ['_' => 'sendMessageRecordVideoAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageRecordVideoAction"}
```
Or, if you're into Lua:
```
sendMessageRecordVideoAction_17={_='sendMessageRecordVideoAction'}
```

View File

@ -1,37 +0,0 @@
---
title: sendMessageTypingAction
description: sendMessageTypingAction attributes, type and example
---
## Constructor: sendMessageTypingAction\_17
[Back to constructors index](index.md)
### Type: [SendMessageAction](../types/SendMessageAction.md)
### Example:
```
$sendMessageTypingAction_17 = ['_' => 'sendMessageTypingAction'];
```
[PWRTelegram](https://pwrtelegram.xyz) json-encoded version:
```
{"_": "sendMessageTypingAction"}
```
Or, if you're into Lua:
```
sendMessageTypingAction_17={_='sendMessageTypingAction'}
```

View File

@ -9,38 +9,30 @@ description: constructors and methods of type DocumentAttribute
### Possible values (constructors):
[documentAttributeImageSize\_23](../constructors/documentAttributeImageSize_23.md)
[documentAttributeAnimated\_23](../constructors/documentAttributeAnimated_23.md)
[documentAttributeSticker](../constructors/documentAttributeSticker.md)
[documentAttributeVideo\_66](../constructors/documentAttributeVideo_66.md)
[documentAttributeAudio](../constructors/documentAttributeAudio.md)
[documentAttributeFilename\_23](../constructors/documentAttributeFilename_23.md)
[documentAttributeHasStickers](../constructors/documentAttributeHasStickers.md)
[documentAttributeImageSize](../constructors/documentAttributeImageSize.md)
[documentAttributeAnimated](../constructors/documentAttributeAnimated.md)
[documentAttributeSticker](../constructors/documentAttributeSticker.md)
[documentAttributeVideo](../constructors/documentAttributeVideo.md)
[documentAttributeAudio](../constructors/documentAttributeAudio.md)
[documentAttributeFilename](../constructors/documentAttributeFilename.md)
[documentAttributeHasStickers](../constructors/documentAttributeHasStickers.md)
[documentAttributeSticker\_23](../constructors/documentAttributeSticker_23.md)
[documentAttributeVideo\_23](../constructors/documentAttributeVideo_23.md)
[documentAttributeAudio\_23](../constructors/documentAttributeAudio_23.md)
[documentAttributeFilename](../constructors/documentAttributeFilename.md)
[documentAttributeAudio\_46](../constructors/documentAttributeAudio_46.md)
[documentAttributeSticker\_55](../constructors/documentAttributeSticker_55.md)
[documentAttributeVideo](../constructors/documentAttributeVideo.md)
### Methods that return an object of this type (methods):

View File

@ -9,10 +9,6 @@ description: constructors and methods of type FileLocation
### Possible values (constructors):
[fileLocationUnavailable\_23](../constructors/fileLocationUnavailable_23.md)
[fileLocation\_23](../constructors/fileLocation_23.md)
[fileLocationUnavailable](../constructors/fileLocationUnavailable.md)
[fileLocation](../constructors/fileLocation.md)

View File

@ -9,12 +9,6 @@ description: constructors and methods of type PhotoSize
### Possible values (constructors):
[photoSizeEmpty\_23](../constructors/photoSizeEmpty_23.md)
[photoSize\_23](../constructors/photoSize_23.md)
[photoCachedSize\_23](../constructors/photoCachedSize_23.md)
[photoSizeEmpty](../constructors/photoSizeEmpty.md)
[photoSize](../constructors/photoSize.md)

View File

@ -9,15 +9,15 @@ description: constructors and methods of type SendMessageAction
### Possible values (constructors):
[sendMessageTypingAction\_17](../constructors/sendMessageTypingAction_17.md)
[sendMessageTypingAction](../constructors/sendMessageTypingAction.md)
[sendMessageCancelAction\_17](../constructors/sendMessageCancelAction_17.md)
[sendMessageCancelAction](../constructors/sendMessageCancelAction.md)
[sendMessageRecordVideoAction\_17](../constructors/sendMessageRecordVideoAction_17.md)
[sendMessageRecordVideoAction](../constructors/sendMessageRecordVideoAction.md)
[sendMessageUploadVideoAction](../constructors/sendMessageUploadVideoAction.md)
[sendMessageRecordAudioAction\_17](../constructors/sendMessageRecordAudioAction_17.md)
[sendMessageRecordAudioAction](../constructors/sendMessageRecordAudioAction.md)
[sendMessageUploadAudioAction](../constructors/sendMessageUploadAudioAction.md)
@ -25,9 +25,9 @@ description: constructors and methods of type SendMessageAction
[sendMessageUploadDocumentAction](../constructors/sendMessageUploadDocumentAction.md)
[sendMessageGeoLocationAction\_17](../constructors/sendMessageGeoLocationAction_17.md)
[sendMessageGeoLocationAction](../constructors/sendMessageGeoLocationAction.md)
[sendMessageChooseContactAction\_17](../constructors/sendMessageChooseContactAction_17.md)
[sendMessageChooseContactAction](../constructors/sendMessageChooseContactAction.md)
[sendMessageGamePlayAction](../constructors/sendMessageGamePlayAction.md)
@ -35,26 +35,14 @@ description: constructors and methods of type SendMessageAction
[sendMessageUploadRoundAction](../constructors/sendMessageUploadRoundAction.md)
[sendMessageTypingAction](../constructors/sendMessageTypingAction.md)
[sendMessageCancelAction](../constructors/sendMessageCancelAction.md)
[sendMessageRecordVideoAction](../constructors/sendMessageRecordVideoAction.md)
[sendMessageUploadVideoAction\_17](../constructors/sendMessageUploadVideoAction_17.md)
[sendMessageRecordAudioAction](../constructors/sendMessageRecordAudioAction.md)
[sendMessageUploadAudioAction\_17](../constructors/sendMessageUploadAudioAction_17.md)
[sendMessageUploadPhotoAction\_17](../constructors/sendMessageUploadPhotoAction_17.md)
[sendMessageUploadDocumentAction\_17](../constructors/sendMessageUploadDocumentAction_17.md)
[sendMessageGeoLocationAction](../constructors/sendMessageGeoLocationAction.md)
[sendMessageChooseContactAction](../constructors/sendMessageChooseContactAction.md)
### Methods that return an object of this type (methods):

View File

@ -4,4 +4,3 @@ description: Documentation of old mtproto layers
---
# Documentation of old mtproto layers
[Layer v73](API_docs_v73/)

10
phar.php Normal file
View File

@ -0,0 +1,10 @@
<?php
if (!file_exists('madeline.phar')) {
file_put_contents('madeline.phar', file_get_contents('https://phar.madelineproto.xyz/madeline.phar?v=new'));
}
require 'madeline.phar';
if (trim(file_get_contents('phar://madeline.phar/.git/refs/heads/master')) !== trim(file_get_contents('https://phar.madelineproto.xyz/release?v=new'))) {
file_put_contents('madeline.phar', file_get_contents('https://phar.madelineproto.xyz/madeline.phar?v=new'));
}

View File

@ -165,7 +165,7 @@ trait CallHandler
$only_updates = $this->handle_messages($aargs['datacenter']);
// This method receives data from the socket, and parses stuff
} catch (\danog\MadelineProto\Exception $e) {
if ($e->getMessage() === 'I had to recreate the temporary authorization key' || $e->getCode() === 404) {
if (in_array($e->getMessage(), ['I had to recreate the temporary authorization key', 'Got bad message notification']) || $e->getCode() === 404) {
continue 2;
}
\danog\MadelineProto\Logger::log(['An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...'], \danog\MadelineProto\Logger::WARNING);
@ -191,23 +191,7 @@ trait CallHandler
break;
case 'bad_server_salt':
case 'bad_msg_notification':
switch ($server_answer['error_code']) {
case 48:
$this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key['server_salt'] = $server_answer['new_server_salt'];
continue 3;
case 16:
case 17:
\danog\MadelineProto\Logger::log(['Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$server_answer['error_code']]], \danog\MadelineProto\Logger::WARNING);
$this->datacenter->sockets[$aargs['datacenter']]->time_delta = (int) (new \phpseclib\Math\BigInteger(strrev($this->datacenter->sockets[$aargs['datacenter']]->outgoing_messages[$message_id]['response']), 256))->bitwise_rightShift(32)->subtract(new \phpseclib\Math\BigInteger(time()))->toString();
\danog\MadelineProto\Logger::log(['Set time delta to '.$this->datacenter->sockets[$aargs['datacenter']]->time_delta], \danog\MadelineProto\Logger::WARNING);
$this->reset_session();
$this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key = null;
$this->init_authorization();
continue 3;
}
throw new \danog\MadelineProto\RPCErrorException('Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$server_answer['error_code']], $server_answer['error_code']);
break;
case 'boolTrue':
case 'boolFalse':
$server_answer = $server_answer['_'] === 'boolTrue';

View File

@ -101,12 +101,14 @@ trait ResponseHandler
$only_updates = false;
$this->ack_outgoing_message_id($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id'], $datacenter);
// Acknowledge that the server received my request
$this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]['response'] = $current_msg_id;
unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]);
unset($this->datacenter->sockets[$datacenter]->new_outgoing[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]);
switch ($this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['error_code']) {
case 48:
$this->datacenter->sockets[$datacenter]->temp_auth_key['server_salt'] = $this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['new_server_salt'];
break;
throw new \danog\MadelineProto\Exception('Got bad message notification');
case 16:
case 17:
\danog\MadelineProto\Logger::log(['Received bad_msg_notification: '.self::BAD_MSG_ERROR_CODES[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['error_code']]], \danog\MadelineProto\Logger::WARNING);
@ -115,10 +117,9 @@ trait ResponseHandler
$this->reset_session();
$this->datacenter->sockets[$datacenter]->temp_auth_key = null;
$this->init_authorization();
break;
throw new \danog\MadelineProto\Exception('Got bad message notification');
}
unset($this->datacenter->sockets[$datacenter]->new_incoming[$current_msg_id]);
unset($this->datacenter->sockets[$datacenter]->new_outgoing[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]);
$this->datacenter->sockets[$datacenter]->outgoing_messages[$this->datacenter->sockets[$datacenter]->incoming_messages[$current_msg_id]['content']['bad_msg_id']]['response'] = $current_msg_id;
break;
case 'pong':
$this->check_in_seq_no($datacenter, $current_msg_id);

View File

@ -33,7 +33,11 @@ class TLConstructor
public function add($json_dict, $scheme_type)
{
if (isset($this->by_id[$json_dict['id']]) && (!isset($this->by_id[$json_dict['id']]['layer']) || $this->by_id[$json_dict['id']]['layer'] > $json_dict['layer'])) return false;
$predicate = (string) (($scheme_type === 'mtproto' && $json_dict['predicate'] === 'message' ? 'MT' : '').$json_dict['predicate']);
$this->by_id[$json_dict['id']] = ['predicate' => $predicate, 'params' => $json_dict['params'], 'type' => ($scheme_type === 'mtproto' && $json_dict['type'] === 'Message' ? 'MT' : '').$json_dict['type']];
if ($scheme_type === 'secret') {
$this->by_id[$json_dict['id']]['layer'] = $json_dict['layer'];
@ -51,7 +55,6 @@ class TLConstructor
foreach ($this->by_id as $id => $constructor) {
if ($constructor['type'] === $type) {
$constructor['id'] = $id;
$constructor['params'] = $constructor['params'];
return $constructor;
}
@ -77,14 +80,12 @@ class TLConstructor
}
$constructor = $this->by_id[$chosenid];
$constructor['id'] = $chosenid;
$constructor['params'] = $constructor['params'];
return $constructor;
}
if (isset($this->by_predicate_and_layer[$predicate])) {
$constructor = $this->by_id[$this->by_predicate_and_layer[$predicate]];
$constructor['id'] = $this->by_predicate_and_layer[$predicate];
$constructor['params'] = $constructor['params'];
return $constructor;
}
@ -97,7 +98,6 @@ class TLConstructor
if (isset($this->by_id[$id])) {
$constructor = $this->by_id[$id];
$constructor['id'] = $id;
$constructor['params'] = $constructor['params'];
return $constructor;
}