5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-27 05:21:39 +00:00
matterbridge/vendor/github.com/42wim/go-ircevent/irc_struct.go

77 lines
1.7 KiB
Go
Raw Normal View History

2016-04-10 21:39:38 +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 (
"crypto/tls"
"log"
"net"
"sync"
"time"
)
type Connection struct {
2017-01-24 20:24:57 +00:00
sync.Mutex
2016-04-10 21:39:38 +00:00
sync.WaitGroup
2017-07-28 12:26:26 +00:00
Debug bool
Error chan error
Password string
UseTLS bool
UseSASL bool
RequestCaps []string
AcknowledgedCaps []string
SASLLogin string
SASLPassword string
SASLMech string
TLSConfig *tls.Config
Version string
Timeout time.Duration
PingFreq time.Duration
KeepAlive time.Duration
Server string
2016-04-10 21:39:38 +00:00
socket net.Conn
pwrite chan string
end chan struct{}
nick string //The nickname we want.
nickcurrent string //The nickname we currently have.
user string
registered bool
events map[string]map[int]func(*Event)
QuitMessage string
lastMessage time.Time
VerboseCallbackHandler bool
Log *log.Logger
stopped bool
2017-01-24 20:24:57 +00:00
quit bool //User called Quit, do not reconnect.
2016-04-10 21:39:38 +00:00
}
// A struct to represent an event.
type Event struct {
Code string
Raw string
Nick string //<nick>
Host string //<nick>!<usr>@<host>
Source string //<host>
User string //<usr>
Arguments []string
2017-07-28 12:26:26 +00:00
Tags map[string]string
2016-04-10 21:39:38 +00:00
Connection *Connection
}
// Retrieve the last message from Event arguments.
// This function leaves the arguments untouched and
// returns an empty string if there are none.
func (e *Event) Message() string {
if len(e.Arguments) == 0 {
return ""
}
return e.Arguments[len(e.Arguments)-1]
}