Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
skhanna #1
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Subject: Get online user from openfire
Hi Alex,

can we get all connected users from openfire using matrix library.

Thanks,
Sanjeev
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Most server support this over ad-hoc commands for users which have admin privileges.
Please check if your Openfire server support this:
http://www.xmpp.org/extensions/xep-0133.html#get-online-us…

If yes, then just execute the command as described in XEP-0133: Service Administration

Alex
Avatar
skhanna #3
Member since Jul 2016 · 73 posts · Location: Indore
Group memberships: Members
Show profile · Link to this post
Thanks Alex.

How I can execute this command in matrix. I also want to get online users for specific group.

Thanks in Advance
Sanjeev
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This gives you all online users, you cannot request only a given group.
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is code from one of our Unit Tests which should help you.

  1. public void TestOnlineUsers()
  2. {
  3.     string XML1 = @"<iq id='get-online-users-list-1'
  4.        to='shakespeare.lit'
  5.        type='set'
  6.        xmlns='jabber:client'>
  7.        <command xmlns='http://jabber.org/protocol/commands'
  8.                   action='execute'
  9.                   node='http://jabber.org/protocol/admin#get-online-users-list'/>
  10.        </iq>";
  11.  
  12.     var iq = new Iq
  13.     {
  14.         To = "shakespeare.lit",
  15.         Id = "get-online-users-list-1",
  16.         Type = Matrix.Xmpp.IqType.Set
  17.     };
  18.  
  19.     var cmd = new Command()
  20.     {
  21.         Action = Action.Execute,
  22.         Node = "http://jabber.org/protocol/admin#get-online-users-list"
  23.     };
  24.  
  25.     iq.Add(cmd);
  26.  
  27.     XmlAssertion.AssertXmlEquals(Util.GetXmlDiff(XML1, iq));
  28. }
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: