minor documentation cleanup
This commit is contained in:
parent
d4614890d4
commit
63ae092b97
14
client.go
14
client.go
@ -157,6 +157,8 @@ var ErrNotConnected = errors.New("client is not connected to server")
|
|||||||
// ErrAlreadyConnecting implies that a connection attempt is already happening.
|
// ErrAlreadyConnecting implies that a connection attempt is already happening.
|
||||||
var ErrAlreadyConnecting = errors.New("a connection attempt is already occurring")
|
var ErrAlreadyConnecting = errors.New("a connection attempt is already occurring")
|
||||||
|
|
||||||
|
// ErrDisconnected is called when Config.Retries is less than 1, and we
|
||||||
|
// non-intentionally disconnected from the server.
|
||||||
var ErrDisconnected = errors.New("unexpectedly disconnected")
|
var ErrDisconnected = errors.New("unexpectedly disconnected")
|
||||||
|
|
||||||
// ErrInvalidTarget should be returned if the target which you are
|
// ErrInvalidTarget should be returned if the target which you are
|
||||||
@ -282,8 +284,8 @@ func (c *Client) connectMessages() (events []*Event) {
|
|||||||
return events
|
return events
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconnect checks to make sure we want to, and then attempts to reconnect
|
// reconnect is the internal wrapper for reconnecting to the IRC server (if
|
||||||
// to the server.
|
// requested.)
|
||||||
func (c *Client) reconnect(remoteInvoked bool) (err error) {
|
func (c *Client) reconnect(remoteInvoked bool) (err error) {
|
||||||
if c.reconnecting {
|
if c.reconnecting {
|
||||||
return ErrDisconnected
|
return ErrDisconnected
|
||||||
@ -323,7 +325,7 @@ func (c *Client) reconnect(remoteInvoked bool) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconnect checks to make sure we want to, and then attempts to reconnect
|
// Reconnect checks to make sure we want to, and then attempts to reconnect
|
||||||
// to the server. This will ignore the reconnect delay.
|
// to the server. This will ignore the reconnect delay.
|
||||||
func (c *Client) Reconnect() error {
|
func (c *Client) Reconnect() error {
|
||||||
return c.reconnect(true)
|
return c.reconnect(true)
|
||||||
@ -370,7 +372,7 @@ func (c *Client) Quit() {
|
|||||||
c.quit(true)
|
c.quit(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit disconnects from the server with a given message.
|
// QuitWithMessage disconnects from the server with a given message.
|
||||||
func (c *Client) QuitWithMessage(message string) {
|
func (c *Client) QuitWithMessage(message string) {
|
||||||
c.Send(&Event{Command: QUIT, Trailing: message})
|
c.Send(&Event{Command: QUIT, Trailing: message})
|
||||||
c.quit(false)
|
c.quit(false)
|
||||||
@ -802,7 +804,7 @@ func (c *Client) Who(target string) error {
|
|||||||
return c.Send(&Event{Command: WHO, Params: []string{target, "%tcuhnr,2"}})
|
return c.Send(&Event{Command: WHO, Params: []string{target, "%tcuhnr,2"}})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whois sends a WHOIS query to the server, targetted at a specific user.
|
// Whois sends a WHOIS query to the server, targeted at a specific user.
|
||||||
// as WHOIS is a bit slower, you may want to use WHO for brief user info.
|
// as WHOIS is a bit slower, you may want to use WHO for brief user info.
|
||||||
func (c *Client) Whois(nick string) error {
|
func (c *Client) Whois(nick string) error {
|
||||||
if !IsValidNick(nick) {
|
if !IsValidNick(nick) {
|
||||||
@ -879,7 +881,7 @@ func (c *Client) Back() error {
|
|||||||
return c.Send(&Event{Command: AWAY})
|
return c.Send(&Event{Command: AWAY})
|
||||||
}
|
}
|
||||||
|
|
||||||
// LIST sends a LIST query to the server, which will list channels and topics.
|
// List sends a LIST query to the server, which will list channels and topics.
|
||||||
// Supports multiple channels at once, in hopes it will reduce extensive
|
// Supports multiple channels at once, in hopes it will reduce extensive
|
||||||
// LIST queries to the server. Supply no channels to run a list against the
|
// LIST queries to the server. Supply no channels to run a list against the
|
||||||
// entire server (warning, that may mean LOTS of channels!)
|
// entire server (warning, that may mean LOTS of channels!)
|
||||||
|
3
event.go
3
event.go
@ -124,6 +124,9 @@ func ParseEvent(raw string) (e *Event) {
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy makes a deep copy of a given event, for use with allowing untrusted
|
||||||
|
// functions/handlers edit the event without causing potential issues with
|
||||||
|
// other handlers.
|
||||||
func (e *Event) Copy() *Event {
|
func (e *Event) Copy() *Event {
|
||||||
newEvent := &Event{}
|
newEvent := &Event{}
|
||||||
|
|
||||||
|
@ -389,9 +389,9 @@ type HandlerError struct {
|
|||||||
func (e *HandlerError) Error() string {
|
func (e *HandlerError) Error() string {
|
||||||
if e.callOk {
|
if e.callOk {
|
||||||
return fmt.Sprintf("panic during handler [%s] execution in %s (line %d): %s", e.ID, e.File, e.Line, e.Panic)
|
return fmt.Sprintf("panic during handler [%s] execution in %s (line %d): %s", e.ID, e.File, e.Line, e.Panic)
|
||||||
} else {
|
|
||||||
return fmt.Sprintf("panic during handler [%s] execution in unknown: %s", e.ID, e.Panic)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("panic during handler [%s] execution in unknown: %s", e.ID, e.Panic)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the error that panic returned, as well as the entire call
|
// String returns the error that panic returned, as well as the entire call
|
||||||
|
4
modes.go
4
modes.go
@ -383,7 +383,7 @@ type UserPerms struct {
|
|||||||
// ability to kick, without giving them greater abilities to ban all users.
|
// ability to kick, without giving them greater abilities to ban all users.
|
||||||
HalfOp bool
|
HalfOp bool
|
||||||
// Voice indicates the user has voice permissions, commonly given to known
|
// Voice indicates the user has voice permissions, commonly given to known
|
||||||
// users, wih very light trust, or to indicate a user is active.
|
// users, with very light trust, or to indicate a user is active.
|
||||||
Voice bool
|
Voice bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ func (m UserPerms) IsAdmin() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsAdmin indicates that the user at least has modes set upon them, higher
|
// IsTrusted indicates that the user at least has modes set upon them, higher
|
||||||
// than a regular joining user.
|
// than a regular joining user.
|
||||||
func (m UserPerms) IsTrusted() bool {
|
func (m UserPerms) IsTrusted() bool {
|
||||||
if m.IsAdmin() || m.HalfOp || m.Voice {
|
if m.IsAdmin() || m.HalfOp || m.Voice {
|
||||||
|
Loading…
Reference in New Issue
Block a user