1
0
Fork 0
forked from External/ergo

Implement nick changing.

This commit is contained in:
Jeremy Latt 2012-04-17 21:13:12 -07:00
parent 99364e8b5f
commit e7734f572b
4 changed files with 34 additions and 6 deletions

View file

@ -2,6 +2,7 @@ package irc
import (
"net"
"strings"
)
type Client struct {
@ -46,3 +47,20 @@ func (c *Client) UModeString() string {
}
return ""
}
func (c *Client) HasNick() bool {
return c.nick != ""
}
func (c *Client) HasUser() bool {
return c.username != ""
}
func (c *Client) Hostname() string {
addr := c.conn.RemoteAddr().String()
index := strings.LastIndex(addr, ":")
if index != -1 {
return addr[0:index]
}
return addr
}