This commit is contained in:
idranme 2024-09-21 20:19:26 +08:00
parent 08e7e471d6
commit 0c456e2160
No known key found for this signature in database
GPG Key ID: 926F7B5B668E495F
6 changed files with 21 additions and 27 deletions

View File

@ -41,7 +41,7 @@
"electron-vite": "^2.3.0",
"protobufjs-cli": "^1.1.3",
"typescript": "^5.6.2",
"vite": "^5.4.6",
"vite": "^5.4.7",
"vite-plugin-cp": "^4.0.8"
},
"packageManager": "yarn@4.4.1"

View File

@ -12,8 +12,9 @@ export function calcQQLevel(level: QQLevel) {
/** QQ Build Version */
export function getBuildVersion(): number {
const version: string = globalThis.LiteLoader.versions.qqnt
return +version.split('-')[1]
//const version: string = globalThis.LiteLoader.versions.qqnt
//return +version.split('-')[1]
return +globalThis.LiteLoader.package.qqnt.buildVersion
}
/** 在保证老对象已有的属性不变化的情况下将新对象的属性复制到老对象 */

View File

@ -50,7 +50,7 @@ export class NTQQMsgApi extends Service {
}
async activateChat(peer: Peer) {
return await invoke<GeneralCallResult>(NTMethod.ACTIVE_CHAT_PREVIEW, [{ peer, cnt: 20 }, null])
return await invoke<GeneralCallResult>(NTMethod.ACTIVE_CHAT_PREVIEW, [{ peer, cnt: 1 }, null])
}
async activateChatAndGetHistory(peer: Peer) {

View File

@ -1,4 +1,4 @@
import fs from 'node:fs'
import { unlink } from 'node:fs/promises'
import { Service, Context } from 'cordis'
import { registerCallHook, registerReceiveHook, ReceiveCmdS } from './hook'
import { Config as LLOBConfig } from '../common/types'
@ -13,7 +13,6 @@ import {
GroupMember,
CategoryFriend,
SimpleInfo,
User,
ChatType
} from './types'
import { selfInfo } from '../common/globalVars'
@ -53,29 +52,24 @@ class Core extends Service {
private registerListener() {
registerReceiveHook<{
data: CategoryFriend[]
data?: CategoryFriend[]
userSimpleInfos?: Map<string, SimpleInfo> //V2
buddyCategory?: CategoryFriend[] //V2
}>(ReceiveCmdS.FRIENDS, (payload) => {
type V2data = { userSimpleInfos: Map<string, SimpleInfo> }
let friendList: User[] = []
if ('userSimpleInfos' in payload) {
friendList = Object.values((payload as unknown as V2data).userSimpleInfos).map((v: SimpleInfo) => {
return {
...v.coreInfo,
}
})
} else {
for (const fData of payload.data) {
friendList.push(...fData.buddyList)
}
let uids: string[] = []
if (payload.buddyCategory) {
uids = payload.buddyCategory.flatMap(item => item.buddyUids)
} else if (payload.data) {
uids = payload.data.flatMap(item => item.buddyList.map(e => e.uid))
}
this.ctx.logger.info('好友列表变动', friendList.length)
for (const friend of friendList) {
this.ctx.ntMsgApi.activateChat({ peerUid: friend.uid, chatType: ChatType.friend })
for (const uid of uids) {
this.ctx.ntMsgApi.activateChat({ peerUid: uid, chatType: ChatType.friend })
}
this.ctx.logger.info('好友列表变动', uids.length)
})
// 自动清理新消息文件
registerReceiveHook<{ msgList: Array<RawMessage> }>([ReceiveCmdS.NEW_MSG, ReceiveCmdS.NEW_ACTIVE_MSG], (payload) => {
registerReceiveHook<{ msgList: RawMessage[] }>([ReceiveCmdS.NEW_MSG, ReceiveCmdS.NEW_ACTIVE_MSG], (payload) => {
if (!this.config.autoDeleteFile) {
return
}
@ -94,9 +88,7 @@ class Core extends Service {
}
for (const path of pathList) {
if (path) {
fs.unlink(path, () => {
this.ctx.logger.info('删除文件成功', path)
})
unlink(path).then(() => this.ctx.logger.info('删除文件成功', path))
}
}
}, this.config.autoDeleteFileSecond! * 1000)

View File

@ -8,7 +8,7 @@ export enum BuddyListReqType {
export interface NodeIKernelBuddyService {
getBuddyListV2(callFrom: string, reqType: BuddyListReqType): Promise<GeneralCallResult & {
data: {
categoryId: number //9999疑似兜底数据
categoryId: number
categorySortId: number
categroyName: string
categroyMbCount: number

View File

@ -394,6 +394,7 @@ export namespace OB11Entities {
}
}
if (grayTipElement.xmlElement?.templId === '10229' || grayTipElement.jsonGrayTipElement?.busiId === '19324') {
ctx.logger.info('收到好友添加消息', msg.peerUid)
const uin = +msg.peerUin || +(await ctx.ntUserApi.getUinByUid(msg.peerUid))
return new OB11FriendAddNoticeEvent(uin)
}