func (c *client) recvFunc(msg *irc.Message) { // Connection registration is a special state, don't process messages // until the client gives its nick and user. if c.nick == "" { if msg.Command == "NICK" && len(msg.Params) == 1 { c.nick = msg.Params[0] } return } if c.realname == "" { if msg.Command == "USER" && len(msg.Params) == 4 { c.realname = msg.Params[3] c.welcome() } return } // The normal code path notifies the RecvFromClient event chain. events.Notify("RecvFromClient", c, msg) }
func (c *client) Send(msg *irc.Message) { events.Notify("SendToClient", c, msg) }
// Send transmits a message by notifying SendToServer event chain. func (server *server) Send(msg *irc.Message) { events.Notify("SendToServer", server, msg) }
func (server *server) recvFunc(msg *irc.Message) { events.Notify("RecvFromServer", server, msg) }