Properly clear up messages before resending a copy
This commit is contained in:
parent
a9bf26c9c0
commit
f516a59082
@ -68,6 +68,9 @@ class SecretHandler extends \danog\MadelineProto\EventHandler
|
||||
if ($update['message']['message'] === 'request') {
|
||||
yield $this->requestSecretChat($update);
|
||||
}
|
||||
if ($update['message']['message'] === 'ping') {
|
||||
yield $this->messages->sendMessage(['message' => 'lmao', 'peer' => $update]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Handle secret chat messages.
|
||||
|
@ -49,7 +49,7 @@ class IncomingMessage extends Message
|
||||
'future_salts' => 'req_msg_id',
|
||||
'msgs_state_info' => 'req_msg_id',
|
||||
'bad_server_salt' => 'bad_msg_id',
|
||||
'bad_message_notification' => 'bad_msg_id',
|
||||
'bad_msg_notification' => 'bad_msg_id',
|
||||
'pong' => 'msg_id',
|
||||
];
|
||||
/**
|
||||
|
@ -271,8 +271,12 @@ trait ResponseHandler
|
||||
}
|
||||
if (\strpos($response['error_message'], 'FILE_REFERENCE_') === 0) {
|
||||
$this->logger->logger("Got {$response['error_message']}, refreshing file reference and repeating method call...");
|
||||
$this->gotResponseForOutgoingMessage($request);
|
||||
$msgId = $request->getMsgId();
|
||||
$request->setRefreshReferences(true);
|
||||
$this->methodRecall('', ['message_id' => $request->getMsgId(), 'postpone' => true]);
|
||||
$request->setMsgId(null);
|
||||
$request->setSeqNo(null);
|
||||
$this->methodRecall('', ['message_id' => $msgId, 'postpone' => true]);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -384,10 +388,11 @@ trait ResponseHandler
|
||||
if (\is_numeric($seconds) && $seconds < $limit) {
|
||||
$this->logger->logger("Flood, waiting $seconds seconds before repeating async call of $request...", Logger::NOTICE);
|
||||
$this->gotResponseForOutgoingMessage($request);
|
||||
$msgId = $request->getMsgId();
|
||||
$request->setSent(($request->getSent() ?? \time()) + $seconds);
|
||||
$request->setMsgId(null);
|
||||
$request->setSeqNo(null);
|
||||
Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $request->getMsgId()]);
|
||||
Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $msgId]);
|
||||
return null;
|
||||
}
|
||||
// no break
|
||||
|
Loading…
Reference in New Issue
Block a user