/** * Tracks all incoming presence stanza's */ function _handlePresence($payloads, $jaxl) { foreach ($payloads as $payload) { if ($this->trackPresence) { // update local $roster cache $jid = JAXLUtil::getBareJid($payload['from']); $this->_addRosterNode($jid, false); if (!isset($this->roster[$jid]['presence'][$payload['from']])) { $this->roster[$jid]['presence'][$payload['from']] = array(); } $this->roster[$jid]['presence'][$payload['from']]['type'] = $payload['type'] == '' ? 'available' : $payload['type']; $this->roster[$jid]['presence'][$payload['from']]['status'] = $payload['status']; $this->roster[$jid]['presence'][$payload['from']]['show'] = $payload['show']; $this->roster[$jid]['presence'][$payload['from']]['priority'] = $payload['priority']; } if ($payload['type'] == 'subscribe' && $this->autoSubscribe) { $this->subscribed($payload['from']); $this->subscribe($payload['from']); $this->executePlugin('jaxl_post_subscription_request', $payload); } else { if ($payload['type'] == 'subscribed') { $this->executePlugin('jaxl_post_subscription_accept', $payload); } } } return $payloads; }