diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-02-14 03:05:59 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-02-14 03:05:59 +0300 |
commit | 915c40f1eed6ba139323c0fa15eed4ed3792f34b (patch) | |
tree | b7e67604ea0451e2cc19f532a2c0954614eabd52 /persistence | |
parent | 6cbfed824520e742532db502147d9c6bc524cc84 (diff) |
Add an asciiarrows option (for clients that do not support Unicode ones)v1.1.2
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/sessions.go | 11 | ||||
-rw-r--r-- | persistence/sessions_test.go | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/persistence/sessions.go b/persistence/sessions.go index cfea675..bc71fd6 100644 --- a/persistence/sessions.go +++ b/persistence/sessions.go @@ -38,12 +38,14 @@ type Session struct { Timezone string `yaml:":timezone"` KeepOnline bool `yaml:":keeponline"` RawMessages bool `yaml:":rawmessages"` + AsciiArrows bool `yaml:":asciiarrows"` } var configKeys = []string{ "timezone", "keeponline", "rawmessages", + "asciiarrows", } var sessionDB *SessionsYamlDB @@ -114,6 +116,8 @@ func (s *Session) Get(key string) (string, error) { return fromBool(s.KeepOnline), nil case "rawmessages": return fromBool(s.RawMessages), nil + case "asciiarrows": + return fromBool(s.AsciiArrows), nil } return "", errors.New("Unknown session property") @@ -150,6 +154,13 @@ func (s *Session) Set(key string, value string) (string, error) { } s.RawMessages = b return value, nil + case "asciiarrows": + b, err := toBool(value) + if err != nil { + return "", err + } + s.AsciiArrows = b + return value, nil } return "", errors.New("Unknown session property") diff --git a/persistence/sessions_test.go b/persistence/sessions_test.go index aa1f4b8..76f71f9 100644 --- a/persistence/sessions_test.go +++ b/persistence/sessions_test.go @@ -53,6 +53,7 @@ func TestSessionToMap(t *testing.T) { "timezone": "klsf", "keeponline": "false", "rawmessages": "true", + "asciiarrows": "false", } if !reflect.DeepEqual(m, sample) { t.Errorf("Map does not match the sample: %v", m) |