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

@ -1079,7 +1079,7 @@ func (server *Server) ForgetHistory(accountName string) {
return
}
predicate := func(item *history.Item) bool { return item.AccountName == accountName }
predicate := func(item *history.Item) bool { return item.Account == accountName }
for _, channel := range server.channels.Channels() {
channel.history.Delete(predicate)
@ -1093,7 +1093,7 @@ func (server *Server) ForgetHistory(accountName string) {
// deletes a message. target is a hint about what buffer it's in (not required for
// persistent history, where all the msgids are indexed together). if accountName
// is anything other than "*", it must match the recorded AccountName of the message
func (server *Server) DeleteMessage(target, msgid, accountName string) (err error) {
func (server *Server) DeleteMessage(target, msgid, account string) (err error) {
config := server.Config()
var hist *history.Buffer
@ -1116,10 +1116,10 @@ func (server *Server) DeleteMessage(target, msgid, accountName string) (err erro
}
if hist == nil {
err = server.historyDB.DeleteMsgid(msgid, accountName)
err = server.historyDB.DeleteMsgid(msgid, account)
} else {
count := hist.Delete(func(item *history.Item) bool {
return item.Message.Msgid == msgid && (accountName == "*" || item.AccountName == accountName)
return item.Message.Msgid == msgid && (account == "*" || item.Account == account)
})
if count == 0 {
err = errNoop