mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
restrict new channels to channel regex
This commit is contained in:
parent
c8701febd0
commit
39fb4bfb53
@ -165,17 +165,6 @@ func (s *Server) listen(config ListenerConfig) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) GetOrMakeChannel(name string) *Channel {
|
|
||||||
channel, ok := s.channels[name]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
channel = NewChannel(s, name)
|
|
||||||
s.channels[name] = channel
|
|
||||||
}
|
|
||||||
|
|
||||||
return channel
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) GenerateGuestNick() string {
|
func (s *Server) GenerateGuestNick() string {
|
||||||
bytes := make([]byte, 8)
|
bytes := make([]byte, 8)
|
||||||
for {
|
for {
|
||||||
@ -393,7 +382,16 @@ func (m *JoinCommand) HandleServer(s *Server) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for name, key := range m.channels {
|
for name, key := range m.channels {
|
||||||
channel := s.GetOrMakeChannel(name)
|
if !IsChannel(name) {
|
||||||
|
client.ErrNoSuchChannel(name)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
channel := s.channels[name]
|
||||||
|
if channel == nil {
|
||||||
|
channel = NewChannel(s, name)
|
||||||
|
s.channels[name] = channel
|
||||||
|
}
|
||||||
channel.Join(client, key)
|
channel.Join(client, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user