diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-05-10 15:47:24 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-05-10 15:47:24 +0300 |
commit | 151141f288e51e427168cee1340a7163bf58309a (patch) | |
tree | ca025dcc96d595fdd77b9934836b96da2773df41 /config | |
parent | e42ce27e0a3f9d04160f892f67c73b81fc076dd3 (diff) |
Add command to log out
Diffstat (limited to 'config')
-rw-r--r-- | config/config.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config/config.go b/config/config.go index b025115..cf080ff 100644 --- a/config/config.go +++ b/config/config.go @@ -55,6 +55,17 @@ func (config *Config) Clear() { os.RemoveAll(config.MediaDir) } +func (config *Config) DeleteSession() { + if config.Session != nil { + os.Remove(config.Session.path) + config.Session = nil + } + os.RemoveAll(config.HistoryDir) + os.RemoveAll(config.MediaDir) + os.MkdirAll(config.HistoryDir, 0700) + os.MkdirAll(config.MediaDir, 0700) +} + // Load loads the config from config.yaml in the directory given to the config struct. func (config *Config) Load() { os.MkdirAll(config.Dir, 0700) |