mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-23 04:00:31 +03:00
Merge.
This commit is contained in:
commit
f2f5fa12cf
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
host_key
|
||||
host_key.pub
|
||||
ssh-chat
|
34
client.go
34
client.go
@ -13,22 +13,27 @@ const MSG_BUFFER int = 50
|
||||
const MAX_MSG_LENGTH int = 512
|
||||
|
||||
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
|
||||
/beep - Enable BEL notifications on mention.
|
||||
/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
|
||||
/about - About this chat.
|
||||
/exit - Exit the chat.
|
||||
/help - Show this help text.
|
||||
/list - List the users that are currently connected.
|
||||
/beep - Enable BEL notifications on mention.
|
||||
/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 - Sends a private message to a user.
|
||||
` + RESET
|
||||
|
||||
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
|
||||
<<<<<<< HEAD
|
||||
/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.
|
||||
` + RESET
|
||||
|
||||
const ABOUT_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> ssh-chat is made by @shazow.
|
||||
@ -217,8 +222,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.")
|
||||
|
@ -308,7 +308,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
|
||||
|
Loading…
x
Reference in New Issue
Block a user