mirror of
https://github.com/Rudi9719/kbtui.git
synced 2026-03-22 15:37: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"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -42,11 +43,6 @@ func main() {
|
|||||||
defer g.Close()
|
defer g.Close()
|
||||||
g.SetManagerFunc(layout)
|
g.SetManagerFunc(layout)
|
||||||
RunCommand("config", "load")
|
RunCommand("config", "load")
|
||||||
if dev {
|
|
||||||
channel.TopicType = "dev"
|
|
||||||
} else {
|
|
||||||
channel.TopicType = "chat"
|
|
||||||
}
|
|
||||||
go populateList()
|
go populateList()
|
||||||
go updateChatWindow()
|
go updateChatWindow()
|
||||||
if len(os.Args) > 1 {
|
if len(os.Args) > 1 {
|
||||||
@ -386,11 +382,6 @@ func populateChat() {
|
|||||||
if channel.Name == testChan.Name {
|
if channel.Name == testChan.Name {
|
||||||
channel = testChan
|
channel = testChan
|
||||||
channel.TopicName = "general"
|
channel.TopicName = "general"
|
||||||
if dev {
|
|
||||||
channel.TopicType = "dev"
|
|
||||||
} else {
|
|
||||||
channel.TopicType = "chat"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chat = k.NewChat(channel)
|
chat = k.NewChat(channel)
|
||||||
@ -434,13 +425,16 @@ func populateList() {
|
|||||||
log.Printf("%+v", err)
|
log.Printf("%+v", err)
|
||||||
} else {
|
} else {
|
||||||
clearView("List")
|
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 textBase = config.Colors.Channels.Basic.stylize("")
|
||||||
var recentPMs = textBase.append(config.Colors.Channels.Header.stylize("---[PMs]---\n"))
|
var recentPMs = textBase.append(config.Colors.Channels.Header.stylize("---[PMs]---\n"))
|
||||||
var recentPMsCount = 0
|
var recentPMsCount = 0
|
||||||
var recentChannels = textBase.append(config.Colors.Channels.Header.stylize("---[Teams]---\n"))
|
var recentChannels = textBase.append(config.Colors.Channels.Header.stylize("---[Teams]---\n"))
|
||||||
var recentChannelsCount = 0
|
var recentChannelsCount = 0
|
||||||
for _, s := range testVar.Result.Conversations {
|
for _, s := range conversationSlice {
|
||||||
channels = append(channels, s.Channel)
|
channels = append(channels, s.Channel)
|
||||||
if s.Channel.MembersType == keybase.TEAM {
|
if s.Channel.MembersType == keybase.TEAM {
|
||||||
recentChannelsCount++
|
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 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 &&
|
if channel.MembersType == keybase.USER || channel.MembersType == keybase.TEAM && channel.TopicName == api.Msg.Channel.TopicName {
|
||||||
channel.TopicType == api.Msg.Channel.TopicType {
|
|
||||||
printToView("Chat", formatOutput(api).string())
|
printToView("Chat", formatOutput(api).string())
|
||||||
chat := k.NewChat(channel)
|
chat := k.NewChat(channel)
|
||||||
lastMessage.ID = api.Msg.ID
|
lastMessage.ID = api.Msg.ID
|
||||||
|
|||||||
Reference in New Issue
Block a user