Documentation ¶
Index ¶
- Constants
- Variables
- type Connection
- func (irc *Connection) Action(target, message string)
- func (irc *Connection) Actionf(target, format string, a ...interface{})
- func (irc *Connection) AddCallback(eventcode string, callback func(*Event)) int
- func (irc *Connection) ClearCallback(eventcode string) bool
- func (irc *Connection) Connect(server string) error
- func (irc *Connection) Connected() bool
- func (irc *Connection) Disconnect()
- func (irc *Connection) ErrorChan() chan error
- func (irc *Connection) GetNick() string
- func (irc *Connection) Join(channel string)
- func (irc *Connection) Kick(user, channel, msg string)
- func (irc *Connection) Loop()
- func (irc *Connection) Mode(target string, modestring ...string)
- func (irc *Connection) MultiKick(users []string, channel string, msg string)
- func (irc *Connection) Nick(n string)
- func (irc *Connection) Notice(target, message string)
- func (irc *Connection) Noticef(target, format string, a ...interface{})
- func (irc *Connection) Part(channel string)
- func (irc *Connection) Privmsg(target, message string)
- func (irc *Connection) Privmsgf(target, format string, a ...interface{})
- func (irc *Connection) Quit()
- func (irc *Connection) Reconnect() error
- func (irc *Connection) RemoveCallback(eventcode string, i int) bool
- func (irc *Connection) ReplaceCallback(eventcode string, i int, callback func(*Event))
- func (irc *Connection) RunCallbacks(event *Event)
- func (irc *Connection) SendRaw(message string)
- func (irc *Connection) SendRawf(format string, a ...interface{})
- func (irc *Connection) Who(nick string)
- func (irc *Connection) Whois(nick string)
- type Event
Constants ¶
const (
VERSION = "go-ircevent v2.1"
)
Variables ¶
var ErrDisconnected = errors.New("Disconnect Called")
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { sync.WaitGroup Debug bool Error chan error Password string UseSasl bool SaslUser string SaslPassword string UseSocks bool SocksProxy string UseTLS bool TLSConfig *tls.Config Version string Timeout time.Duration PingFreq time.Duration KeepAlive time.Duration Server string QuitMessage string VerboseCallbackHandler bool Log *log.Logger // contains filtered or unexported fields }
func IRC ¶
func IRC(nick, user string) *Connection
Create a connection with the (publicly visible) nickname and username. The nickname is later used to address the user. Returns nil if nick or user are empty.
func (*Connection) Action ¶
func (irc *Connection) Action(target, message string)
Send (action) message to a target (channel or nickname). No clear RFC on this one...
func (*Connection) Actionf ¶
func (irc *Connection) Actionf(target, format string, a ...interface{})
Send formatted (action) message to a target (channel or nickname).
func (*Connection) AddCallback ¶
func (irc *Connection) AddCallback(eventcode string, callback func(*Event)) int
Register a callback to a connection and event code. A callback is a function which takes only an Event pointer as parameter. Valid event codes are all IRC/CTCP commands and error/response codes. This function returns the ID of the registered callback for later management.
func (*Connection) ClearCallback ¶
func (irc *Connection) ClearCallback(eventcode string) bool
Remove all callbacks from a given event code. It returns true if given event code is found and cleared.
func (*Connection) Connect ¶
func (irc *Connection) Connect(server string) error
Connect to a given server using the current connection configuration. This function also takes care of identification if a password is provided. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.1
func (*Connection) Connected ¶
func (irc *Connection) Connected() bool
Returns true if the connection is connected to an IRC server.
func (*Connection) Disconnect ¶
func (irc *Connection) Disconnect()
A disconnect sends all buffered messages (if possible), stops all goroutines and then closes the socket.
func (*Connection) ErrorChan ¶
func (irc *Connection) ErrorChan() chan error
func (*Connection) GetNick ¶
func (irc *Connection) GetNick() string
Determine nick currently used with the connection.
func (*Connection) Join ¶
func (irc *Connection) Join(channel string)
Use the connection to join a given channel. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.2.1
func (*Connection) Kick ¶
func (irc *Connection) Kick(user, channel, msg string)
Kick <user> from <channel> with <msg>. For no message, pass empty string ("")
func (*Connection) Mode ¶
func (irc *Connection) Mode(target string, modestring ...string)
Set different modes for a target (channel or nickname). RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.2.3
func (*Connection) MultiKick ¶
func (irc *Connection) MultiKick(users []string, channel string, msg string)
Kick all <users> from <channel> with <msg>. For no message, pass empty string ("")
func (*Connection) Nick ¶
func (irc *Connection) Nick(n string)
Set (new) nickname. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.1.2
func (*Connection) Notice ¶
func (irc *Connection) Notice(target, message string)
Send a notification to a nickname. This is similar to Privmsg but must not receive replies. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.4.2
func (*Connection) Noticef ¶
func (irc *Connection) Noticef(target, format string, a ...interface{})
Send a formated notification to a nickname. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.4.2
func (*Connection) Part ¶
func (irc *Connection) Part(channel string)
Leave a given channel. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.2.2
func (*Connection) Privmsg ¶
func (irc *Connection) Privmsg(target, message string)
Send (private) message to a target (channel or nickname). RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.4.1
func (*Connection) Privmsgf ¶
func (irc *Connection) Privmsgf(target, format string, a ...interface{})
Send formated string to specified target (channel or nickname).
func (*Connection) Quit ¶
func (irc *Connection) Quit()
Quit the current connection and disconnect from the server RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.1.6
func (*Connection) Reconnect ¶
func (irc *Connection) Reconnect() error
Reconnect to a server using the current connection.
func (*Connection) RemoveCallback ¶
func (irc *Connection) RemoveCallback(eventcode string, i int) bool
Remove callback i (ID) from the given event code. This functions returns true upon success, false if any error occurs.
func (*Connection) ReplaceCallback ¶
func (irc *Connection) ReplaceCallback(eventcode string, i int, callback func(*Event))
Replace callback i (ID) associated with a given event code with a new callback function.
func (*Connection) RunCallbacks ¶
func (irc *Connection) RunCallbacks(event *Event)
Execute all callbacks associated with a given event.
func (*Connection) SendRawf ¶
func (irc *Connection) SendRawf(format string, a ...interface{})
Send raw formated string.
func (*Connection) Who ¶
func (irc *Connection) Who(nick string)
Query information about a given nickname in the server. RFC 1459 details: https://tools.ietf.org/html/rfc1459#section-4.5.1
func (*Connection) Whois ¶
func (irc *Connection) Whois(nick string)
Query information about a particular nickname. RFC 1459: https://tools.ietf.org/html/rfc1459#section-4.5.2