2012-11-05 22:46:47 +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.
|
|
|
|
|
|
|
|
package irc
|
|
|
|
|
|
|
|
import (
|
2012-11-05 23:38:20 +00:00
|
|
|
"crypto/tls"
|
2012-11-05 22:46:47 +00:00
|
|
|
"log"
|
|
|
|
"net"
|
2012-02-25 08:52:19 +00:00
|
|
|
"time"
|
2012-11-05 22:46:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Connection struct {
|
2012-11-05 23:38:20 +00:00
|
|
|
Error chan error
|
|
|
|
Log chan string
|
|
|
|
Password string
|
2012-11-07 20:55:33 +00:00
|
|
|
UseTLS bool
|
|
|
|
TLSConfig *tls.Config
|
2012-03-22 03:57:35 +00:00
|
|
|
|
2013-03-13 11:54:00 +00:00
|
|
|
socket net.Conn
|
|
|
|
pread, pwrite chan string
|
2012-11-07 20:51:24 +00:00
|
|
|
syncreader, syncwriter, syncpinger chan bool
|
2013-03-13 11:54:00 +00:00
|
|
|
endping chan bool
|
2012-03-22 04:08:21 +00:00
|
|
|
|
2012-11-05 23:38:20 +00:00
|
|
|
nick string //The nickname we want.
|
2012-03-22 03:57:35 +00:00
|
|
|
nickcurrent string //The nickname we currently have.
|
2012-11-05 23:38:20 +00:00
|
|
|
user string
|
|
|
|
registered bool
|
|
|
|
server string
|
2012-11-05 23:39:31 +00:00
|
|
|
events map[string][]func(*Event)
|
2012-11-05 22:46:47 +00:00
|
|
|
|
2012-11-07 20:51:24 +00:00
|
|
|
lastMessage time.Time
|
|
|
|
ticker, ticker2 *time.Ticker
|
2012-11-05 22:46:47 +00:00
|
|
|
|
|
|
|
VerboseCallbackHandler bool
|
|
|
|
log *log.Logger
|
|
|
|
|
|
|
|
quitting bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type Event struct {
|
2012-11-05 23:38:20 +00:00
|
|
|
Code string
|
|
|
|
Message string
|
|
|
|
Raw string
|
|
|
|
Nick string //<nick>
|
|
|
|
Host string //<nick>!<usr>@<host>
|
|
|
|
Source string //<host>
|
|
|
|
User string //<usr>
|
2012-11-05 22:46:47 +00:00
|
|
|
Arguments []string
|
|
|
|
}
|