Example #1
0
func (p *IRCPlug) onMessage(c *client.Conn, l *client.Line) {
	channel, msg := l.Args[0], l.Args[1]
	if !helpers.ContainsString(p.config.Channels, channel) {
		// ignore non channel messages, etc
		return
	}
	if helpers.ContainsString(p.config.Identity.Nick, l.Nick) {
		// do not relay messages from me
		return
	}
	p.changes <- plug.Change{
		User:    l.Nick,
		Channel: channel,
		Server:  p.config.Connection.Addr,
		Data:    msg,
	}
}
Example #2
0
func (p *IRCPlug) onTopic(c *client.Conn, l *client.Line) {
	channel, msg := l.Args[0], l.Args[1]
	if !helpers.ContainsString(p.config.Channels, channel) {
		// ignore non channel messages, etc
		return
	}
	p.changes <- plug.Change{
		User:    l.Nick,
		Channel: channel,
		Server:  p.config.Connection.Addr,
		Data:    fmt.Sprintf("Topic changed: %s", msg),
	}
}