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
|
|
|
|
|
2012-02-25 08:52:19 +00:00
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"time"
|
2012-03-21 04:08:05 +00:00
|
|
|
"github.com/lye/tls"
|
2012-02-25 08:52:19 +00:00
|
|
|
)
|
2009-11-18 00:28:12 +00:00
|
|
|
|
|
|
|
type IRCConnection struct {
|
2010-10-18 19:46:34 +00:00
|
|
|
socket net.Conn
|
|
|
|
pread, pwrite chan string
|
2011-11-07 00:26:12 +00:00
|
|
|
Error chan error
|
2010-09-23 16:54:34 +00:00
|
|
|
syncreader, syncwriter chan bool
|
2011-02-03 00:16:13 +00:00
|
|
|
nick string //The nickname we want.
|
|
|
|
nickcurrent string //The nickname we currently have.
|
2010-10-18 19:46:34 +00:00
|
|
|
user string
|
|
|
|
registered bool
|
|
|
|
server string
|
|
|
|
Password string
|
|
|
|
events map[string][]func(*IRCEvent)
|
2010-09-29 06:58:32 +00:00
|
|
|
|
2012-02-25 08:52:19 +00:00
|
|
|
lastMessage time.Time
|
|
|
|
ticker <-chan time.Time
|
|
|
|
ticker2 <-chan time.Time
|
2010-10-18 19:46:34 +00:00
|
|
|
|
2011-05-22 04:06:22 +00:00
|
|
|
VerboseCallbackHandler bool
|
|
|
|
|
2010-10-18 19:46:34 +00:00
|
|
|
quitting bool
|
2012-03-18 22:08:05 +00:00
|
|
|
|
|
|
|
SSLConfig *tls.Config
|
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
|
|
|
}
|