From 3821891898029e465b7c29b0555fc8db75467f00 Mon Sep 17 00:00:00 2001 From: ellipticcurv3 <14904229+ellipticcurv3@users.noreply.github.com> Date: Sat, 7 Dec 2019 02:23:26 +0100 Subject: [PATCH 1/2] Made the dev flag actually usable With this commit it is possible to set the dev flag to true, which will allow you to send and receive chat messages in dev channels only. You can use this to test kbtui without being disruptive. --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e1f14b5..2ce81ac 100644 --- a/main.go +++ b/main.go @@ -42,6 +42,7 @@ 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 { @@ -381,6 +382,7 @@ 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) @@ -602,8 +604,9 @@ 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 { - printToView("Chat", formatOutput(api).string()) + 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)) chat := k.NewChat(channel) lastMessage.ID = api.Msg.ID chat.Read(api.Msg.ID) From 01bb599f56448be8452f03bb6c7d30255508053c Mon Sep 17 00:00:00 2001 From: ellipticcurv3 <14904229+ellipticcurv3@users.noreply.github.com> Date: Sat, 7 Dec 2019 02:39:18 +0100 Subject: [PATCH 2/2] Amend: put `.string()` back I have no idea why it disappeared --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 2ce81ac..711a122 100644 --- a/main.go +++ b/main.go @@ -606,7 +606,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 { - printToView("Chat", formatOutput(api)) + printToView("Chat", formatOutput(api).string()) chat := k.NewChat(channel) lastMessage.ID = api.Msg.ID chat.Read(api.Msg.ID)