mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-22 07:07:53 +00:00
fix(event): fix chrononeko/bugtracker#66
This commit is contained in:
parent
7aba764c05
commit
2a8a2855c0
@ -39,7 +39,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
if (!d.length) return
|
||||
const e = d[0]
|
||||
if (!e || !('cmdName' in e)) return
|
||||
void responseDispatcher(ctx, e.cmdName, e.payload)
|
||||
void responseDispatcher(ctx, data.channel, e.cmdName, e.payload)
|
||||
return
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
const method = req[0]
|
||||
requestMethodMap[data.id] = method
|
||||
|
||||
void requestDispatcher(ctx, method, req.slice(1))
|
||||
void requestDispatcher(ctx, data.channel, method, req.slice(1))
|
||||
|
||||
return
|
||||
}
|
||||
@ -62,6 +62,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
delete requestMethodMap[data.id]
|
||||
void responseDispatcher(
|
||||
ctx,
|
||||
data.channel,
|
||||
method,
|
||||
data.args[1] /* RedIpcDataResponse */,
|
||||
)
|
||||
@ -74,6 +75,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
|
||||
const requestDispatcher = async (
|
||||
ctx: ChronocatContext,
|
||||
_channel: string,
|
||||
method: string,
|
||||
payload: unknown,
|
||||
) => {
|
||||
@ -103,6 +105,7 @@ const requestDispatcher = async (
|
||||
|
||||
const responseDispatcher = async (
|
||||
ctx: ChronocatContext,
|
||||
_channel: string,
|
||||
method: string,
|
||||
payload: unknown,
|
||||
) => {
|
||||
|
@ -34,7 +34,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
if (!d.length) return
|
||||
const e = d[0]
|
||||
if (!e || !('cmdName' in e)) return
|
||||
void dispatcher(ctx, e.cmdName, e.payload)
|
||||
void dispatcher(ctx, data.channel, e.cmdName, e.payload)
|
||||
return
|
||||
}
|
||||
|
||||
@ -47,7 +47,12 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
const method = requestMethodMap[data.id]
|
||||
if (!method) return
|
||||
delete requestMethodMap[data.id]
|
||||
void dispatcher(ctx, method, data.args[1] /* RedIpcDataResponse */)
|
||||
void dispatcher(
|
||||
ctx,
|
||||
data.channel,
|
||||
method,
|
||||
data.args[1] /* RedIpcDataResponse */,
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -55,12 +60,15 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
||||
|
||||
const dispatcher = async (
|
||||
ctx: ChronocatContext,
|
||||
channel: string,
|
||||
method: string,
|
||||
payload: unknown,
|
||||
) => {
|
||||
switch (method) {
|
||||
case 'nodeIKernelMsgListener/onRecvActiveMsg':
|
||||
case 'nodeIKernelMsgListener/onRecvMsg': {
|
||||
if (channel !== 'IPC_DOWN_2') return
|
||||
|
||||
const { msgList } = payload as OnRecvMsg
|
||||
|
||||
for (const msg of msgList) {
|
||||
@ -198,6 +206,8 @@ const dispatcher = async (
|
||||
}
|
||||
|
||||
case 'nodeIKernelBuddyListener/onBuddyReqChange': {
|
||||
if (channel !== 'IPC_DOWN_2') return
|
||||
|
||||
const { buddyReqs } = payload as OnBuddyReqChange
|
||||
|
||||
buddyReqs.forEach((x) => {
|
||||
@ -233,6 +243,8 @@ const dispatcher = async (
|
||||
ctx.chronocat.uix.add(msg.peerUid, msg.peerUin)
|
||||
}
|
||||
|
||||
if (channel !== 'IPC_DOWN_2') return
|
||||
|
||||
msgList
|
||||
.filter((x) => x.sendStatus > 1 && sendQueue.find((y) => x.msgId === y))
|
||||
.forEach((x) => {
|
||||
|
Loading…
Reference in New Issue
Block a user