0

I am trying to find a way to see if a user is online/connected without knowing its SID. The only way i have gotten to is to check its last activity time. If it returns an error then it is online, if it has value then it isn't online....I am not sure if there is any other way to see if a user is online.

Do i have to switch any specific things on in Ejabberd?

But when i send an IQ it isnt working either.

    var iq = $iq({
          type: 'get',
          id: 'last1',
          to: "jay@server.com" })
.c('query', {xmlns: 'jabber:iq:last'}); 
conn.sendIQ(iq);

Edit: I found out that the requesting entity is not authorized to retrieve last activity information, how would i allow that?? I am the admin

John
  • 983
  • 1
  • 13
  • 31

1 Answers1

0

To get last activity info user needs to be added to his/her rosters list. Let's say A wishes to get last seen activity of B then A needs to be added to B's rosters list.

So, You need to add A and B to each other's rosters list before accessing last seen info. You may use set roster or ejabberd ejabberdctl admin tool to add in the rosters list of each other.

And I'm guessing you have already enabled mod_last module in ejabberd configuration.

Hare Kumar
  • 699
  • 7
  • 23