fix notice when no have resourse (from icq for example)

This commit is contained in:
Ivan Borzenkov 2010-02-27 22:37:55 +03:00
parent 3e81567748
commit b25d7819b6
1 changed files with 3 additions and 2 deletions

View File

@ -118,12 +118,13 @@ class Roster {
* @param string $status
*/
public function setPresence($presence, $priority, $show, $status) {
list($jid, $resource) = explode('/', $presence, 2);
$presence = explode('/', $presence, 2);
$jid = $presence[0];
$resource = isset($presence[1]) ? $presence[1] : '';
if ($show != 'unavailable') {
if (!$this->isContact($jid)) {
$this->addContact($jid, 'not-in-roster');
}
$resource = $resource ? $resource : '';
$this->roster_array[$jid]['presence'][$resource] = array('priority' => $priority, 'show' => $show, 'status' => $status);
} else { //Nuke unavailable resources to save memory
unset($this->roster_array[$jid]['resource'][$resource]);