Skip to content

Commit b264994

Browse files
committed
Cleanup
1 parent 3261323 commit b264994

1 file changed

Lines changed: 12 additions & 25 deletions

File tree

tools/gen_filerefmap.php

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,20 @@ public function build(TLContext $tl): array
258258
}
259259
}
260260

261-
final class ConditionalEqOp implements Op
261+
final class GetMessageOp implements Op
262262
{
263263
public function __construct(
264-
private readonly Op $subject,
265-
private readonly Op $eq,
266-
private readonly Op $if,
267-
private readonly Op $else
264+
private readonly Op $peer,
265+
private readonly Op $id,
268266
) {
269267
}
270268

271269
public function build(TLContext $tl): array
272270
{
273271
return [
274-
'op' => 'conditional_eq',
275-
'subject' => $this->subject->build($tl),
276-
'eq' => $this->eq->build($tl),
277-
'if' => $this->if->build($tl),
278-
'else' => $this->else->build($tl),
272+
'op' => 'get_message',
273+
'peer' => $this->peer->build($tl),
274+
'id' => $this->id->build($tl),
279275
];
280276
}
281277
}
@@ -339,22 +335,13 @@ public function build(TLContext $tl): array
339335

340336
$recurse = static function (string $type, array $stack = []) use ($TL, &$recurse, &$final, &$locations): void {
341337
if ($type === 'Message') {
342-
foreach (TLContext::getConstructorsOfType($TL, 'Message') as $constructor => $_) {
338+
foreach (TLContext::getConstructorsOfType($TL, $type) as $constructor => $_) {
343339
if ($constructor === 'messageEmpty') {
344340
continue;
345341
}
346-
$locations[$constructor] = new ConditionalEqOp(
347-
new ExtractFromHereOp($constructor, 'peer_id', '_'),
348-
new LiteralOp('peerUser'),
349-
new CallOp('messages.getMessages', ['id' => new ArrayOp(
350-
new ExtractFromHereOp($constructor, 'msg_id'),
351-
)]),
352-
new CallOp('channels.getMessages', [
353-
'id' => new ArrayOp(
354-
new ExtractFromHereOp($constructor, 'msg_id'),
355-
),
356-
'channel' => new GetInputPeerOp(new ExtractFromHereOp($constructor, 'peer_id')),
357-
]),
342+
$locations[$constructor] = new GetMessageOp(
343+
new ExtractFromHereOp($constructor, 'peer_id'),
344+
new ExtractFromHereOp($constructor, 'msg_id'),
358345
);
359346
}
360347
return;
@@ -390,8 +377,8 @@ public function build(TLContext $tl): array
390377
'channels.getAdminLog',
391378
[
392379
'channel' => new GetInputChannelOp(new ExtractFromRootOp('channels.getAdminLog', 'channel')),
393-
'max_id' => new ExtractFromHereOp($type, 'id'),
394-
'min_id' => new ExtractFromHereOp($type, 'id'),
380+
'max_id' => new ExtractFromHereOp('channelAdminLogEvent', 'id'),
381+
'min_id' => new ExtractFromHereOp('channelAdminLogEvent', 'id'),
395382
'limit' => new LiteralOp(1),
396383
]
397384
);

0 commit comments

Comments
 (0)