feat(protocol): decode online device snapshots

Decode Event 0x210 subtype 349 into typed online-device snapshots, including QQ-compatible low-byte client type normalization and one-entry-per-device-category projection.

Keep replacement snapshots outside system-message deduplication, reject malformed device identities observably, and add wire-level regressions for complete, packed, repeated, and invalid payloads. Live verification covered mobile account switching without requiring native changes.
This commit is contained in:
DrSmoothl committed 2026-07-19 19:19:58 +08:00
1 parent e6a69b05a7
commit b92c8ad881
8 files changed
+279 -3

No files matched your search

+23
View File
@@ -486,6 +486,28 @@ export interface FriendInputStatusEvent extends QQEvent {
statusText: string;
}
export type OnlineDeviceKind = 'computer' | 'pad' | 'phone' | 'unknown';
/** One entry from QQ NT's online-device cache notification. */
export interface OnlineDeviceInfo {
appId: number;
instanceId: number;
clientType: number;
platform: number;
deviceName: string;
deviceKind: OnlineDeviceKind;
}
/**
* Full online-device snapshot pushed through Event 0x210 / subType 349.
* Internal-only: Bridge consumes this to maintain the query snapshot; it is
* not forwarded as an OneBot event.
*/
export interface OnlineDevicesChangedEvent extends QQEvent {
kind: 'online_devices_changed';
devices: OnlineDeviceInfo[];
}
export type QQEventVariant =
| FriendMessage
| GroupMessage
@@ -510,4 +532,5 @@ export type QQEventVariant =
| GroupCardChangeEvent
| GroupTitleChangeEvent
| FriendProfileLikeEvent
| OnlineDevicesChangedEvent
| BotOfflineEvent;