show multi-domain aliases everywhere

This commit is contained in:
Aine
2022-11-08 21:21:06 +02:00
parent 15d5afe90f
commit 9cfe0a6d4f
5 changed files with 35 additions and 14 deletions

View File

@@ -261,8 +261,8 @@ func (b *Bot) sendIntroduction(ctx context.Context, roomID id.RoomID) {
msg.WriteString(roomOptionMailbox)
msg.WriteString(" SOME_INBOX` command.\n")
msg.WriteString("You will then be able to send emails to `SOME_INBOX@")
msg.WriteString(b.domains[0])
msg.WriteString("You will then be able to send emails to ")
msg.WriteString(utils.EmailsList("SOME_INBOX", b.domains))
msg.WriteString("` and have them appear in this room.")
b.SendNotice(ctx, roomID, msg.String())
@@ -300,8 +300,9 @@ func (b *Bot) sendHelp(ctx context.Context) {
msg.WriteString("(currently `")
msg.WriteString(value)
if cmd.key == roomOptionMailbox {
msg.WriteString("@")
msg.WriteString(b.domains[0])
msg.WriteString(" (")
msg.WriteString(utils.EmailsList(value, b.domains))
msg.WriteString(")")
}
msg.WriteString("`)")
}

View File

@@ -53,9 +53,7 @@ func (b *Bot) sendMailboxes(ctx context.Context) {
for _, mailbox := range slice {
cfg := mailboxes[mailbox]
msg.WriteString("* `")
msg.WriteString(mailbox)
msg.WriteString("@")
msg.WriteString(b.domains[0])
msg.WriteString(utils.EmailsList(mailbox, b.domains))
msg.WriteString("` by ")
msg.WriteString(cfg.Owner())
msg.WriteString("\n")
@@ -160,7 +158,7 @@ func (b *Bot) runDKIM(ctx context.Context, commandSlice []string) {
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf(
"DKIM signature is: `%s`.\n"+
"You need to add it to your DNS records (if not already):\n"+
"You need to add it to DNS records of all domains added to postmoogle (if not already):\n"+
"Add new DNS record with type = `TXT`, key (subdomain/from): `postmoogle._domainkey` and value (to):\n ```\n%s\n```\n"+
"Without that record other email servers may reject your emails as spam, kupo.\n"+
"To reset the signature, send `%s dkim reset`",
@@ -175,6 +173,9 @@ func (b *Bot) runCatchAll(ctx context.Context, commandSlice []string) {
msg.WriteString("Currently: `")
if cfg.CatchAll() != "" {
msg.WriteString(cfg.CatchAll())
msg.WriteString(" (")
msg.WriteString(utils.EmailsList(cfg.CatchAll(), b.domains))
msg.WriteString(")")
} else {
msg.WriteString("not set")
}
@@ -202,5 +203,5 @@ func (b *Bot) runCatchAll(ctx context.Context, commandSlice []string) {
return
}
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Catch-all is set to: `%s@%s`.", mailbox, b.domains[0]))
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Catch-all is set to: `%s` (%s).", mailbox, utils.EmailsList(mailbox, b.domains)))
}

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"github.com/raja/argon2pw"
"gitlab.com/etke.cc/postmoogle/utils"
)
func (b *Bot) runStop(ctx context.Context) {
@@ -58,7 +60,7 @@ func (b *Bot) getOption(ctx context.Context, name string) {
}
if name == roomOptionMailbox {
value = value + "@" + b.domains[0]
value = utils.EmailsList(value, b.domains)
}
msg := fmt.Sprintf("`%s` of this room is `%s`\n"+
@@ -85,7 +87,7 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
if name == roomOptionMailbox {
existingID, ok := b.getMapping(value)
if ok && existingID != "" && existingID != evt.RoomID {
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Mailbox `%s@%s` already taken, kupo", value, b.domains[0]))
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Mailbox `%s` (%s) already taken, kupo", value, utils.EmailsList(value, b.domains)))
return
}
}