diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-01-16 04:35:13 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2023-01-16 04:35:13 +0300 |
commit | b3b53b6145c4b8e31d134942507c3ce0226182a4 (patch) | |
tree | 4f0753727317859504c26dd5bd4f338991db9082 /persistence | |
parent | 68e3581724f04366c114f267b3264075bc635061 (diff) |
OOB
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/sessions.go | 11 | ||||
-rw-r--r-- | persistence/sessions_test.go | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/persistence/sessions.go b/persistence/sessions.go index bc71fd6..ed95f60 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"` + OOBMode bool `yaml:":oobmode"` } var configKeys = []string{ @@ -46,6 +47,7 @@ var configKeys = []string{ "keeponline", "rawmessages", "asciiarrows", + "oobmode", } 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 "oobmode": + return fromBool(s.OOBMode), 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 "oobmode": + b, err := toBool(value) + if err != nil { + return "", err + } + s.OOBMode = b + return value, nil } return "", errors.New("Unknown session property") diff --git a/persistence/sessions_test.go b/persistence/sessions_test.go index 76f71f9..c8e3077 100644 --- a/persistence/sessions_test.go +++ b/persistence/sessions_test.go @@ -47,6 +47,7 @@ func TestSessionToMap(t *testing.T) { session := Session{ Timezone: "klsf", RawMessages: true, + OOBMode: true, } m := session.ToMap() sample := map[string]string{ @@ -54,6 +55,7 @@ func TestSessionToMap(t *testing.T) { "keeponline": "false", "rawmessages": "true", "asciiarrows": "false", + "oobmode": "true", } if !reflect.DeepEqual(m, sample) { t.Errorf("Map does not match the sample: %v", m) |