2009-11-18 15:03:14 +00:00
|
|
|
// Copyright 2009 Thomas Jager <mail@jager.no> All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2009-11-18 00:28:12 +00:00
|
|
|
package irc
|
|
|
|
|
|
|
|
import (
|
2010-01-06 18:32:35 +00:00
|
|
|
"os"
|
|
|
|
"net"
|
2009-11-18 00:28:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type IRCConnection struct {
|
2010-09-23 16:54:34 +00:00
|
|
|
socket net.Conn
|
|
|
|
pread, pwrite chan string
|
|
|
|
Error chan os.Error
|
|
|
|
syncreader, syncwriter chan bool
|
|
|
|
nick string
|
|
|
|
user string
|
|
|
|
registered bool
|
|
|
|
server string
|
2010-01-06 18:32:35 +00:00
|
|
|
|
|
|
|
events map[string][]func(*IRCEvent)
|
2010-09-23 16:54:34 +00:00
|
|
|
|
|
|
|
lastMessage int64
|
|
|
|
ticker <-chan int64
|
|
|
|
ticker2 <-chan int64
|
2009-11-18 00:28:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type IRCEvent struct {
|
2010-01-06 18:32:35 +00:00
|
|
|
Code string
|
|
|
|
Message string
|
|
|
|
Raw string
|
|
|
|
Nick string //<nick>
|
|
|
|
Host string //<nick>!<usr>@<host>
|
|
|
|
Source string //<host>
|
|
|
|
User string //<usr>
|
|
|
|
|
|
|
|
Arguments []string
|
2009-11-18 00:28:12 +00:00
|
|
|
}
|