3
0
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:
Jeremy Latt 2014-02-21 17:19:02 -08:00
parent c8701febd0
commit 39fb4bfb53

View File

@ -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 {
bytes := make([]byte, 8)
for {
@ -393,7 +382,16 @@ func (m *JoinCommand) HandleServer(s *Server) {
}
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)
}
}