allow reserved mailboxes, closes #43

This commit is contained in:
Aine
2022-11-20 20:55:41 +02:00
parent 117736dcf3
commit 6ddb894577
7 changed files with 31 additions and 8 deletions

View File

@@ -86,7 +86,7 @@ func (b *Bot) setOption(ctx context.Context, name, value string) {
evt := eventFromContext(ctx)
if name == roomOptionMailbox {
existingID, ok := b.getMapping(value)
if ok && existingID != "" && existingID != evt.RoomID {
if (ok && existingID != "" && existingID != evt.RoomID) || b.isReserved(value) {
b.SendNotice(ctx, evt.RoomID, fmt.Sprintf("Mailbox `%s` (%s) already taken, kupo", value, utils.EmailsList(value, "")))
return
}