diff --git a/downstream.go b/downstream.go index a01b382..a4cc6fc 100644 --- a/downstream.go +++ b/downstream.go @@ -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() diff --git a/upstream.go b/upstream.go index a65c0ab..6d7087b 100644 --- a/upstream.go +++ b/upstream.go @@ -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: