Documentation
¶
Index ¶
- Variables
- func ConnectionReactor(conn *Connection, reactorCtl <-chan bool)
- func ConvertSlashCommand(fullcmd string) (string, error)
- func IsChannel(target string) bool
- func IsDirect(msg string, currentNick string) bool
- func StripNickOnDirect(msg string, nick string) string
- type Connection
- func (conn *Connection) AddHandler(name string, fn ircfn)
- func (conn *Connection) BootstrapHandler(msg *Message)
- func (conn *Connection) CTCPHandler(msg *Message)
- func (conn *Connection) Connect() chan bool
- func (conn *Connection) ConnectedHandler(msg *Message)
- func (conn *Connection) Disconnect()
- func (conn *Connection) GetChannelElement(channel string) *list.Element
- func (conn *Connection) GetCurrentNick() string
- func (conn *Connection) GetInfo() []string
- func (conn *Connection) IsConnected() bool
- func (conn *Connection) IsInChannel(channel string) bool
- func (conn *Connection) JoinChannel(channel string)
- func (conn *Connection) NickInUseHandler(msg *Message)
- func (conn *Connection) PartChannel(channel string)
- func (conn *Connection) PingHandler(msg *Message)
- func (conn *Connection) PongHandler(msg *Message)
- func (conn *Connection) SendPing(msg *Message)
- func (conn *Connection) String() string
- type Handler
- type HandlerRegistry
- type IRCConnections
- type Message
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Logger log15.Logger
)
Functions ¶
func ConnectionReactor ¶
func ConnectionReactor(conn *Connection, reactorCtl <-chan bool)
func ConvertSlashCommand ¶
func StripNickOnDirect ¶
Types ¶
type Connection ¶
type Connection struct { // Name of the network (e.g. freenode, efnet, localhost) Name string // Network configuration Config config.ConnectionConfig // Channel used to capture messages coming in from IRC In <-chan string // Channel used to send messages to IRC Out chan<- string // How many messages we have recieved. Reset when tenyks is restarted. MessagesRecved uint // How mant messages we have sent. Reset when tenyks is restarted. MessagesSent uint // Created holds the datetime the connection was created. Created time.Time // Handler registry. These handle various commands from IRC. Registry *HandlerRegistry // Channel used to tell things to wait for the connection to succeed before spawning goroutines. ConnectWait chan bool // Last PONG recieved from the network. LastPong time.Time // Channel for the connection watchdog. PongIn chan bool // Current channels tenyks is in. Jnerula hates state and I don't care. Channels *list.List // contains filtered or unexported fields }
func NewConnection ¶
func NewConnection(name string, conf config.ConnectionConfig) *Connection
NewConnection will create a new instance of an irc.Connection. It will return *irc.Connection
func (*Connection) AddHandler ¶
func (conn *Connection) AddHandler(name string, fn ircfn)
func (*Connection) BootstrapHandler ¶
func (conn *Connection) BootstrapHandler(msg *Message)
func (*Connection) CTCPHandler ¶
func (conn *Connection) CTCPHandler(msg *Message)
func (*Connection) Connect ¶
func (conn *Connection) Connect() chan bool
Connect is a goroutine that returns a channel that is true if connected successfully and false if not. It returns a bool channel that when closed or is passed true means success.
func (*Connection) ConnectedHandler ¶
func (conn *Connection) ConnectedHandler(msg *Message)
func (*Connection) Disconnect ¶
func (conn *Connection) Disconnect()
Disconnect will hangup the connection with IRC and reset channels and other important bootstrap attributes back to the defaults.
func (*Connection) GetChannelElement ¶
func (conn *Connection) GetChannelElement(channel string) *list.Element
func (*Connection) GetCurrentNick ¶
func (conn *Connection) GetCurrentNick() string
GetCurrentNick will return the nick currently being used in the IRC connection It returns a string
func (*Connection) GetInfo ¶
func (conn *Connection) GetInfo() []string
func (*Connection) IsConnected ¶
func (conn *Connection) IsConnected() bool
IsConnected can be called to detemine if a connection is still connected. It returns a bool
func (*Connection) IsInChannel ¶
func (conn *Connection) IsInChannel(channel string) bool
func (*Connection) JoinChannel ¶
func (conn *Connection) JoinChannel(channel string)
func (*Connection) NickInUseHandler ¶
func (conn *Connection) NickInUseHandler(msg *Message)
func (*Connection) PartChannel ¶
func (conn *Connection) PartChannel(channel string)
func (*Connection) PingHandler ¶
func (conn *Connection) PingHandler(msg *Message)
func (*Connection) PongHandler ¶
func (conn *Connection) PongHandler(msg *Message)
func (*Connection) SendPing ¶
func (conn *Connection) SendPing(msg *Message)
func (*Connection) String ¶
func (conn *Connection) String() string
type Handler ¶
type Handler struct {
Fn func(...interface{})
}
func NewHandler ¶
func NewHandler(fn func(...interface{})) *Handler
type HandlerRegistry ¶
func NewHandlerRegistry ¶
func NewHandlerRegistry() *HandlerRegistry
func (*HandlerRegistry) AddHandler ¶
func (h *HandlerRegistry) AddHandler(name string, handler *Handler)
type IRCConnections ¶
type IRCConnections map[string]*Connection
Click to show internal directories.
Click to hide internal directories.