From 5dbc9e3b3738c07219099e8c072795c293e42e62 Mon Sep 17 00:00:00 2001 From: Ivanq Date: Wed, 29 Dec 2021 12:04:49 +0300 Subject: [PATCH 1/2] Bridge emote messages from sshchat --- bridge/sshchat/sshchat.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bridge/sshchat/sshchat.go b/bridge/sshchat/sshchat.go index c47a33d5a1..c62b47bc1f 100644 --- a/bridge/sshchat/sshchat.go +++ b/bridge/sshchat/sshchat.go @@ -141,7 +141,8 @@ func (b *Bsshchat) handleSSHChat() error { continue } // skip our own messages - res := strings.Split(stripPrompt(b.r.Text()), ":") + text := stripPrompt(b.r.Text()) + res := strings.Split(text, ":") if res[0] == "-> Set theme" { wait = false b.Log.Debugf("mono found, allowing") @@ -149,8 +150,16 @@ func (b *Bsshchat) handleSSHChat() error { } if !wait { b.Log.Debugf("<= Message %#v", res) - rmsg := config.Message{Username: res[0], Text: strings.TrimSpace(strings.Join(res[1:], ":")), Channel: "sshchat", Account: b.Account, UserID: "nick"} - b.Remote <- rmsg + if strings.HasPrefix(text, "** ") { + // Emote + res := strings.Split(text[3:], " ") + rmsg := config.Message{Username: res[0], Text: strings.TrimSpace(strings.Join(res[1:], " ")), Channel: "sshchat", Account: b.Account, UserID: "nick", Event: config.EventUserAction} + b.Remote <- rmsg + } else { + // Normal message + rmsg := config.Message{Username: res[0], Text: strings.TrimSpace(strings.Join(res[1:], ":")), Channel: "sshchat", Account: b.Account, UserID: "nick"} + b.Remote <- rmsg + } } } } From 0b6f8dfed8b8404de10ba67f90a6161f4b7ea7d4 Mon Sep 17 00:00:00 2001 From: Ivanq Date: Wed, 29 Dec 2021 14:17:54 +0300 Subject: [PATCH 2/2] Use italics for event messages on Telegram --- bridge/telegram/telegram.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index d696e9bc55..0b3edcceff 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -99,6 +99,10 @@ func (b *Btelegram) Send(msg config.Message) (string, error) { return b.cacheAvatar(&msg) } + if msg.Event == config.EventUserAction { + msg.Text = "_" + msg.Text + "_" + } + if b.GetString("MessageFormat") == HTMLFormat { msg.Text = makeHTML(msg.Text) }