Split modes into a subpackage (this is painful, but will force us to simplify and improve the API for interacting with modes)

This commit is contained in:
Daniel Oaks 2018-02-03 20:21:32 +10:00
parent 9f71d9ce12
commit 3634d0601e
12 changed files with 541 additions and 517 deletions

View file

@ -8,6 +8,7 @@ import (
"strings"
"github.com/goshuirc/irc-go/ircfmt"
"github.com/oragono/oragono/irc/modes"
"github.com/oragono/oragono/irc/sno"
)
@ -55,7 +56,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
}
channelInfo := server.channels.Get(channelKey)
if channelInfo == nil || !channelInfo.ClientIsAtLeast(client, ChannelOperator) {
if channelInfo == nil || !channelInfo.ClientIsAtLeast(client, modes.ChannelOperator) {
client.ChanServNotice(client.t("You must be an oper on the channel to register it"))
return
}
@ -81,7 +82,7 @@ func (server *Server) chanservReceivePrivmsg(client *Client, message string) {
server.snomasks.Send(sno.LocalChannels, fmt.Sprintf(ircfmt.Unescape("Channel registered $c[grey][$r%s$c[grey]] by $c[grey][$r%s$c[grey]]"), channelName, client.nickMaskString))
// give them founder privs
change := channelInfo.applyModeMemberNoMutex(client, ChannelFounder, Add, client.NickCasefolded())
change := channelInfo.applyModeMemberNoMutex(client, modes.ChannelFounder, modes.Add, client.NickCasefolded())
if change != nil {
//TODO(dan): we should change the name of String and make it return a slice here
//TODO(dan): unify this code with code in modes.go