fix(protocol): apply member permission updates on the correct group setting command
set_group_member_permissions was still rejected after the privilege flag read was corrected. Album, temporary-session, and create-group writes use a different 0x89A variant than invite policy. Closes #392
This commit is contained in:
4 files changed
+21
-9
No files matched your search
@@ -440,9 +440,9 @@ describe('apis/group-admin', () => {
|
||||
|
||||
expect(bridge.sendRawPacket.mock.calls.map((call) => call[0])).toEqual([
|
||||
'OidbSvcTrpcTcp.0x88d_0',
|
||||
'OidbSvcTrpcTcp.0x89a_0',
|
||||
'OidbSvcTrpcTcp.0x89a_0',
|
||||
'OidbSvcTrpcTcp.0x89a_0',
|
||||
'OidbSvcTrpcTcp.0x89a_8',
|
||||
'OidbSvcTrpcTcp.0x89a_8',
|
||||
'OidbSvcTrpcTcp.0x89a_8',
|
||||
'OidbSvcTrpcTcp.0x88d_0',
|
||||
]);
|
||||
|
||||
@@ -475,9 +475,11 @@ describe('apis/group-admin', () => {
|
||||
allowMemberUploadAlbum: true,
|
||||
});
|
||||
|
||||
expect(bridge.sendRawPacket.mock.calls[1]![0]).toBe('OidbSvcTrpcTcp.0x89a_8');
|
||||
const envelope = protobuf_decode<OidbBase<Oidb0x89a_0MemberPermission>>(
|
||||
bridge.sendRawPacket.mock.calls[1]![1],
|
||||
);
|
||||
expect(envelope.subCommand).toBe(8);
|
||||
expect(envelope.body?.settings).toEqual({
|
||||
appPrivilegeFlag: 0,
|
||||
appPrivilegeMask: 1,
|
||||
|
||||
@@ -86,8 +86,9 @@ export interface Oidb0x89a_0HistoryVisibility {
|
||||
settings?: pb<2, Oidb0x89a_0HistoryVisibilitySettings>;
|
||||
field12?: pb<12, uint_32>;
|
||||
}
|
||||
// 0x89A_0 — one masked group-member capability update. These are deny bits,
|
||||
// 0x89A_8 — one masked group-member capability update. These are deny bits,
|
||||
// so callers clear the selected bit to allow a capability and set it to deny.
|
||||
// Same settings tags as invite policy; the command variant is what differs.
|
||||
export interface Oidb0x89a_0MemberPermissionSettings {
|
||||
appPrivilegeFlag?: pb_optional<23, uint_32>;
|
||||
appPrivilegeMask?: pb_optional<24, uint_32>;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 0x89A_0 — update one member capability through the appPrivilegeFlag deny
|
||||
// bits. Current QQ applies one selected mask per operation; callers that change
|
||||
// multiple capabilities must invoke this namespace sequentially.
|
||||
// 0x89A_8 — update one member capability through the appPrivilegeFlag deny
|
||||
// bits. Invite policy shares the same settings tags on 0x89A_0; album /
|
||||
// temporary-session / create-group writes use this variant. Current QQ applies
|
||||
// one selected mask per operation; callers that change multiple capabilities
|
||||
// must invoke this namespace sequentially.
|
||||
|
||||
import { protobuf_decode, protobuf_encode } from '@snowluma/proton';
|
||||
import type { OidbBase, OidbEmpty } from '@snowluma/proto-defs/oidb';
|
||||
@@ -50,7 +52,7 @@ export function decodeGroupMemberPermissions(privilegeFlag: number): {
|
||||
|
||||
export namespace SetMemberPermission {
|
||||
export const command = 0x89A;
|
||||
export const subCommand = 0;
|
||||
export const subCommand = 8;
|
||||
|
||||
export interface Params {
|
||||
groupId: number;
|
||||
|
||||
@@ -24,6 +24,11 @@ function makeSender() {
|
||||
}
|
||||
|
||||
describe('SetMemberPermission namespace', () => {
|
||||
it('declares 0x89A_8', () => {
|
||||
expect(SetMemberPermission.command).toBe(0x89A);
|
||||
expect(SetMemberPermission.subCommand).toBe(8);
|
||||
});
|
||||
|
||||
it.each<[GroupMemberPermission, number]>([
|
||||
['upload_album', 0x1],
|
||||
['temporary_session', 0x10000],
|
||||
@@ -39,8 +44,10 @@ describe('SetMemberPermission namespace', () => {
|
||||
});
|
||||
|
||||
const [command, bytes] = sender.sendRawPacket.mock.calls[0]!;
|
||||
expect(command).toBe('OidbSvcTrpcTcp.0x89a_0');
|
||||
expect(command).toBe('OidbSvcTrpcTcp.0x89a_8');
|
||||
const envelope = protobuf_decode<OidbBase<Oidb0x89a_0MemberPermission>>(bytes);
|
||||
expect(envelope.command).toBe(0x89A);
|
||||
expect(envelope.subCommand).toBe(8);
|
||||
expect(envelope.body).toMatchObject({
|
||||
groupUin: 12345n,
|
||||
settings: {
|
||||
|
||||
Reference in new issue
Block a user