aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-03-21 23:29:58 +0200
committerTulir Asokan <tulir@maunium.net>2018-03-21 23:29:58 +0200
commit9fd67102ad2cca16c092e23ffd928b77ab08d7e0 (patch)
tree2c34025e564806cb8f9faad0c15e25a0e6dec3ed /config
parentb4902d4edb27baf59b21747117d93db4e0e4e96c (diff)
Refactoring and godocs
Diffstat (limited to 'config')
-rw-r--r--config/config.go4
-rw-r--r--config/session.go16
2 files changed, 10 insertions, 10 deletions
diff --git a/config/config.go b/config/config.go
index 858f1d2..7d99274 100644
--- a/config/config.go
+++ b/config/config.go
@@ -27,8 +27,8 @@ import (
)
type Config struct {
- MXID string `yaml:"mxid"`
- HS string `yaml:"homeserver"`
+ UserID string `yaml:"mxid"`
+ HS string `yaml:"homeserver"`
dir string `yaml:"-"`
Session *Session `yaml:"-"`
diff --git a/config/session.go b/config/session.go
index 631c954..3fdc169 100644
--- a/config/session.go
+++ b/config/session.go
@@ -22,19 +22,19 @@ import (
"path/filepath"
"maunium.net/go/gomatrix"
- "maunium.net/go/gomuks/matrix/ext"
+ "maunium.net/go/gomuks/matrix/pushrules"
rooms "maunium.net/go/gomuks/matrix/room"
"maunium.net/go/gomuks/ui/debug"
)
type Session struct {
- MXID string `json:"-"`
+ UserID string `json:"-"`
path string `json:"-"`
AccessToken string
NextBatch string
FilterID string
Rooms map[string]*rooms.Room
- PushRules *gomx_ext.PushRuleset
+ PushRules *pushrules.PushRuleset
}
func (config *Config) LoadSession(mxid string) error {
@@ -44,9 +44,9 @@ func (config *Config) LoadSession(mxid string) error {
func (config *Config) NewSession(mxid string) *Session {
return &Session{
- MXID: mxid,
- path: filepath.Join(config.dir, mxid+".session"),
- Rooms: make(map[string]*rooms.Room),
+ UserID: mxid,
+ path: filepath.Join(config.dir, mxid+".session"),
+ Rooms: make(map[string]*rooms.Room),
}
}
@@ -76,7 +76,7 @@ func (s *Session) Load() error {
func (s *Session) Save() error {
data, err := json.Marshal(s)
if err != nil {
- debug.Print("Failed to marshal session of", s.MXID, err)
+ debug.Print("Failed to marshal session of", s.UserID, err)
return err
}
@@ -99,7 +99,7 @@ func (s *Session) LoadNextBatch(_ string) string {
func (s *Session) GetRoom(mxid string) *rooms.Room {
room, _ := s.Rooms[mxid]
if room == nil {
- room = rooms.NewRoom(mxid, s.MXID)
+ room = rooms.NewRoom(mxid, s.UserID)
s.Rooms[room.ID] = room
}
return room