Esempio n. 1
0
func (s *t) snarf(conn *irc.Connection, msg *irc.Message) {
	if msg.Command != "PRIVMSG" {
		return
	}

	matches := urlPattern.FindAllString(*msg.LastParameter(), -1)
	stmt, err := s.db.Prepare(
		fmt.Sprintf("insert into %s (url, nick, datetime, rawmessage) values(?, ?, ?, ?)", tableName))
	defer stmt.Finalize()

	if err != nil {
		return
	}

	for _, match := range matches {
		stmt.Exec(match, msg.Nick, time.Seconds(), *msg.LastParameter())
		stmt.Next()
		stmt.Reset()
	}
}
Esempio n. 2
0
func snarf(conn *irc.Connection, msg *irc.Message) {
	if msg.Command == "PING" {
		conn.Pong(*msg.LastParameter())
	}
}