tags:

views:

561

answers:

3

I'm using XMPPHP to retrieve the roster of my application users GMail account.
Can XMPPHP also tell me the roster contacts online status?
I can't seem to find how to do that...

cheers.

A: 

I haven't tried it with Google Talk, but generally you're looking for

$roster->getPresence($jid)['status']
janko
seems to come out empty (the whole presence array is pretty much empty)
Omer
A: 
$uStatus = $conn->roster->getPresence($jid);

echo "Online status: " . $uStatus['show']; // tells whether available or unavailable or dnd
echo "Status message: " . $uStatus['status']; // shows the user's status message
Nirmal
A: 

I have the same problem: The presence array seems to be completely empty. None of these solutions works for me. Did you make it work?

This is my code (XMPPHP as library in Zend Framework):

$conn = new MyApp_XMPPHP_XMPP(SERVER, 5222, USERNAME, PASS, 'xmpphp');

try {
    $conn->connect();
    $conn->processUntil('session_start');
    $conn->getRoster();
$conn->disconnect();
} catch(XMPPHP_Exception $e) {
    die($e->getMessage());
}

$conn->roster looks like this:

Roster Object
(
  [roster_array:protected] => Array
    (
      [USERNAME@JABBERSERVER] => Array
        (
          [contact] => Array
            (
              [jid] => USERNAME@JABBERSERVER
              [subscription] => both
              [name] => 
              [groups] => Array
                (
                  [0] => Kontakte
                )
            )
         )
     )
)
foppa
no, sorry.the online status was low priority and I ended up not using it.
Omer