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