3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

Set default channel modes to +nt

This commit is contained in:
Daniel Oaks 2016-04-21 19:29:50 +10:00
parent 99d442196f
commit cd7d30a997
3 changed files with 13 additions and 3 deletions

View File

@ -18,7 +18,7 @@ type Channel struct {
// NewChannel creates a new channel from a `Server` and a `name`
// string, which must be unique on the server.
func NewChannel(s *Server, name Name) *Channel {
func NewChannel(s *Server, name Name, addDefaultModes bool) *Channel {
channel := &Channel{
flags: make(ChannelModeSet),
lists: map[ChannelMode]*UserMaskSet{
@ -31,6 +31,12 @@ func NewChannel(s *Server, name Name) *Channel {
server: s,
}
if addDefaultModes {
for _, mode := range DefaultChannelModes {
channel.flags[mode] = true
}
}
s.channels.Add(channel)
return channel

View File

@ -94,6 +94,10 @@ var (
OpOnlyTopic, Persistent, Secret, Theater, UserLimit,
}
DefaultChannelModes = ChannelModes{
NoOutside, OpOnlyTopic,
}
// ChannelPrivModes holds the list of modes that are privileged, ie founder/op/halfop, in order.
// voice is not in this list because it cannot perform channel operator actions.
ChannelPrivModes = ChannelModes{

View File

@ -156,7 +156,7 @@ func (server *Server) loadChannels() {
continue
}
channel := NewChannel(server, NewName(name))
channel := NewChannel(server, NewName(name), false)
for _, flag := range flags {
channel.flags[ChannelMode(flag)] = true
}
@ -449,7 +449,7 @@ func (m *JoinCommand) HandleServer(s *Server) {
channel := s.channels.Get(name)
if channel == nil {
channel = NewChannel(s, name)
channel = NewChannel(s, name, true)
}
channel.Join(client, key)
}