Forward channel information

git-svn-id: file:///srv/svn/repo/suika/trunk@27 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
contact 2020-02-06 21:19:31 +00:00
parent 566d25c8fa
commit 4f2a8d542a
2 changed files with 14 additions and 0 deletions

View File

@ -73,6 +73,14 @@ func newDownstreamConn(srv *Server, netConn net.Conn) *downstreamConn {
return conn
}
func (c *downstreamConn) prefix() *irc.Prefix {
return &irc.Prefix{
Name: c.nick,
User: c.username,
// TODO: fill the host?
}
}
func (c *downstreamConn) readMessages() error {
c.logger.Printf("new connection")
defer c.Close()

View File

@ -168,6 +168,12 @@ func (c *upstreamConn) handleMessage(msg *irc.Message) error {
}
ch.complete = true
c.srv.lock.Lock()
for _, dc := range c.srv.downstreamConns {
forwardChannel(dc, ch)
}
c.srv.lock.Unlock()
case irc.RPL_YOURHOST, irc.RPL_CREATED:
// Ignore
case irc.RPL_LUSERCLIENT, irc.RPL_LUSEROP, irc.RPL_LUSERUNKNOWN, irc.RPL_LUSERCHANNELS, irc.RPL_LUSERME: