mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 10:10:08 -08:00
Update a bunch of messages and fix reply struct embedding.
This commit is contained in:
parent
8e5ff51257
commit
c42cd92f91
9 changed files with 292 additions and 218 deletions
|
|
@ -35,7 +35,7 @@ func NewClient(server *Server, conn net.Conn) *Client {
|
|||
|
||||
client := &Client{
|
||||
conn: conn,
|
||||
hostname: LookupHostname(conn.RemoteAddr()),
|
||||
hostname: conn.RemoteAddr().String(),
|
||||
server: server,
|
||||
replies: replies,
|
||||
}
|
||||
|
|
@ -73,57 +73,57 @@ func (c *Client) writeConn(write chan<- string, replies <-chan Reply) {
|
|||
}
|
||||
}
|
||||
|
||||
func (c Client) Replies() chan<- Reply {
|
||||
func (c *Client) Replies() chan<- Reply {
|
||||
return c.replies
|
||||
}
|
||||
|
||||
func (c Client) Server() *Server {
|
||||
func (c *Client) Server() *Server {
|
||||
return c.server
|
||||
}
|
||||
|
||||
func (c Client) Nick() string {
|
||||
func (c *Client) Nick() string {
|
||||
if c.user != nil {
|
||||
return c.user.nick
|
||||
return c.user.Nick()
|
||||
}
|
||||
|
||||
if c.nick != "" {
|
||||
return c.nick
|
||||
}
|
||||
|
||||
return "*"
|
||||
return "guest"
|
||||
}
|
||||
|
||||
func (c Client) UModeString() string {
|
||||
func (c *Client) UModeString() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c Client) HasNick() bool {
|
||||
return c.nick != ""
|
||||
func (c *Client) HasNick() bool {
|
||||
return c.Nick() != ""
|
||||
}
|
||||
|
||||
func (c Client) HasUser() bool {
|
||||
func (c *Client) HasUsername() bool {
|
||||
return c.username != ""
|
||||
}
|
||||
|
||||
func (c Client) Username() string {
|
||||
if c.HasUser() {
|
||||
func (c *Client) Username() string {
|
||||
if c.HasUsername() {
|
||||
return c.username
|
||||
}
|
||||
return "*"
|
||||
return "guest"
|
||||
}
|
||||
|
||||
func (c Client) UserHost() string {
|
||||
func (c *Client) UserHost() string {
|
||||
return fmt.Sprintf("%s!%s@%s", c.Nick(), c.Username(), c.hostname)
|
||||
}
|
||||
|
||||
func (c Client) Id() string {
|
||||
func (c *Client) Id() string {
|
||||
return c.UserHost()
|
||||
}
|
||||
|
||||
func (c Client) String() string {
|
||||
return c.Id()
|
||||
func (c *Client) String() string {
|
||||
return c.hostname
|
||||
}
|
||||
|
||||
func (c Client) PublicId() string {
|
||||
func (c *Client) PublicId() string {
|
||||
return fmt.Sprintf("%s!%s@%s", c.Nick(), c.Nick(), c.server.Id())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue