aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index cdd2914..4c73f9e 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -48,7 +48,7 @@ func (c *Client) GetContactByUsername(username string) (*client.Chat, *client.Us
// GetContactByID gets user and chat information from cache (or tries to retrieve it, if missing)
func (c *Client) GetContactByID(id int64, chat *client.Chat) (*client.Chat, *client.User, error) {
- if !c.Online() {
+ if !c.Online() || id == 0 {
return nil, nil, errOffline
}
@@ -600,17 +600,19 @@ func (c *Client) deleteResource(resource string) {
}
}
-// refresh roster
-func (c *Client) refresh(resource string) {
+// resend statuses to (to another resource, for example)
+func (c *Client) roster(resource string) {
if _, ok := c.resources[resource]; ok {
- return
+ return // we know it
}
- log.Warnf("Refreshing roster for resource %v", resource)
+ log.Warnf("Sending roster for %v", resource)
for _, chat := range c.cache.ChatsKeys() {
c.ProcessStatusUpdate(chat, "", "")
}
+ gateway.SendPresence(c.xmpp, c.jid, gateway.SPStatus("Logged in as: "+c.Session.Login))
+
c.addResource(resource)
}