mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-02 00:21:04 +03:00
Merge pull request #39 from jazzychad/whitelist_cmd
adds /whitelist command for ops
This commit is contained in:
commit
f79ada5d63
21
client.go
21
client.go
@ -26,11 +26,12 @@ const HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available commands:
|
|||||||
` + RESET
|
` + RESET
|
||||||
|
|
||||||
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
|
const OP_HELP_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> Available operator commands:
|
||||||
/ban $NAME - Banish a user from the chat
|
/ban $NAME - Banish a user from the chat
|
||||||
/kick $NAME - Kick em' out.
|
/kick $NAME - Kick em' out.
|
||||||
/op $NAME - Promote a user to server operator.
|
/op $NAME - Promote a user to server operator.
|
||||||
/silence $NAME - Revoke a user's ability to speak.
|
/silence $NAME - Revoke a user's ability to speak.
|
||||||
/motd $MESSAGE - Sets the Message of the Day
|
/motd $MESSAGE - Sets the Message of the Day
|
||||||
|
/whitelist $FINGERPRINT - Adds pubkey fingerprint to the connection whitelist
|
||||||
` + RESET
|
` + RESET
|
||||||
|
|
||||||
const ABOUT_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> ssh-chat is made by @shazow.
|
const ABOUT_TEXT string = SYSTEM_MESSAGE_FORMAT + `-> ssh-chat is made by @shazow.
|
||||||
@ -324,6 +325,16 @@ func (c *Client) handleShell(channel ssh.Channel) {
|
|||||||
c.Server.SetMotd(newmotd)
|
c.Server.SetMotd(newmotd)
|
||||||
c.Server.MotdBroadcast(c)
|
c.Server.MotdBroadcast(c)
|
||||||
}
|
}
|
||||||
|
case "/whitelist": /* whitelist a fingerprint */
|
||||||
|
if !c.Server.IsOp(c) {
|
||||||
|
c.SysMsg("You're not an admin.")
|
||||||
|
} else if len(parts) != 2 {
|
||||||
|
c.SysMsg("Missing $FINGERPRINT from: /whitelist $FINGERPRINT")
|
||||||
|
} else {
|
||||||
|
fingerprint := parts[1]
|
||||||
|
c.Server.Whitelist(fingerprint)
|
||||||
|
c.SysMsg("Added %s to the whitelist", fingerprint)
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c.SysMsg("Invalid command: %s", line)
|
c.SysMsg("Invalid command: %s", line)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user