mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 14:27:23 +00:00
Compare commits
2 Commits
ellipticcu
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
97e055dd61
|
|||
| 9b6bd7442b |
25
cmdDev.go
25
cmdDev.go
@ -1,25 +0,0 @@
|
||||
// +build !rm_basic_commands allcommands devcmd
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func init() {
|
||||
command := Command{
|
||||
Cmd: []string{"dev"},
|
||||
Description: "- Switch to dev channels",
|
||||
Help: "",
|
||||
Exec: cmdDev,
|
||||
}
|
||||
|
||||
RegisterCommand(command)
|
||||
}
|
||||
|
||||
func cmdDev(cmd []string) {
|
||||
dev = !dev
|
||||
|
||||
printInfo(fmt.Sprintf("You have toggled the dev flag to %+v", dev))
|
||||
clearView("Chat")
|
||||
}
|
||||
21
main.go
21
main.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -42,11 +43,6 @@ func main() {
|
||||
defer g.Close()
|
||||
g.SetManagerFunc(layout)
|
||||
RunCommand("config", "load")
|
||||
if dev {
|
||||
channel.TopicType = "dev"
|
||||
} else {
|
||||
channel.TopicType = "chat"
|
||||
}
|
||||
go populateList()
|
||||
go updateChatWindow()
|
||||
if len(os.Args) > 1 {
|
||||
@ -386,11 +382,6 @@ func populateChat() {
|
||||
if channel.Name == testChan.Name {
|
||||
channel = testChan
|
||||
channel.TopicName = "general"
|
||||
if dev {
|
||||
channel.TopicType = "dev"
|
||||
} else {
|
||||
channel.TopicType = "chat"
|
||||
}
|
||||
}
|
||||
}
|
||||
chat = k.NewChat(channel)
|
||||
@ -434,13 +425,16 @@ func populateList() {
|
||||
log.Printf("%+v", err)
|
||||
} else {
|
||||
clearView("List")
|
||||
|
||||
conversationSlice := testVar.Result.Conversations
|
||||
sort.SliceStable(conversationSlice, func(i, j int) bool {
|
||||
return conversationSlice[i].ActiveAt > conversationSlice[j].ActiveAt
|
||||
})
|
||||
var textBase = config.Colors.Channels.Basic.stylize("")
|
||||
var recentPMs = textBase.append(config.Colors.Channels.Header.stylize("---[PMs]---\n"))
|
||||
var recentPMsCount = 0
|
||||
var recentChannels = textBase.append(config.Colors.Channels.Header.stylize("---[Teams]---\n"))
|
||||
var recentChannelsCount = 0
|
||||
for _, s := range testVar.Result.Conversations {
|
||||
for _, s := range conversationSlice {
|
||||
channels = append(channels, s.Channel)
|
||||
if s.Channel.MembersType == keybase.TEAM {
|
||||
recentChannelsCount++
|
||||
@ -632,8 +626,7 @@ func handleMessage(api keybase.ChatAPI) {
|
||||
}
|
||||
}
|
||||
if api.Msg.Channel.MembersType == channel.MembersType && cleanChannelName(api.Msg.Channel.Name) == channel.Name {
|
||||
if channel.MembersType == keybase.USER || channel.MembersType == keybase.TEAM && channel.TopicName == api.Msg.Channel.TopicName &&
|
||||
channel.TopicType == api.Msg.Channel.TopicType {
|
||||
if channel.MembersType == keybase.USER || channel.MembersType == keybase.TEAM && channel.TopicName == api.Msg.Channel.TopicName {
|
||||
printToView("Chat", formatOutput(api).string())
|
||||
chat := k.NewChat(channel)
|
||||
lastMessage.ID = api.Msg.ID
|
||||
|
||||
Reference in New Issue
Block a user