add !pm signature option

This commit is contained in:
Aine
2023-09-23 16:35:12 +03:00
parent 74defa85e4
commit 480c99cf79
5 changed files with 39 additions and 1 deletions

View File

@@ -158,6 +158,8 @@ func (b *Bot) IncomingEmail(ctx context.Context, email *email.Email) error {
}
// SendEmailReply sends replies from matrix thread to email thread
//
//nolint:gocognit // TODO
func (b *Bot) SendEmailReply(ctx context.Context) {
evt := eventFromContext(ctx)
if !b.allowSend(evt.Sender, evt.RoomID) {
@@ -194,10 +196,17 @@ func (b *Bot) SendEmailReply(ctx context.Context) {
if meta.Subject == "" {
meta.Subject = strings.SplitN(content.Body, "\n", 1)[0]
}
signature := format.RenderMarkdown(cfg.Signature(), true, true)
body := content.Body
if signature.Body != "" {
body += "\n\n---\n" + signature.Body
}
var htmlBody string
if !cfg.NoHTML() {
htmlBody = content.FormattedBody
if htmlBody != "" && signature.FormattedBody != "" {
htmlBody += "<br><hr><br>" + signature.FormattedBody
}
}
meta.MessageID = email.MessageID(evt.ID, meta.FromDomain)