From e4acbb31f09ed3e5da423dd5ef46d920827d6550 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Wed, 24 Aug 2022 07:37:34 +0300 Subject: [PATCH] Add nosubject option --- bot/bot.go | 8 +++++--- bot/command.go | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/bot/bot.go b/bot/bot.go index 6cbc4dd..402a391 100644 --- a/bot/bot.go +++ b/bot/bot.go @@ -107,9 +107,11 @@ func (b *Bot) Send(ctx context.Context, from, to, subject, plaintext, html strin text.WriteString(from) text.WriteString("\n\n") } - text.WriteString("# ") - text.WriteString(subject) - text.WriteString("\n\n") + if !utils.Bool(settings.Get("nosubject")) { + text.WriteString("# ") + text.WriteString(subject) + text.WriteString("\n\n") + } if html != "" { text.WriteString(format.HTMLToMarkdown(html)) } else { diff --git a/bot/command.go b/bot/command.go index 7a51b35..1d5caf8 100644 --- a/bot/command.go +++ b/bot/command.go @@ -20,15 +20,17 @@ var ( "help": "Get help", // options commands - "mailbox": "Get or set mailbox of that room", - "owner": "Get or set owner of that room", - "nosender": "Get or set `nosender` of that room (`true` - hide email sender; `false` - show email sender)", + "mailbox": "Get or set mailbox of that room", + "owner": "Get or set owner of that room", + "nosender": "Get or set `nosender` of that room (`true` - hide email sender; `false` - show email sender)", + "nosubject": "Get or set `nosubject` of that room (`true` - hide email subject; `false` - show email subject)", } // sanitizers is map of option name => sanitizer function sanitizers = map[string]sanitizerFunc{ - "mailbox": utils.Mailbox, - "nosender": utils.SanitizeBoolString, + "mailbox": utils.Mailbox, + "nosender": utils.SanitizeBoolString, + "nosubject": utils.SanitizeBoolString, } )