summaryrefslogtreecommitdiff
path: root/notify.go
blob: 9234e20acf7ff1f64e0d2e7e908e14b0d9c3e2fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
	"log"

	irc "github.com/fluffle/goirc/client"
)

type notify struct {
	conn   *irc.Conn
	target string
}

func newNotify(conn *irc.Conn, target string) *notify {
	return &notify{conn: conn, target: target}
}

func (n *notify) Write(p []byte) (int, error) {
	s := limitString(p)
	log.Println("send", s)
	n.conn.Notice(n.target, s.String())
	return len(p), nil
}