1
0
Fork 0
forked from External/ergo

complete database reivision

This commit is contained in:
CEF Server 2024-11-28 02:58:14 +00:00
parent d26235e9a9
commit d73b6bac86
10 changed files with 203 additions and 353 deletions

View file

@ -1926,11 +1926,12 @@ func announceCmodeChanges(channel *Channel, applied modes.ModeChanges, source, a
}
}
channel.AddHistoryItem(history.Item{
Type: history.Mode,
Nick: source,
AccountName: accountName,
Message: message,
IsBot: isBot,
Type: history.Mode,
Nick: source,
Account: accountName,
Message: message,
Target: channel.NameCasefolded(),
IsBot: isBot,
}, account)
}
}
@ -2443,6 +2444,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
}
}
} else {
// PMs
lowercaseTarget := strings.ToLower(target)
service, isService := ErgoServices[lowercaseTarget]
_, isZNC := zncHandlers[lowercaseTarget]
@ -2542,6 +2544,8 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
Type: histType,
Message: message,
Tags: tags,
Target: user.Account(),
Account: client.Account(),
}
client.addHistoryItem(user, item, &details, &tDetails, config)
@ -2862,16 +2866,16 @@ func redactHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
rb.Add(nil, server.name, "FAIL", "REDACT", "REDACT_FORBIDDEN", utils.SafeErrorParam(target), utils.SafeErrorParam(targetmsgid), client.t("You are not authorized to delete messages"))
return false
}
accountName := "*"
account := "*"
if canDelete == canDeleteSelf {
accountName = client.AccountName()
if accountName == "*" {
account = client.account
if account == "*" {
rb.Add(nil, server.name, "FAIL", "REDACT", "REDACT_FORBIDDEN", utils.SafeErrorParam(target), utils.SafeErrorParam(targetmsgid), client.t("You are not authorized to delete this message"))
return false
}
}
err := server.DeleteMessage(target, targetmsgid, accountName)
err := server.DeleteMessage(target, targetmsgid, account)
if err == errNoop {
rb.Add(nil, server.name, "FAIL", "REDACT", "UNKNOWN_MSGID", utils.SafeErrorParam(target), utils.SafeErrorParam(targetmsgid), client.t("This message does not exist or is too old"))
return false
@ -2888,7 +2892,7 @@ func redactHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respo
if target[0] != '#' {
// If this is a PM, we just removed the message from the buffer of the other party;
// now we have to remove it from the buffer of the client who sent the REDACT command
err := server.DeleteMessage(client.Nick(), targetmsgid, accountName)
err := server.DeleteMessage(client.Nick(), targetmsgid, account)
if err != nil {
client.server.logger.Error("internal", fmt.Sprintf("Private message %s is not deletable by %s from their own buffer's even though we just deleted it from %s's. This is a bug, please report it in details.", targetmsgid, client.Nick(), target), client.Nick())
@ -3214,6 +3218,8 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res
Type: history.Privmsg,
Message: message,
Nick: nuh,
Target: channel.NameCasefolded(),
Account: "$RELAYMSG",
}, "")
// 3 possibilities for tags: