From 9f24a1e54f391d00c6b18d54cf36bde9995b353f Mon Sep 17 00:00:00 2001 From: 7x11x13 Date: Sat, 13 Jul 2024 11:25:20 -0400 Subject: [PATCH] Soulseek: implement user actions --- bridge/soulseek/handlers.go | 5 +++++ bridge/soulseek/soulseek.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bridge/soulseek/handlers.go b/bridge/soulseek/handlers.go index 0b86cb3c..292c66dc 100644 --- a/bridge/soulseek/handlers.go +++ b/bridge/soulseek/handlers.go @@ -42,6 +42,11 @@ func (b *Bsoulseek) handleChatMessage(msg sayChatroomMessageReceive) { Channel: msg.Room, Username: msg.Username, } + if strings.HasPrefix(msg.Message, "/me ") { + // user action + bridgeMessage.Text = msg.Message[4:] + bridgeMessage.Event = config.EventUserAction + } b.local <- bridgeMessage } diff --git a/bridge/soulseek/soulseek.go b/bridge/soulseek/soulseek.go index bf891203..f7e12d5c 100644 --- a/bridge/soulseek/soulseek.go +++ b/bridge/soulseek/soulseek.go @@ -211,7 +211,11 @@ func (b *Bsoulseek) Send(msg config.Message) (string, error) { if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave { return "", nil } - b.messagesToSend <- makeSayChatroomMessage(msg.Channel, msg.Username+msg.Text) + text := msg.Username+msg.Text + if msg.Event == config.EventUserAction { + text = msg.Username + "/me " + msg.Text + } + b.messagesToSend <- makeSayChatroomMessage(msg.Channel, text) return "", nil }