|
|
@ -159,8 +159,12 @@ func (c *Client) ProcessTransportCommand(cmdline string) string {
|
|
|
|
cmd, args := parseCommand(cmdline)
|
|
|
|
cmd, args := parseCommand(cmdline)
|
|
|
|
switch cmd {
|
|
|
|
switch cmd {
|
|
|
|
case "login", "code", "password":
|
|
|
|
case "login", "code", "password":
|
|
|
|
if cmd == "login" && c.Session.Login != "" {
|
|
|
|
if cmd == "login" {
|
|
|
|
return ""
|
|
|
|
if c.Session.Login != "" {
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
} else if !c.Online() {
|
|
|
|
|
|
|
|
c.Connect()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if len(args) < 1 {
|
|
|
|
if len(args) < 1 {
|
|
|
@ -184,15 +188,16 @@ func (c *Client) ProcessTransportCommand(cmdline string) string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// sign out
|
|
|
|
// sign out
|
|
|
|
case "logout":
|
|
|
|
case "logout":
|
|
|
|
|
|
|
|
for id := range c.cache.chats {
|
|
|
|
|
|
|
|
c.unsubscribe(id)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_, err := c.client.LogOut()
|
|
|
|
_, err := c.client.LogOut()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
c.forceClose()
|
|
|
|
return errors.Wrap(err, "Logout error").Error()
|
|
|
|
return errors.Wrap(err, "Logout error").Error()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for id := range c.cache.chats {
|
|
|
|
|
|
|
|
c.unsubscribe(id)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
c.Session.Login = ""
|
|
|
|
c.Session.Login = ""
|
|
|
|
// set @username
|
|
|
|
// set @username
|
|
|
|
case "setusername":
|
|
|
|
case "setusername":
|
|
|
|