Moved PRIVMSG into Client.reply()
This commit is contained in:
parent
7980ec0b7f
commit
f592014bed
@ -55,6 +55,7 @@ const (
|
|||||||
rplNames
|
rplNames
|
||||||
rplNickChange
|
rplNickChange
|
||||||
rplKill
|
rplKill
|
||||||
|
rplMsg
|
||||||
errMoreArgs
|
errMoreArgs
|
||||||
errNoNick
|
errNoNick
|
||||||
errInvalidNick
|
errInvalidNick
|
||||||
@ -213,11 +214,11 @@ func (s *Server) handleEvent(e Event) {
|
|||||||
if chanExists {
|
if chanExists {
|
||||||
for _, c := range channel.clientMap {
|
for _, c := range channel.clientMap {
|
||||||
if c != e.client {
|
if c != e.client {
|
||||||
c.outputChan <- fmt.Sprintf(":%s PRIVMSG %s %s", e.client.nick, args[0], message)
|
c.reply(rplMsg, e.client.nick, args[0], message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if clientExists {
|
} else if clientExists {
|
||||||
client.outputChan <- fmt.Sprintf(":%s PRIVMSG %s %s", e.client.nick, client.nick, message)
|
client.reply(rplMsg, e.client.nick, client.nick, message)
|
||||||
} else {
|
} else {
|
||||||
e.client.reply(errNoSuchNick, args[0])
|
e.client.reply(errNoSuchNick, args[0])
|
||||||
}
|
}
|
||||||
@ -441,6 +442,8 @@ func (c *Client) reply(code int, args ...string) {
|
|||||||
c.outputChan <- fmt.Sprintf(":%s NICK %s", args[0], args[1])
|
c.outputChan <- fmt.Sprintf(":%s NICK %s", args[0], args[1])
|
||||||
case rplKill:
|
case rplKill:
|
||||||
c.outputChan <- fmt.Sprintf(":%s KILL %s A A %s", c.server.name, c.nick, args[0])
|
c.outputChan <- fmt.Sprintf(":%s KILL %s A A %s", c.server.name, c.nick, args[0])
|
||||||
|
case rplMsg:
|
||||||
|
c.outputChan <- fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], args[2])
|
||||||
case errMoreArgs:
|
case errMoreArgs:
|
||||||
c.outputChan <- fmt.Sprintf(":%s 461 %s %s :Not enough params", c.server.name, c.nick, args[0])
|
c.outputChan <- fmt.Sprintf(":%s 461 %s %s :Not enough params", c.server.name, c.nick, args[0])
|
||||||
case errNoNick:
|
case errNoNick:
|
||||||
|
Loading…
Reference in New Issue
Block a user