mailbox activation, closes #52

This commit is contained in:
Aine
2022-11-21 15:37:44 +02:00
parent a5edaaea78
commit 21772d7360
15 changed files with 186 additions and 17 deletions

View File

@@ -14,6 +14,7 @@ const acRoomSettingsKey = "cc.etke.postmoogle.settings"
// option keys
const (
roomOptionActive = ".active"
roomOptionOwner = "owner"
roomOptionMailbox = "mailbox"
roomOptionDomain = "domain"
@@ -55,6 +56,10 @@ func (s roomSettings) Owner() string {
return s.Get(roomOptionOwner)
}
func (s roomSettings) Active() bool {
return utils.Bool(s.Get(roomOptionActive))
}
func (s roomSettings) Password() string {
return s.Get(roomOptionPassword)
}
@@ -188,6 +193,9 @@ func (b *Bot) migrateRoomSettings(roomID id.RoomID) {
b.log.Error("cannot retrieve room settings: %v", err)
return
}
if _, ok := cfg[roomOptionActive]; !ok {
cfg.Set(roomOptionActive, "true")
}
if cfg["spamlist:emails"] == "" && cfg["spamlist:localparts"] == "" && cfg["spamlist:hosts"] == "" {
return