mirror of https://github.com/Rudi9719/kbtui.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
5 years ago
|
// +build !rm_basic_commands allcommands joincmd
|
||
|
|
||
|
package main
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/jroimartin/gocui"
|
||
|
"samhofi.us/x/keybase"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
command := Command{
|
||
|
Cmd: []string{"j", "join"},
|
||
|
Description: "Join a channel",
|
||
|
Help: "",
|
||
|
Exec: cmdJoin,
|
||
|
}
|
||
|
|
||
|
RegisterCommand(command)
|
||
|
}
|
||
|
|
||
|
func cmdJoin(g *gocui.Gui, cmd []string) {
|
||
|
stream = false
|
||
|
if len(cmd) == 3 {
|
||
|
channel.MembersType = keybase.TEAM
|
||
|
channel.Name = cmd[1]
|
||
|
channel.TopicName = cmd[2]
|
||
|
printToView(g, "Feed", fmt.Sprintf("You are joining: @%s#%s", channel.Name, channel.TopicName))
|
||
|
clearView(g, "Chat")
|
||
|
go populateChat(g)
|
||
|
} else if len(cmd) == 2 {
|
||
|
channel.MembersType = keybase.USER
|
||
|
channel.Name = cmd[1]
|
||
|
channel.TopicName = ""
|
||
|
printToView(g, "Feed", fmt.Sprintf("You are joining: @%s", channel.Name))
|
||
|
clearView(g, "Chat")
|
||
|
go populateChat(g)
|
||
|
} else {
|
||
|
printToView(g, "Feed", fmt.Sprintf("To join a team use %sjoin <team> <channel>", cmdPrefix))
|
||
|
printToView(g, "Feed", fmt.Sprintf("To join a PM use %sjoin <user>", cmdPrefix))
|
||
|
}
|
||
|
}
|