additional return value consistency
This commit is contained in:
parent
20a9ec00f5
commit
783298a3a4
12
client.go
12
client.go
@ -387,7 +387,7 @@ func (c *Client) ConnSince() (since *time.Duration, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsConnected returns true if the client is connected to the server.
|
// IsConnected returns true if the client is connected to the server.
|
||||||
func (c *Client) IsConnected() (connected bool) {
|
func (c *Client) IsConnected() bool {
|
||||||
c.mu.RLock()
|
c.mu.RLock()
|
||||||
if c.conn == nil {
|
if c.conn == nil {
|
||||||
c.mu.RUnlock()
|
c.mu.RUnlock()
|
||||||
@ -395,7 +395,7 @@ func (c *Client) IsConnected() (connected bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.conn.mu.RLock()
|
c.conn.mu.RLock()
|
||||||
connected = c.conn.connected
|
connected := c.conn.connected
|
||||||
c.conn.mu.RUnlock()
|
c.conn.mu.RUnlock()
|
||||||
c.mu.RUnlock()
|
c.mu.RUnlock()
|
||||||
|
|
||||||
@ -562,21 +562,21 @@ func (c *Client) NetworkName() (name string) {
|
|||||||
// supplied this information during connection. May be empty if the server
|
// supplied this information during connection. May be empty if the server
|
||||||
// does not support RPL_MYINFO. Will panic if used when tracking has been
|
// does not support RPL_MYINFO. Will panic if used when tracking has been
|
||||||
// disabled.
|
// disabled.
|
||||||
func (c *Client) ServerVersion() (version string) {
|
func (c *Client) ServerVersion() string {
|
||||||
c.panicIfNotTracking()
|
c.panicIfNotTracking()
|
||||||
|
|
||||||
version, _ = c.GetServerOption("VERSION")
|
version, _ := c.GetServerOption("VERSION")
|
||||||
|
|
||||||
return version
|
return version
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServerMOTD returns the servers message of the day, if the server has sent
|
// ServerMOTD returns the servers message of the day, if the server has sent
|
||||||
// it upon connect. Will panic if used when tracking has been disabled.
|
// it upon connect. Will panic if used when tracking has been disabled.
|
||||||
func (c *Client) ServerMOTD() (motd string) {
|
func (c *Client) ServerMOTD() string {
|
||||||
c.panicIfNotTracking()
|
c.panicIfNotTracking()
|
||||||
|
|
||||||
c.state.RLock()
|
c.state.RLock()
|
||||||
motd = c.state.motd
|
motd := c.state.motd
|
||||||
c.state.RUnlock()
|
c.state.RUnlock()
|
||||||
|
|
||||||
return motd
|
return motd
|
||||||
|
@ -291,7 +291,9 @@ func IsValidUser(name string) bool {
|
|||||||
// ToRFC1459 converts a string to the stripped down conversion within RFC
|
// ToRFC1459 converts a string to the stripped down conversion within RFC
|
||||||
// 1459. This will do things like replace an "A" with an "a", "[]" with "{}",
|
// 1459. This will do things like replace an "A" with an "a", "[]" with "{}",
|
||||||
// and so forth. Useful to compare two nicknames or channels.
|
// and so forth. Useful to compare two nicknames or channels.
|
||||||
func ToRFC1459(input string) (out string) {
|
func ToRFC1459(input string) string {
|
||||||
|
var out string
|
||||||
|
|
||||||
for i := 0; i < len(input); i++ {
|
for i := 0; i < len(input); i++ {
|
||||||
if input[i] >= 65 && input[i] <= 94 {
|
if input[i] >= 65 && input[i] <= 94 {
|
||||||
out += string(rune(input[i]) + 32)
|
out += string(rune(input[i]) + 32)
|
||||||
|
Loading…
Reference in New Issue
Block a user