summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-12-21 00:00:22 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-12-21 00:00:22 +0100
commit91d96257792d34ef8af6027d70775b8bc376618f (patch)
tree96feb1f197430ed3950f6bf6cddfadd722443a9c
parent44b2a071555235d8e7c1d64d85541ade50527e3b (diff)
Remove all commands
-rw-r--r--command.go28
-rw-r--r--last.go33
-rw-r--r--main.go2
3 files changed, 0 insertions, 63 deletions
diff --git a/command.go b/command.go
deleted file mode 100644
index 665d530..0000000
--- a/command.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package main
-
-import (
- "log"
- "strings"
-
- irc "github.com/fluffle/goirc/client"
-)
-
-type Commander interface {
- irc.Handler
-}
-
-var commands = make(map[string]Commander)
-
-func Register(cmd string, f Commander) {
- commands[cmd] = f
-}
-
-func Dispatch(conn *irc.Conn, line *irc.Line) {
- if f := strings.Fields(line.Text()); len(f) > 0 {
- cmd := strings.ToLower(f[0])
- if c, ok := commands[cmd]; ok {
- log.Println(line.Nick, f)
- c.Handle(conn, line)
- }
- }
-}
diff --git a/last.go b/last.go
deleted file mode 100644
index aa326e4..0000000
--- a/last.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package main
-
-import (
- "container/ring"
- "fmt"
-
- irc "github.com/fluffle/goirc/client"
-)
-
-type Last struct{}
-
-var buffer = ring.New(10)
-
-func (Last) Handle(conn *irc.Conn, line *irc.Line) {
- buffer.Do(func(v interface{}) {
- if v != nil {
- l := v.(*irc.Line)
- s := fmt.Sprintf("%v <%v> %v",
- l.Time.UTC().Format("15:04 UTC"),
- l.Nick, l.Text())
- conn.Notice(line.Nick, s)
- }
- })
-}
-
-func Push(line *irc.Line) {
- buffer.Value = line
- buffer = buffer.Next()
-}
-
-func init() {
- Register("last", &Last{})
-}
diff --git a/main.go b/main.go
index 1b8ac33..3b8daa5 100644
--- a/main.go
+++ b/main.go
@@ -41,14 +41,12 @@ func discon(c chan struct{}) irc.HandlerFunc {
func privmsg(room string) irc.HandlerFunc {
return func(conn *irc.Conn, line *irc.Line) {
- go Dispatch(conn, line)
go Links(conn, line)
if line.Public() && line.Nick != conn.Me().Nick {
if isFlood(line.Text()) {
log.Println("flood", line.Nick)
conn.Kick(room, line.Nick, "flood")
}
- Push(line)
}
}
}