mirror of
https://github.com/jeremyd/ergo.git
synced 2026-05-12 23:38:36 -07:00
add a type for CTCP-encoded strings, and NOTICEs for error cases
This commit is contained in:
@@ -51,9 +51,12 @@ func (m *TheaterIdentifyCommand) HandleServer(s *Server) {
|
||||
return
|
||||
}
|
||||
|
||||
if !channel.members.AnyHasMode(Theater) {
|
||||
channel.members[client][Theater] = true
|
||||
if channel.members.AnyHasMode(Theater) {
|
||||
client.Reply(RplNotice(s, client, "someone else is +T in this channel"))
|
||||
return
|
||||
}
|
||||
|
||||
channel.members[client][Theater] = true
|
||||
}
|
||||
|
||||
type TheaterPrivMsgCommand struct {
|
||||
@@ -69,6 +72,7 @@ func (cmd *TheaterPrivMsgCommand) String() string {
|
||||
}
|
||||
func (m *TheaterPrivMsgCommand) HandleServer(s *Server) {
|
||||
client := m.Client()
|
||||
|
||||
if !m.channel.IsChannel() {
|
||||
client.ErrNoSuchChannel(m.channel)
|
||||
return
|
||||
@@ -80,10 +84,13 @@ func (m *TheaterPrivMsgCommand) HandleServer(s *Server) {
|
||||
return
|
||||
}
|
||||
|
||||
if channel.members.HasMode(client, Theater) {
|
||||
for member := range channel.members {
|
||||
member.Reply(RplPrivMsg(TheaterClient(m.asNick), channel, m.message))
|
||||
}
|
||||
if !channel.members.HasMode(client, Theater) {
|
||||
client.Reply(RplNotice(s, client, "you are not +T"))
|
||||
return
|
||||
}
|
||||
|
||||
for member := range channel.members {
|
||||
member.Reply(RplPrivMsg(TheaterClient(m.asNick), channel, m.message))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +98,7 @@ type TheaterActionCommand struct {
|
||||
BaseCommand
|
||||
channel Name
|
||||
asNick Name
|
||||
action Text
|
||||
action CTCPText
|
||||
}
|
||||
|
||||
func (cmd *TheaterActionCommand) String() string {
|
||||
@@ -100,7 +107,8 @@ func (cmd *TheaterActionCommand) String() string {
|
||||
|
||||
func (m *TheaterActionCommand) HandleServer(s *Server) {
|
||||
client := m.Client()
|
||||
if m.channel.IsChannel() {
|
||||
|
||||
if !m.channel.IsChannel() {
|
||||
client.ErrNoSuchChannel(m.channel)
|
||||
return
|
||||
}
|
||||
@@ -111,9 +119,12 @@ func (m *TheaterActionCommand) HandleServer(s *Server) {
|
||||
return
|
||||
}
|
||||
|
||||
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))))
|
||||
}
|
||||
if !channel.members.HasMode(client, Theater) {
|
||||
client.Reply(RplNotice(s, client, "you are not +T"))
|
||||
return
|
||||
}
|
||||
|
||||
for member := range channel.members {
|
||||
member.Reply(RplCTCPAction(TheaterClient(m.asNick), channel, m.action))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user