public function setPresence($presence, $priority, $show, $status)
{
list($jid, $resource) = explode('/', $presence . '/');
if ($show !== 'unavailable') {
if (!$this->isContact($jid)) {
$this->_addContact($jid, 'not-in-roster');
}
$this->roster_array[$jid]['presence'][$resource] = ['priority' => $priority, 'show' => $show, 'status' => $status];
} else {
//Nuke unavailable resources to save memory
unset($this->roster_array[$jid]['resource'][$resource]);
}
}