Ignore some upstream messages

git-svn-id: file:///srv/svn/repo/suika/trunk@14 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2020-02-06 15:39:09 +00:00
parent d1ab250d9d
commit 5d8a9e5f21

View File

@ -9,10 +9,16 @@ import (
"gopkg.in/irc.v3" "gopkg.in/irc.v3"
) )
const (
rpl_localusers = "265"
rpl_globalusers = "266"
)
type upstreamConn struct { type upstreamConn struct {
net net.Conn net net.Conn
irc *irc.Conn irc *irc.Conn
srv *Server srv *Server
registered bool
} }
func (c *upstreamConn) handleMessage(msg *irc.Message) error { func (c *upstreamConn) handleMessage(msg *irc.Message) error {
@ -23,10 +29,22 @@ func (c *upstreamConn) handleMessage(msg *irc.Message) error {
Command: "PONG", Command: "PONG",
Params: []string{c.srv.Hostname}, Params: []string{c.srv.Hostname},
}) })
case irc.RPL_WELCOME:
c.registered = true
case irc.RPL_YOURHOST, irc.RPL_CREATED, irc.RPL_MYINFO:
// Ignore
case irc.RPL_LUSERCLIENT, irc.RPL_LUSEROP, irc.RPL_LUSERUNKNOWN, irc.RPL_LUSERCHANNELS, irc.RPL_LUSERME:
// Ignore
case irc.RPL_MOTDSTART, irc.RPL_MOTD, irc.RPL_ENDOFMOTD:
// Ignore
case rpl_localusers, rpl_globalusers:
// Ignore
case irc.RPL_STATSVLINE, irc.RPL_STATSPING, irc.RPL_STATSBLINE, irc.RPL_STATSDLINE:
// Ignore
default: default:
c.srv.Logger.Printf("Unhandled upstream message: %v", msg) c.srv.Logger.Printf("Unhandled upstream message: %v", msg)
return nil
} }
return nil
} }
func connect(s *Server, upstream *Upstream) error { func connect(s *Server, upstream *Upstream) error {