fix(protocol): decode nested group operators

Recognize both raw UTF-8 UIDs and nested OperatorInfo envelopes in GroupChange pushes while keeping self-kick and voluntary-leave semantics explicit.\n\nFixes #253.
This commit is contained in:
DrSmoothl committed 2026-07-20 14:08:50 +08:00
1 parent ae6093cf23
commit 2dbd321ef0
3 files changed
+56 -5

No files matched your search

@@ -139,6 +139,15 @@ export function decodeNestedOperatorUid(bytes: Uint8Array, context: string): str
return assertOperatorUid(uid, context, bytes);
}
const OPERATOR_INFO_FIELD_TAG = 0x0a;
export function decodeGroupChangeOperatorUid(bytes: Uint8Array, context: string): string {
if (!bytes || bytes.length === 0) return '';
return bytes[0] === OPERATOR_INFO_FIELD_TAG
? decodeNestedOperatorUid(bytes, context)
: decodeRawOperatorUid(bytes, context);
}
export function buildTemplateMap(params: Array<{ name?: string; value?: string }>): Map<string, string> {
const map = new Map<string, string>();
for (const p of params) {