I am using jabber presence to communicate state between systems because it pushes status updates to everyone automatically

Presence only works on systems on your Roster/Contact list.

How does one retrieve a list of all online users from a Jabber server with Net::Jabber? I've tried worming my way through browse functions and disco functions but haven't gotten anything successful enough to even bother giving the code of my attempts so a code example would be greatly appreciated!

UPDATE: I've found that manually creating and sending the request like this:

my $iq = Net::Jabber::IQ->new(); $iq->SetType('get'); $iq->SetTo("$server/admin"); my $q = $iq->NewQuery('jabber:iq:browse'); my $result = $Connection->SendAndReceiveWithID($iq); print Dumper($result);

Gives an error back with the tag 'not-allowed'. This may be because the user I'm connecting with is not an admin. Using admin credentials isn't an option for me. I welcome any input telling me that I'm mistaken! If someone stumbles upon this looking for the solution the above code may well work with an admin account.

I will use an alternative solution to work around the problem. I'm thinking about having a user with the distinct purpose of initial registration. All systems automatically subscribe to this user on first connection and that user messages back with its roster list and then system can subscribe to all those users.

Thank you to all the monks who looked and considered this issue!


In reply to How to get online users with Net::Jabber by shaitand

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.