Remove downstreamConn.WriteMessage
It wasn't clear what this function was doing
This commit is contained in:
parent
ec658e3d39
commit
86f66cf6c4
@ -121,21 +121,17 @@ func (c *downstreamConn) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *downstreamConn) WriteMessage(msg *irc.Message) {
|
|
||||||
msg.Prefix = c.srv.prefix()
|
|
||||||
c.messages <- msg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *downstreamConn) handleMessage(msg *irc.Message) error {
|
func (c *downstreamConn) handleMessage(msg *irc.Message) error {
|
||||||
switch msg.Command {
|
switch msg.Command {
|
||||||
case "QUIT":
|
case "QUIT":
|
||||||
return c.Close()
|
return c.Close()
|
||||||
case "PING":
|
case "PING":
|
||||||
// TODO: handle params
|
// TODO: handle params
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: "PONG",
|
Command: "PONG",
|
||||||
Params: []string{c.srv.Hostname},
|
Params: []string{c.srv.Hostname},
|
||||||
})
|
}
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
if c.registered {
|
if c.registered {
|
||||||
@ -172,30 +168,35 @@ func (c *downstreamConn) handleMessageUnregistered(msg *irc.Message) error {
|
|||||||
func (c *downstreamConn) register() error {
|
func (c *downstreamConn) register() error {
|
||||||
c.registered = true
|
c.registered = true
|
||||||
|
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: irc.RPL_WELCOME,
|
Command: irc.RPL_WELCOME,
|
||||||
Params: []string{c.nick, "Welcome to jounce, " + c.nick},
|
Params: []string{c.nick, "Welcome to jounce, " + c.nick},
|
||||||
})
|
}
|
||||||
|
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: irc.RPL_YOURHOST,
|
Command: irc.RPL_YOURHOST,
|
||||||
Params: []string{c.nick, "Your host is " + c.srv.Hostname},
|
Params: []string{c.nick, "Your host is " + c.srv.Hostname},
|
||||||
})
|
}
|
||||||
|
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: irc.RPL_CREATED,
|
Command: irc.RPL_CREATED,
|
||||||
Params: []string{c.nick, "This server was created <datetime>"}, // TODO
|
Params: []string{c.nick, "This server was created <datetime>"}, // TODO
|
||||||
})
|
}
|
||||||
|
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: irc.RPL_MYINFO,
|
Command: irc.RPL_MYINFO,
|
||||||
Params: []string{c.nick, c.srv.Hostname, "jounce", "aiwroO", "OovaimnqpsrtklbeI"},
|
Params: []string{c.nick, c.srv.Hostname, "jounce", "aiwroO", "OovaimnqpsrtklbeI"},
|
||||||
})
|
}
|
||||||
|
|
||||||
c.WriteMessage(&irc.Message{
|
c.messages <- &irc.Message{
|
||||||
|
Prefix: c.srv.prefix(),
|
||||||
Command: irc.ERR_NOMOTD,
|
Command: irc.ERR_NOMOTD,
|
||||||
Params: []string{c.nick, "No MOTD"},
|
Params: []string{c.nick, "No MOTD"},
|
||||||
})
|
}
|
||||||
|
|
||||||
c.srv.lock.Lock()
|
c.srv.lock.Lock()
|
||||||
for _, uc := range c.srv.upstreamConns {
|
for _, uc := range c.srv.upstreamConns {
|
||||||
|
Loading…
Reference in New Issue
Block a user