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
|
if (!d.length) return
|
||||||
const e = d[0]
|
const e = d[0]
|
||||||
if (!e || !('cmdName' in e)) return
|
if (!e || !('cmdName' in e)) return
|
||||||
void responseDispatcher(ctx, e.cmdName, e.payload)
|
void responseDispatcher(ctx, data.channel, e.cmdName, e.payload)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
const method = req[0]
|
const method = req[0]
|
||||||
requestMethodMap[data.id] = method
|
requestMethodMap[data.id] = method
|
||||||
|
|
||||||
void requestDispatcher(ctx, method, req.slice(1))
|
void requestDispatcher(ctx, data.channel, method, req.slice(1))
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -62,6 +62,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
delete requestMethodMap[data.id]
|
delete requestMethodMap[data.id]
|
||||||
void responseDispatcher(
|
void responseDispatcher(
|
||||||
ctx,
|
ctx,
|
||||||
|
data.channel,
|
||||||
method,
|
method,
|
||||||
data.args[1] /* RedIpcDataResponse */,
|
data.args[1] /* RedIpcDataResponse */,
|
||||||
)
|
)
|
||||||
@ -74,6 +75,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
|
|
||||||
const requestDispatcher = async (
|
const requestDispatcher = async (
|
||||||
ctx: ChronocatContext,
|
ctx: ChronocatContext,
|
||||||
|
_channel: string,
|
||||||
method: string,
|
method: string,
|
||||||
payload: unknown,
|
payload: unknown,
|
||||||
) => {
|
) => {
|
||||||
@ -103,6 +105,7 @@ const requestDispatcher = async (
|
|||||||
|
|
||||||
const responseDispatcher = async (
|
const responseDispatcher = async (
|
||||||
ctx: ChronocatContext,
|
ctx: ChronocatContext,
|
||||||
|
_channel: string,
|
||||||
method: string,
|
method: string,
|
||||||
payload: unknown,
|
payload: unknown,
|
||||||
) => {
|
) => {
|
||||||
|
@ -34,7 +34,7 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
if (!d.length) return
|
if (!d.length) return
|
||||||
const e = d[0]
|
const e = d[0]
|
||||||
if (!e || !('cmdName' in e)) return
|
if (!e || !('cmdName' in e)) return
|
||||||
void dispatcher(ctx, e.cmdName, e.payload)
|
void dispatcher(ctx, data.channel, e.cmdName, e.payload)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,12 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
const method = requestMethodMap[data.id]
|
const method = requestMethodMap[data.id]
|
||||||
if (!method) return
|
if (!method) return
|
||||||
delete requestMethodMap[data.id]
|
delete requestMethodMap[data.id]
|
||||||
void dispatcher(ctx, method, data.args[1] /* RedIpcDataResponse */)
|
void dispatcher(
|
||||||
|
ctx,
|
||||||
|
data.channel,
|
||||||
|
method,
|
||||||
|
data.args[1] /* RedIpcDataResponse */,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,12 +60,15 @@ export const buildHandler = (ctx: ChronocatContext) => (data: IpcManData) => {
|
|||||||
|
|
||||||
const dispatcher = async (
|
const dispatcher = async (
|
||||||
ctx: ChronocatContext,
|
ctx: ChronocatContext,
|
||||||
|
channel: string,
|
||||||
method: string,
|
method: string,
|
||||||
payload: unknown,
|
payload: unknown,
|
||||||
) => {
|
) => {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case 'nodeIKernelMsgListener/onRecvActiveMsg':
|
case 'nodeIKernelMsgListener/onRecvActiveMsg':
|
||||||
case 'nodeIKernelMsgListener/onRecvMsg': {
|
case 'nodeIKernelMsgListener/onRecvMsg': {
|
||||||
|
if (channel !== 'IPC_DOWN_2') return
|
||||||
|
|
||||||
const { msgList } = payload as OnRecvMsg
|
const { msgList } = payload as OnRecvMsg
|
||||||
|
|
||||||
for (const msg of msgList) {
|
for (const msg of msgList) {
|
||||||
@ -198,6 +206,8 @@ const dispatcher = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
case 'nodeIKernelBuddyListener/onBuddyReqChange': {
|
case 'nodeIKernelBuddyListener/onBuddyReqChange': {
|
||||||
|
if (channel !== 'IPC_DOWN_2') return
|
||||||
|
|
||||||
const { buddyReqs } = payload as OnBuddyReqChange
|
const { buddyReqs } = payload as OnBuddyReqChange
|
||||||
|
|
||||||
buddyReqs.forEach((x) => {
|
buddyReqs.forEach((x) => {
|
||||||
@ -233,6 +243,8 @@ const dispatcher = async (
|
|||||||
ctx.chronocat.uix.add(msg.peerUid, msg.peerUin)
|
ctx.chronocat.uix.add(msg.peerUid, msg.peerUin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channel !== 'IPC_DOWN_2') return
|
||||||
|
|
||||||
msgList
|
msgList
|
||||||
.filter((x) => x.sendStatus > 1 && sendQueue.find((y) => x.msgId === y))
|
.filter((x) => x.sendStatus > 1 && sendQueue.find((y) => x.msgId === y))
|
||||||
.forEach((x) => {
|
.forEach((x) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user