mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
make TAGMSG storage configurable
This commit is contained in:
parent
f2d0842453
commit
bca3dd0b41
7 changed files with 74 additions and 26 deletions
|
|
@ -2113,7 +2113,7 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
|||
AccountName: accountName,
|
||||
Tags: tags,
|
||||
}
|
||||
if !item.IsStorable() || !allowedPlusR {
|
||||
if !itemIsStorable(&item, config) || !allowedPlusR {
|
||||
return
|
||||
}
|
||||
targetedItem := item
|
||||
|
|
@ -2136,6 +2136,32 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
|||
}
|
||||
}
|
||||
|
||||
func itemIsStorable(item *history.Item, config *Config) bool {
|
||||
switch item.Type {
|
||||
case history.Tagmsg:
|
||||
if config.History.TagmsgStorage.Default {
|
||||
for _, blacklistedTag := range config.History.TagmsgStorage.Blacklist {
|
||||
if _, ok := item.Tags[blacklistedTag]; ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
for _, whitelistedTag := range config.History.TagmsgStorage.Whitelist {
|
||||
if _, ok := item.Tags[whitelistedTag]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
case history.Privmsg, history.Notice:
|
||||
// don't store CTCP other than ACTION
|
||||
return !item.Message.IsRestrictedCTCPMessage()
|
||||
default:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// NPC <target> <sourcenick> <message>
|
||||
func npcHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||
target := msg.Params[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue