mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Set default channel modes to +nt
This commit is contained in:
parent
99d442196f
commit
cd7d30a997
@ -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
|
||||
|
@ -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{
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user