fix(bridge): include the reason code for unavailable private message receipts

Show the reported reason when private message receipts are unavailable. Keep the existing warning when the connection supplies no reason.
This commit is contained in:
DrSmoothl
2026-10-31 18:28:05 +08:00
parent 299fa85a74
commit fcbb2661d1
2 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -1378,9 +1378,10 @@ export class QqHookClient extends EventEmitter {
runtimeLog.debug('Client private-message reporting is available: PID=%d', this.pid);
} else {
runtimeLog.warn(
'Client private-message reporting is unavailable: PID=%d status=%d',
'Client private-message reporting is unavailable: PID=%d status=%d%s',
this.pid,
frame.status,
frame.value0 === 0n ? '' : ` reason=${frame.value0}`,
);
}
+10 -1
View File
@@ -218,6 +218,15 @@ describe('QqHookClient client message receipts', () => {
await client.startRecv(onPacket);
const socket = sockets.mock.results[0]!.value;
socket.emit('data', pipeFrame({ op: PipeOp.clientMessageState, status: -1 }));
socket.emit(
'data',
pipeFrame({ op: PipeOp.clientMessageState, status: -1, value0: 42n }),
);
const warning = 'Client private-message reporting is unavailable: PID=12345 status=-1';
expect(entries.map((entry) => entry.message)).toEqual([
warning,
`${warning} reason=42`,
]);
for (const patch of [
{ value0: 0n },
@@ -242,7 +251,7 @@ describe('QqHookClient client message receipts', () => {
entries.filter(
(entry) => entry.scope === 'QQHook.Runtime' && entry.level === 'warn',
),
).toHaveLength(6);
).toHaveLength(7);
socket.emit(
'data',
pipeFrame({ op: PipeOp.recvPacket, cmd: 'normal', message: '10001', value0: 44n }),