Forward channel information

This commit is contained in:
Simon Ser 2020-02-06 22:19:31 +01:00
parent 4a816e1593
commit cd7556264e
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
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: