aboutsummaryrefslogtreecommitdiff
path: root/telegram/commands.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-03-29 14:35:06 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-03-29 14:35:06 +0300
commit67c38823f2b053928c6c0a5a13261b891e9db4d3 (patch)
treeadc89183efd8ebf886b41a4d011f5336f0d79743 /telegram/commands.go
parentf56e6ac1870a946e2084edef0b496d645a826706 (diff)
Avoid broken state on a failed logout attempt
Diffstat (limited to 'telegram/commands.go')
-rw-r--r--telegram/commands.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/telegram/commands.go b/telegram/commands.go
index 9251ebb..d9dc1f2 100644
--- a/telegram/commands.go
+++ b/telegram/commands.go
@@ -279,16 +279,15 @@ func (c *Client) ProcessTransportCommand(cmdline string, resource string) string
return notOnline
}
- for _, id := range c.cache.ChatsKeys() {
- c.unsubscribe(id)
- }
-
_, err := c.client.LogOut()
if err != nil {
- c.forceClose()
return errors.Wrap(err, "Logout error").Error()
}
+ for _, id := range c.cache.ChatsKeys() {
+ c.unsubscribe(id)
+ }
+
c.Session.Login = ""
// cancel auth
case "cancelauth":