fix(protocol): return group join question and answer in admin settings
get_group_admin_settings reported the join mode correctly but left the question and answer blank. The detail request now asks for those strings the same way the official client does. Closes #393
This commit is contained in:
4 files changed
+27
-3
No files matched your search
@@ -11,6 +11,7 @@ import type {
|
||||
Oidb0x89a_0HistoryVisibility,
|
||||
Oidb0x89a_0MemberPermission,
|
||||
Oidb0xf16Req,
|
||||
OidbGroupDetailRequest,
|
||||
OidbGroupRequestAction,
|
||||
OidbKickMember,
|
||||
OidbLeaveGroup,
|
||||
@@ -570,6 +571,11 @@ describe('apis/group-admin', () => {
|
||||
'OidbSvcTrpcTcp.0x88d_0',
|
||||
'OidbSvcTrpcTcp.0xef0_1',
|
||||
]);
|
||||
const detailReq = protobuf_decode<OidbBase<OidbGroupDetailRequest>>(
|
||||
bridge.sendRawPacket.mock.calls.find((call) => call[0] === 'OidbSvcTrpcTcp.0x88d_0')![1],
|
||||
);
|
||||
expect(detailReq.body?.config?.flags?.question).toBe('');
|
||||
expect(detailReq.body?.config?.flags?.answer).toBe('');
|
||||
});
|
||||
|
||||
it('getAdminSettings treats omitted detail/ext zeros as the default values', async () => {
|
||||
|
||||
@@ -358,8 +358,11 @@ export interface OidbGroupDetailFlags {
|
||||
uin?: pb<21, bool>;
|
||||
lastSequence?: pb<22, bool>;
|
||||
lastMessageTime?: pb<23, bool>;
|
||||
question?: pb<24, bool>;
|
||||
answer?: pb<25, string>;
|
||||
// EncodeSingleGroupInfoParamByBaseFilter writes these as empty strings
|
||||
// (length-delimited). A bool true is a different wire type and the
|
||||
// server ignores it; a plain pb<> empty string is omitted.
|
||||
question?: pb_optional<24, string>;
|
||||
answer?: pb_optional<25, string>;
|
||||
maxAdminCount?: pb<29, string>;
|
||||
// Official request mask for group shutup expire (proto tag 45 → 60027).
|
||||
// Lagrange's tag 59 requests 60259, which is a different field.
|
||||
|
||||
@@ -31,7 +31,7 @@ export namespace FetchGroupDetail {
|
||||
flags: {
|
||||
ownerUid: on, createTime: on, maxMemberCount: on, memberCount: on,
|
||||
level: on, name: '', noticePreview: '', uin: on, lastSequence: on,
|
||||
lastMessageTime: on, question: on, answer: '', maxAdminCount: '',
|
||||
lastMessageTime: on, question: '', answer: '', maxAdminCount: '',
|
||||
// Tag 45 (not Lagrange's 59): official request mask for 60027.
|
||||
shutUpAllTimestamp: on, addType: on, privilegeFlag: on, groupFlagExt4: on,
|
||||
noFingerOpen: on, noCodeFingerOpen: on,
|
||||
|
||||
@@ -63,6 +63,8 @@ describe('FetchGroupDetail namespace', () => {
|
||||
expect(out.config?.flags?.addType).toBe(true);
|
||||
expect(out.config?.flags?.noFingerOpen).toBe(true);
|
||||
expect(out.config?.flags?.noCodeFingerOpen).toBe(true);
|
||||
expect(out.config?.flags?.question).toBe('');
|
||||
expect(out.config?.flags?.answer).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,6 +87,19 @@ describe('FetchGroupDetail namespace', () => {
|
||||
expect(env.subCommand ?? 0).toBe(0); // proto3 omits the 0 default on the wire
|
||||
expect(env.reserved ?? 0).toBe(0); // NOT uin-form
|
||||
expect(env.body?.config?.uin).toBe(BigInt(601692726));
|
||||
expect(env.body?.config?.flags?.question).toBe('');
|
||||
expect(env.body?.config?.flags?.answer).toBe('');
|
||||
});
|
||||
|
||||
it('keeps empty question/answer masks on the wire (#393)', async () => {
|
||||
const sender = makeSender({ groupInfo: { uin: 1n, results: { name: 'g' } } });
|
||||
await FetchGroupDetail.invoke(sender, { groupUin: 1 });
|
||||
|
||||
const bytes = sender.sendRawPacket.mock.calls[0]![1] as Uint8Array;
|
||||
// length-delimited empty string: field 24/25, wire type 2, length 0.
|
||||
const hex = Buffer.from(bytes).toString('hex');
|
||||
expect(hex).toContain('c20100');
|
||||
expect(hex).toContain('ca0100');
|
||||
});
|
||||
|
||||
it('returns the decoded group detail (name + counts)', async () => {
|
||||
|
||||
Reference in new issue
Block a user