summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--commands.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/commands.go b/commands.go
index 621b034..9bf2f13 100644
--- a/commands.go
+++ b/commands.go
@@ -64,6 +64,14 @@ func init() {
Desc: "show the member list of the current channel",
Handle: commandDoNames,
},
+ "NICK": {
+ AllowHome: true,
+ MinArgs: 1,
+ MaxArgs: 1,
+ Usage: "<nickname>",
+ Desc: "change your nickname",
+ Handle: commandDoNick,
+ },
"PART": {
AllowHome: true,
MaxArgs: 2,
@@ -250,6 +258,15 @@ func commandDoNames(app *App, buffer string, args []string) (err error) {
return
}
+func commandDoNick(app *App, buffer string, args []string) (err error) {
+ nick := args[0]
+ if i := strings.IndexAny(nick, " :@!*?"); i >= 0 {
+ return fmt.Errorf("illegal char %q in nickname", nick[i])
+ }
+ app.s.ChangeNick(nick)
+ return
+}
+
func commandDoPart(app *App, buffer string, args []string) (err error) {
channel := buffer
reason := ""