diff options
| -rw-r--r-- | client/channel_window.go | 14 | ||||
| -rw-r--r-- | client/command.go | 9 | ||||
| -rw-r--r-- | client/help.go | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/client/channel_window.go b/client/channel_window.go index b4c9b9f..f9ed5a8 100644 --- a/client/channel_window.go +++ b/client/channel_window.go @@ -112,6 +112,20 @@ func (cw *channelWindow) leaveChannel() { globalApp.windowCache.Evict(cw.location) } +func (cw *channelWindow) renameChannel(newName string) { + ch := proto.Object { + "channel", cw.location.id, map[string]string {"": newName}, + } + globalApp.sendUpdate(ch, func(response proto.Command) { + if response.Kind == "fail" { + if len(response.Args) > 0 { + f := proto.Fail(response.Args[0]) + globalApp.cmdWindow.err(f.Error()) + } + } + }) +} + func (cw *channelWindow) loadMoreHistory() { if cw.loadingHistory || cw.endOfHistory { return diff --git a/client/command.go b/client/command.go index 101a5aa..3dc3d26 100644 --- a/client/command.go +++ b/client/command.go @@ -79,6 +79,15 @@ func (a *application) doCommand(command string, args []string, text string) { win.(*channelWindow).leaveChannel() } a.currentWindow = cmdWindowLocation {} + case "rename": + if !argN(1) { + break + } + win := a.windowCache.Get(a.currentWindow) + switch win.(type) { + case *channelWindow: + win.(*channelWindow).renameChannel(args[0]) + } case "list": if !argN(0) { break diff --git a/client/help.go b/client/help.go index a6f1797..9465f20 100644 --- a/client/help.go +++ b/client/help.go @@ -16,6 +16,7 @@ var helpTexts = []helpText { helpText {"join", "<name>", "join the channel with this name"}, helpText {"list", "", "list users in the currently shown channel"}, helpText {"leave", "", "leave the currently shown channel"}, + helpText {"rename", "<name>", "rename the currently shown channel"}, helpText {"create", "<name>", "create a channel with this name"}, helpText {"quit", "", "exit the application"}, } |
