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

@ -651,7 +651,7 @@ func (client *Client) run(session *Session) {
firstLine := !isReattach
correspondents, _ := client.server.historyDB.GetPMs(client.NickCasefolded())
correspondents, _ := client.server.historyDB.GetPMs(client.Account())
// For safety, let's keep this within the 4096 character barrier
var lineBuilder utils.TokenLineBuilder
lineBuilder.Initialize(MaxLineLen, ",")
@ -903,7 +903,7 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
continue
}
if hasEventPlayback {
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, item.IsBot, nil, "INVITE", nick, item.Message.Message)
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.Account, item.IsBot, nil, "INVITE", nick, item.Message.Message)
} else {
rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", fmt.Sprintf(client.t("%[1]s invited you to channel %[2]s"), NUHToNick(item.Nick), item.Message.Message))
}
@ -931,11 +931,11 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
tags = item.Tags
}
if !isSelfMessage(&item) {
rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.IsBot, tags, command, nick, item.Message)
rb.AddSplitMessageFromClient(item.Nick, item.Account, item.IsBot, tags, command, nick, item.Message)
} else {
// this message was sent *from* the client to another nick; the target is item.Params[0]
// substitute client's current nickmask in case client changed nick
rb.AddSplitMessageFromClient(details.nickMask, item.AccountName, item.IsBot, tags, command, item.Params[0], item.Message)
rb.AddSplitMessageFromClient(details.nickMask, item.Account, item.IsBot, tags, command, item.Params[0], item.Message)
}
}
@ -1365,11 +1365,11 @@ func (client *Client) destroy(session *Session) {
splitQuitMessage := utils.MakeMessage(quitMessage)
isBot := client.HasMode(modes.Bot)
quitItem = history.Item{
Type: history.Quit,
Nick: details.nickMask,
AccountName: details.accountName,
Message: splitQuitMessage,
IsBot: isBot,
Type: history.Quit,
Nick: details.nickMask,
Account: details.accountName,
Message: splitQuitMessage,
IsBot: isBot,
}
var cache MessageCache
cache.Initialize(client.server, splitQuitMessage.Time, splitQuitMessage.Msgid, details.nickMask, details.accountName, isBot, nil, "QUIT", quitMessage)
@ -1690,7 +1690,7 @@ func (client *Client) addHistoryItem(target *Client, item history.Item, details,
}
item.Nick = details.nickMask
item.AccountName = details.accountName
item.Account = details.account
targetedItem := item
targetedItem.Params[0] = tDetails.nick
@ -1698,15 +1698,15 @@ func (client *Client) addHistoryItem(target *Client, item history.Item, details,
tStatus, _ := target.historyStatus(config)
// add to ephemeral history
if cStatus == HistoryEphemeral {
targetedItem.CfCorrespondent = tDetails.nickCasefolded
targetedItem.Target = tDetails.account
client.history.Add(targetedItem)
}
if tStatus == HistoryEphemeral && client != target {
item.CfCorrespondent = details.nickCasefolded
item.Target = target.Account()
target.history.Add(item)
}
if cStatus == HistoryPersistent || tStatus == HistoryPersistent {
targetedItem.CfCorrespondent = ""
targetedItem.Target = target.account
client.server.historyDB.AddDirectMessage(details.nickCasefolded, details.account, tDetails.nickCasefolded, tDetails.account, targetedItem)
}
return nil