Implemented secret mode for channels

This commit is contained in:
Harry Jeffery 2013-08-29 18:08:39 +01:00
parent 85fb96dbb4
commit 8240b650d6

View File

@ -242,6 +242,12 @@ func (s *Server) handleEvent(e Event) {
chanList := make([]string, 0, len(s.channelMap)) chanList := make([]string, 0, len(s.channelMap))
for channelName, channel := range s.channelMap { for channelName, channel := range s.channelMap {
if channel.mode.secret {
if _, inChannel := channel.clientMap[strings.ToLower(e.client.nick)]; !inChannel {
//Not in the channel, skip
continue
}
}
listItem := fmt.Sprintf("%s %d :%s", channelName, len(channel.clientMap), channel.topic) listItem := fmt.Sprintf("%s %d :%s", channelName, len(channel.clientMap), channel.topic)
chanList = append(chanList, listItem) chanList = append(chanList, listItem)
} }