diff --git a/client.go b/client.go index 4909d97..eb122b5 100644 --- a/client.go +++ b/client.go @@ -12,22 +12,22 @@ import ( const MSG_BUFFER int = 10 const HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available commands: - /about - About this chat - /exit - Exit the chat - /help - Show this help text - /list - List the users that are currently connected - /me $ACTION - Show yourself doing an action - /nick $NAME - Rename yourself to a new name - /whois $NAME - Display information about another connected user - /msg $NAME $MESSAGE - /beep - Enable BEL notifications on mention. + /about - About this chat. + /exit - Exit the chat. + /help - Show this help text. + /list - List the users that are currently connected. + /me $ACTION - Show yourself doing an action. + /nick $NAME - Rename yourself to a new name. + /whois $NAME - Display information about another connected user. + /msg $NAME $MESSAGE - Send a private message to another user. + /beep - Enable BEL notifications on mention. ` + RESET const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands: - /ban $NAME - Banish a user from the chat - /kick $NAME - Kick em' out. - /op $NAME - Promote a user to server operator - /silence $NAME - Revoke a user's ability to speak + /ban $NAME - Banish a user from the chat + /kick $NAME - Kick em' out. + /op $NAME - Promote a user to server operator. + /silence $NAME - Revoke a user's ability to speak. ` const ABOUT_TEXT string = SYSTEM_MESSAGE_FORMAT + ` @@ -203,8 +203,15 @@ func (c *Client) handleShell(channel ssh.Channel) { c.SysMsg("Missing $NAME from: /whois $NAME") } case "/list": - names := c.Server.List(nil) - c.SysMsg("%d connected: %s", len(names), strings.Join(names, ", ")) + names := "" + nameList := c.Server.List(nil) + for _, name := range nameList { + names += c.Server.Who(name).ColoredName() + SYSTEM_MESSAGE_FORMAT + ", " + } + if len(names) > 2 { + names = names[:len(names) - 2] + } + c.SysMsg("%d connected: %s", len(nameList), names) case "/ban": if !c.Server.IsOp(c) { c.SysMsg("You're not an admin.") diff --git a/server.go b/server.go index c7c9aef..b14f8b1 100644 --- a/server.go +++ b/server.go @@ -313,7 +313,11 @@ func (s *Server) AutoCompleteFunction(line string, pos int, key rune) (newLine s if len(nicks) > 0 { nick := nicks[len(nicks)-1] posPartialNick := pos - len(partialNick) - + if len(shortLine) < 2 { + nick += ": " + } else { + nick += " " + } newLine = strings.Replace(line[posPartialNick:], partialNick, nick, 1) newLine = line[:posPartialNick] + newLine