mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
review fix
This commit is contained in:
parent
f6b3008f8f
commit
51fcedc5a1
@ -213,7 +213,6 @@ type Limits struct {
|
|||||||
NickLen int `yaml:"nicklen"`
|
NickLen int `yaml:"nicklen"`
|
||||||
TopicLen int `yaml:"topiclen"`
|
TopicLen int `yaml:"topiclen"`
|
||||||
WhowasEntries int `yaml:"whowas-entries"`
|
WhowasEntries int `yaml:"whowas-entries"`
|
||||||
ChathistoryMax int `yaml:"chathistory-maxmessages"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// STSConfig controls the STS configuration/
|
// STSConfig controls the STS configuration/
|
||||||
@ -316,6 +315,7 @@ type Config struct {
|
|||||||
ChannelLength int `yaml:"channel-length"`
|
ChannelLength int `yaml:"channel-length"`
|
||||||
ClientLength int `yaml:"client-length"`
|
ClientLength int `yaml:"client-length"`
|
||||||
AutoreplayOnJoin int `yaml:"autoreplay-on-join"`
|
AutoreplayOnJoin int `yaml:"autoreplay-on-join"`
|
||||||
|
ChathistoryMax int `yaml:"chathistory-maxmessages"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Filename string
|
Filename string
|
||||||
|
@ -531,6 +531,7 @@ func capHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
|
|||||||
// CHATHISTORY <target> BETWEEN <query> <query> <direction> [<limit>]
|
// CHATHISTORY <target> BETWEEN <query> <query> <direction> [<limit>]
|
||||||
// e.g., CHATHISTORY #ircv3 BETWEEN timestamp=YYYY-MM-DDThh:mm:ss.sssZ timestamp=YYYY-MM-DDThh:mm:ss.sssZ + 100
|
// e.g., CHATHISTORY #ircv3 BETWEEN timestamp=YYYY-MM-DDThh:mm:ss.sssZ timestamp=YYYY-MM-DDThh:mm:ss.sssZ + 100
|
||||||
func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) (exiting bool) {
|
func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) (exiting bool) {
|
||||||
|
config := server.Config()
|
||||||
// batch type is chathistory; send an empty batch if necessary
|
// batch type is chathistory; send an empty batch if necessary
|
||||||
rb.InitializeBatch("chathistory", true)
|
rb.InitializeBatch("chathistory", true)
|
||||||
|
|
||||||
@ -595,7 +596,7 @@ func chathistoryHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
maxChathistoryLimit := server.Config().Limits.ChathistoryMax
|
maxChathistoryLimit := config.History.ChathistoryMax
|
||||||
if maxChathistoryLimit == 0 {
|
if maxChathistoryLimit == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1008,6 +1009,7 @@ Get an explanation of <argument>, or "index" for a list of help topics.`), rb)
|
|||||||
// e.g., HISTORY #ubuntu 10
|
// e.g., HISTORY #ubuntu 10
|
||||||
// HISTORY me 15
|
// HISTORY me 15
|
||||||
func historyHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
func historyHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||||
|
config := server.Config()
|
||||||
target := msg.Params[0]
|
target := msg.Params[0]
|
||||||
var hist *history.Buffer
|
var hist *history.Buffer
|
||||||
channel := server.channels.Get(target)
|
channel := server.channels.Get(target)
|
||||||
@ -1024,7 +1026,7 @@ func historyHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
|||||||
}
|
}
|
||||||
|
|
||||||
limit := 10
|
limit := 10
|
||||||
maxChathistoryLimit := server.Config().Limits.ChathistoryMax
|
maxChathistoryLimit := config.History.ChathistoryMax
|
||||||
if len(msg.Params) > 1 {
|
if len(msg.Params) > 1 {
|
||||||
providedLimit, err := strconv.Atoi(msg.Params[1])
|
providedLimit, err := strconv.Atoi(msg.Params[1])
|
||||||
if providedLimit > maxChathistoryLimit {
|
if providedLimit > maxChathistoryLimit {
|
||||||
|
@ -157,8 +157,8 @@ func (server *Server) setISupport() (err error) {
|
|||||||
isupport.Add("AWAYLEN", strconv.Itoa(config.Limits.AwayLen))
|
isupport.Add("AWAYLEN", strconv.Itoa(config.Limits.AwayLen))
|
||||||
isupport.Add("CASEMAPPING", "ascii")
|
isupport.Add("CASEMAPPING", "ascii")
|
||||||
isupport.Add("CHANMODES", strings.Join([]string{modes.Modes{modes.BanMask, modes.ExceptMask, modes.InviteMask}.String(), "", modes.Modes{modes.UserLimit, modes.Key}.String(), modes.Modes{modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.ChanRoleplaying, modes.Secret}.String()}, ","))
|
isupport.Add("CHANMODES", strings.Join([]string{modes.Modes{modes.BanMask, modes.ExceptMask, modes.InviteMask}.String(), "", modes.Modes{modes.UserLimit, modes.Key}.String(), modes.Modes{modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.ChanRoleplaying, modes.Secret}.String()}, ","))
|
||||||
if config.History.Enabled && config.Limits.ChathistoryMax > 0 {
|
if config.History.Enabled && config.History.ChathistoryMax > 0 {
|
||||||
isupport.Add("CHATHISTORY", strconv.Itoa(config.Limits.ChathistoryMax))
|
isupport.Add("CHATHISTORY", strconv.Itoa(config.History.ChathistoryMax))
|
||||||
}
|
}
|
||||||
isupport.Add("CHANNELLEN", strconv.Itoa(config.Limits.ChannelLen))
|
isupport.Add("CHANNELLEN", strconv.Itoa(config.Limits.ChannelLen))
|
||||||
isupport.Add("CHANTYPES", "#")
|
isupport.Add("CHANTYPES", "#")
|
||||||
|
@ -439,10 +439,6 @@ limits:
|
|||||||
# maximum length of channel lists (beI modes)
|
# maximum length of channel lists (beI modes)
|
||||||
chan-list-modes: 60
|
chan-list-modes: 60
|
||||||
|
|
||||||
# maximum number of CHATHISTORY messages that can be
|
|
||||||
# requested at once (0 disables support for CHATHISTORY)
|
|
||||||
chathistory-maxmessages: 100
|
|
||||||
|
|
||||||
# maximum length of IRC lines
|
# maximum length of IRC lines
|
||||||
# this should generally be 1024-2048, and will only apply when negotiated by clients
|
# this should generally be 1024-2048, and will only apply when negotiated by clients
|
||||||
linelen:
|
linelen:
|
||||||
@ -484,3 +480,7 @@ history:
|
|||||||
|
|
||||||
# number of messages to automatically play back on channel join (0 to disable):
|
# number of messages to automatically play back on channel join (0 to disable):
|
||||||
autoreplay-on-join: 0
|
autoreplay-on-join: 0
|
||||||
|
|
||||||
|
# maximum number of CHATHISTORY messages that can be
|
||||||
|
# requested at once (0 disables support for CHATHISTORY)
|
||||||
|
chathistory-maxmessages: 100
|
||||||
|
Loading…
Reference in New Issue
Block a user