feat(onebot): TierB ③ followup — doubt-buddy reject path (delDoubtBuddyReq)

set_doubt_friends_add_request with approve:false now rejects/declines via
delDoubtBuddyReq instead of erroring. RE'd from QQNT wrapper.linux.node
(DoubtBuddyDelWorker ctor sub_3F3F320 → OIDB 0xd69_0; EncodeRequest
sub_3F3E860 body {1: varint const 3 (op discriminator; get uses 1),
3:{1: string uid}}, uid from kernel attr 21001). uin-form (reserved=1).
Adversarially IDA-verified; byte-oracle locks the tags. Split out as its
own commit because the approve-only 0xd69_0 work was already pushed.
This commit is contained in:
DrSmoothl committed 2026-06-18 22:18:08 +08:00
1 parent 43cd4a0b99
commit 7ea1ffb497
8 files changed
+114 -15

No files matched your search

+11 -10
View File
@@ -1080,8 +1080,10 @@ export const actions = [
}
},
}),
// set_doubt_friends_add_request — approve a 可疑好友申请 (0xd69_0). `flag` is
// the uid from the get list. NapCat only supports approve (no reject path).
// set_doubt_friends_add_request — handle a 可疑好友申请 (0xd69_0). `flag` is
// the uid from the get list. approve → approvalDoubtBuddyReq; approve:false
// → delDoubtBuddyReq (reject/decline). NapCat only ever approves; we add the
// reject path since we RE'd delDoubtBuddyReq too.
defineAction({
name: 'set_doubt_friends_add_request',
summary: '处理可疑好友申请',
@@ -1090,15 +1092,14 @@ export const actions = [
approve: f.bool().default(true),
},
run: async (p, ctx) => {
// Only approve is RE'd (reject would be a separate delDoubtBuddyReq cmd
// we haven't recovered). Reject explicitly rather than silently approve
// — accepting approve:false then approving anyway would be the opposite
// of the caller's intent.
if (!p.approve) {
return failedResponse(RETCODE.ACTION_FAILED, 'rejecting a doubt request (delDoubtBuddyReq) is not implemented');
}
// approve → approvalDoubtBuddyReq (0xd69_0); reject → delDoubtBuddyReq
// (also 0xd69_0, distinct body) — both RE'd from the binary.
try {
await ctx.bridge.apis.friend.approveDoubtRequest(p.flag);
if (p.approve) {
await ctx.bridge.apis.friend.approveDoubtRequest(p.flag);
} else {
await ctx.bridge.apis.friend.rejectDoubtRequest(p.flag);
}
return okResponse();
} catch (e) {
return failedResponse(RETCODE.ACTION_FAILED, e instanceof Error ? e.message : String(e));
@@ -943,11 +943,13 @@ describe('extended-actions / TierB ③ share + doubt + robot-option', () => {
expect(res).toMatchObject({ status: 'ok' });
});
it('set_doubt_friends_add_request rejects approve:false instead of silently approving', async () => {
it('set_doubt_friends_add_request with approve:false calls rejectDoubtRequest (not approve)', async () => {
const approveDoubtRequest = vi.fn(async () => {});
const bridge = fakeBridge({ apis: { friend: { approveDoubtRequest } } });
const rejectDoubtRequest = vi.fn(async () => {});
const bridge = fakeBridge({ apis: { friend: { approveDoubtRequest, rejectDoubtRequest } } });
const res = await makeHandler(fakeCtx(bridge)).handle('set_doubt_friends_add_request', { flag: 'u_abc', approve: false });
expect(res.status).toBe('failed');
expect(res).toMatchObject({ status: 'ok' });
expect(rejectDoubtRequest).toHaveBeenCalledWith('u_abc');
expect(approveDoubtRequest).not.toHaveBeenCalled();
});