1
0
Fork 0
forked from External/ergo

switch to redis pubsub for ipc

adjust commands to utilize channel names
add new config variables
fix mention race condition
This commit is contained in:
CEF Server 2024-08-27 14:49:05 +00:00
parent 64ebb1f480
commit f4c03b6765
12 changed files with 220 additions and 195 deletions

View file

@ -572,7 +572,7 @@ func batchHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respon
rb.Label = batch.responseLabel
for _, msg := range batch.message.Split {
signatures := utils.GenerateImagorSignatures(msg.Message)
signatures := server.GenerateImagorSignatures(msg.Message)
if len(signatures) > 0 {
if msg.Tags == nil {
msg.Tags = make(map[string]string)
@ -2328,7 +2328,7 @@ func messageHandler(server *Server, client *Client, msg ircmsg.Message, rb *Resp
// each target gets distinct msgids
splitMsg := utils.MakeMessage(message)
signatures := utils.GenerateImagorSignaturesFromMessage(&msg)
signatures := server.GenerateImagorSignaturesFromMessage(&msg)
if len(signatures) > 0 {
if clientOnlyTags == nil {
clientOnlyTags = make(map[string]string)
@ -2397,7 +2397,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
for _, mention := range mentions {
user := client.server.clients.Get(mention)
if user != nil {
client.server.cefManager.CEFMessage("MENTION", user.nickCasefolded, channel.Name(), message.Msgid)
user.RedisBroadcast("MENTION", channel.Name(), message.Msgid)
}
}
} else if target[0] == '$' && len(target) > 2 && client.Oper().HasRoleCapab("massmessage") {
@ -2524,7 +2524,8 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
}
client.addHistoryItem(user, item, &details, &tDetails, config)
client.server.cefManager.CEFMessage("MENTION", user.nickCasefolded, client.nick, message.Msgid)
user.RedisBroadcast("MENTION", user.NickCasefolded(), message.Msgid)
}
}