clean up /theater so that it doesn't need a bunch of pointers and that it reuses channel-scoped-user-modes machinery

This commit is contained in:
Edmund Huber
2014-03-22 22:25:24 +01:00
parent bffad06a26
commit 6267b6a40c
5 changed files with 14 additions and 16 deletions

View File

@@ -51,10 +51,8 @@ func (m *TheaterIdentifyCommand) HandleServer(s *Server) {
return
}
if channel.theaterUser == nil {
client.theaterChannels = append(client.theaterChannels, channel)
channel.flags[Theater] = true
channel.theaterUser = client
if !channel.members.AnyHasMode(Theater) {
channel.members[client][Theater] = true
}
}
@@ -82,7 +80,7 @@ func (m *TheaterPrivMsgCommand) HandleServer(s *Server) {
return
}
if channel.theaterUser == client {
if channel.members.HasMode(client, Theater) {
for member := range channel.members {
member.Reply(RplPrivMsg(TheaterClient(m.asNick), channel, m.message))
}
@@ -113,7 +111,7 @@ func (m *TheaterActionCommand) HandleServer(s *Server) {
return
}
if channel.theaterUser == client {
if channel.members.HasMode(client, Theater) {
for member := range channel.members {
member.Reply(RplPrivMsg(TheaterClient(m.asNick), channel, NewText(fmt.Sprintf("\001ACTION %s\001", m.action))))
}