Added the "n" no external mode.
This commit is contained in:
parent
0ad0dd2989
commit
a2b90b7ac6
@ -41,6 +41,7 @@ type ChannelMode struct {
|
||||
secret bool //Channel is hidden from LIST
|
||||
topicLocked bool //Only ops may change topic
|
||||
moderated bool //Only ops and voiced may speak
|
||||
noExternal bool //Only users in the channel may talk to it
|
||||
}
|
||||
|
||||
func (m *ChannelMode) String() string {
|
||||
@ -57,6 +58,9 @@ func (m *ChannelMode) String() string {
|
||||
if m.moderated {
|
||||
modeStr += "m"
|
||||
}
|
||||
if m.noExternal {
|
||||
modeStr += "n"
|
||||
}
|
||||
return modeStr
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,13 @@ func (s *Server) handleEvent(e Event) {
|
||||
client, clientExists := s.clientMap[strings.ToLower(args[0])]
|
||||
|
||||
if chanExists {
|
||||
if channel.mode.noExternal {
|
||||
if _, inChannel := channel.clientMap[strings.ToLower(e.client.nick)]; !inChannel {
|
||||
//Not in channel, not allowed to send
|
||||
e.client.reply(errCannotSend, args[0])
|
||||
return
|
||||
}
|
||||
}
|
||||
if channel.mode.moderated {
|
||||
clientMode := channel.modeMap[strings.ToLower(e.client.nick)]
|
||||
if !clientMode.operator && !clientMode.voice {
|
||||
@ -164,6 +171,8 @@ func (s *Server) handleEvent(e Event) {
|
||||
for _, c := range channel.clientMap {
|
||||
if c != e.client {
|
||||
c.reply(rplMsg, e.client.nick, args[0], message)
|
||||
e.client.reply(errCannotSend, args[0])
|
||||
return
|
||||
}
|
||||
}
|
||||
} else if clientExists {
|
||||
|
Loading…
Reference in New Issue
Block a user