|
|
@ -146,6 +146,7 @@ func (c *Client) Disconnect() {
|
|
|
|
_, err := c.client.Close()
|
|
|
|
_, err := c.client.Close()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.Errorf("Couldn't close the Telegram instance: %v; %#v", err, c)
|
|
|
|
log.Errorf("Couldn't close the Telegram instance: %v; %#v", err, c)
|
|
|
|
|
|
|
|
c.forceClose()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -198,13 +199,16 @@ func (c *Client) interactor() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in "+c.Session.Login))
|
|
|
|
gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in "+c.Session.Login))
|
|
|
|
case client.TypeAuthorizationStateClosed:
|
|
|
|
|
|
|
|
log.Warn("Closing the updates listener")
|
|
|
|
return
|
|
|
|
c.listener.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Client) forceClose() {
|
|
|
|
|
|
|
|
c.listener.Close()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Online checks if the updates listener is alive
|
|
|
|
// Online checks if the updates listener is alive
|
|
|
|
func (c *Client) Online() bool {
|
|
|
|
func (c *Client) Online() bool {
|
|
|
|
return c.listener != nil && c.listener.IsActive()
|
|
|
|
return c.listener != nil && c.listener.IsActive()
|
|
|
|