feat: add prefix for not implemented commands

This commit is contained in:
2022-02-19 12:27:25 +02:00
parent 220192da78
commit 6c538cc352
2 changed files with 14 additions and 1 deletions
+12 -1
View File
@@ -23,12 +23,16 @@ import (
"log"
"strings"
"github.com/charmbracelet/lipgloss"
"github.com/illusionman1212/gorc/cmds"
"github.com/illusionman1212/gorc/irc"
"github.com/illusionman1212/gorc/irc/commands"
"github.com/illusionman1212/gorc/irc/parser"
"github.com/illusionman1212/gorc/ui"
)
var notImpl = lipgloss.NewStyle().Foreground(ui.Red).Render("[NOT IMPL]")
func ReadLoop(client *irc.Client) {
// 512 bytes as a base + 8192 additional bytes for tags
r := bufio.NewReaderSize(client.TcpConn, 8192+512)
@@ -310,7 +314,14 @@ func HandleCommand(msg parser.IRCMessage, client *irc.Client) {
// start a timeout and update said timeout on every RPL_MOTD
// and log an error if timeout ends without receiving this command.
default:
fullMsg := fmt.Sprintf("%s %s %s %s", msg.Tags, msg.Source, msg.Command, strings.Join(msg.Parameters, " "))
fullMsg := fmt.Sprintf(
"%s %s %s %s %s",
notImpl,
msg.Tags,
msg.Source,
msg.Command,
strings.Join(msg.Parameters, " "),
)
client.Channels[0].History += fullMsg + irc.CRLF
}