Add a muc option (useless yet)
This commit is contained in:
parent
0c71036148
commit
afa21e10be
|
@ -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")
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue