diff --git a/src/ntqqapi/hook.ts b/src/ntqqapi/hook.ts index 48f8047..b08b073 100644 --- a/src/ntqqapi/hook.ts +++ b/src/ntqqapi/hook.ts @@ -24,7 +24,8 @@ export enum ReceiveCmd { MEDIA_DOWNLOAD_COMPLETE = "nodeIKernelMsgListener/onRichMediaDownloadComplete", UNREAD_GROUP_NOTIFY = "nodeIKernelGroupListener/onGroupNotifiesUnreadCountUpdated", GROUP_NOTIFY = "nodeIKernelGroupListener/onGroupSingleScreenNotifies", - FRIEND_REQUEST = "nodeIKernelBuddyListener/onBuddyReqChange" + FRIEND_REQUEST = "nodeIKernelBuddyListener/onBuddyReqChange", + CACHE_SCAN_FINISH = "nodeIKernelStorageCleanListener/onFinishScan", } interface NTQQApiReturnData<PayloadType = unknown> extends Array<any> { diff --git a/src/ntqqapi/ntcall.ts b/src/ntqqapi/ntcall.ts index 80a81f0..da6276f 100644 --- a/src/ntqqapi/ntcall.ts +++ b/src/ntqqapi/ntcall.ts @@ -16,6 +16,7 @@ import { SelfInfo, SendMessageElement, User, + CacheScanResult, ChatCacheList, ChatCacheListItemBasic } from "./types"; @@ -79,7 +80,7 @@ export enum NTQQApiMethod { CACHE_PATH_HOT_UPDATE = 'getHotUpdateCachePath', // TODO: Unused method CACHE_PATH_DESKTOP_TEMP = 'getDesktopTmpPath', // TODO: Unused method CACHE_PATH_SESSION = 'getCleanableAppSessionPathList', // TODO: Unused method - CACHE_SCAN = 'nodeIKernelStorageCleanService/scanCache', + CACHE_SCAN = 'nodeIKernelStorageCleanService/scanCache', CACHE_CLEAR = '', // TODO CACHE_CHAT_SCAN = 'nodeIKernelStorageCleanService/getChatCacheInfo', @@ -707,6 +708,20 @@ export class NTQQApi { }); } + static scanCache() { + callNTQQApi<GeneralCallResult>({ + channel: NTQQApiChannel.IPC_UP_3, + methodName: ReceiveCmd.CACHE_SCAN_FINISH, + classNameIsRegister: true, + }).then(); + return callNTQQApi<CacheScanResult>({ + channel: NTQQApiChannel.IPC_UP_3, + methodName: NTQQApiMethod.CACHE_SCAN, + args: [null, null], + timeoutSecond: 300, + }); + } + static getChatCacheList(type: 1 | 2, pageSize: number = 80, pageIndex: number = 0) { return new Promise<ChatCacheList>((res, rej) => { callNTQQApi<ChatCacheList>({ diff --git a/src/ntqqapi/types.ts b/src/ntqqapi/types.ts index 4eccd77..01e0a19 100644 --- a/src/ntqqapi/types.ts +++ b/src/ntqqapi/types.ts @@ -355,6 +355,22 @@ export interface FriendRequestNotify { buddyReqs: FriendRequest[] } } + +export interface CacheScanResult { + result: number, + size: [ // 单位为字节 + string, // 系统总存储空间 + string, // 系统可用存储空间 + string, // 系统已用存储空间 + string, // QQ总大小 + string, // 「聊天与文件」大小 + string, // 未知 + string, // 「缓存数据」大小 + string, // 「其他数据」大小 + string, // 未知 + ] +} + export interface ChatCacheList { pageCount: number, infos: ChatCacheListItem[] @@ -372,5 +388,7 @@ export interface ChatCacheListItemBasic { uid: string, uin: string, remarkName: string, - nickName: string + nickName: string, + chatType?: 1 | 2, + isChecked?: boolean }