diff --git a/persistence/sessions.go b/persistence/sessions.go index bc71fd6..18d748e 100644 --- a/persistence/sessions.go +++ b/persistence/sessions.go @@ -39,6 +39,7 @@ type Session struct { KeepOnline bool `yaml:":keeponline"` RawMessages bool `yaml:":rawmessages"` AsciiArrows bool `yaml:":asciiarrows"` + MUC bool `yaml:":muc"` } var configKeys = []string{ @@ -46,6 +47,7 @@ var configKeys = []string{ "keeponline", "rawmessages", "asciiarrows", + "muc", } var sessionDB *SessionsYamlDB @@ -118,6 +120,8 @@ func (s *Session) Get(key string) (string, error) { return fromBool(s.RawMessages), nil case "asciiarrows": return fromBool(s.AsciiArrows), nil + case "muc": + return fromBool(s.MUC), nil } return "", errors.New("Unknown session property") @@ -161,6 +165,13 @@ func (s *Session) Set(key string, value string) (string, error) { } s.AsciiArrows = b return value, nil + case "muc": + b, err := toBool(value) + if err != nil { + return "", err + } + s.MUC = b + return value, nil } return "", errors.New("Unknown session property") diff --git a/persistence/sessions_test.go b/persistence/sessions_test.go index 76f71f9..c553e95 100644 --- a/persistence/sessions_test.go +++ b/persistence/sessions_test.go @@ -47,11 +47,13 @@ func TestSessionToMap(t *testing.T) { session := Session{ Timezone: "klsf", RawMessages: true, + MUC: true, } m := session.ToMap() sample := map[string]string{ "timezone": "klsf", "keeponline": "false", + "muc": "true", "rawmessages": "true", "asciiarrows": "false", }