Skip to content

Commit

Permalink
Update Roster.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ViPErCZ authored Jul 24, 2017
1 parent b8f1143 commit a41b77c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions XMPPHP/Roster.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,13 @@ public function isContact($jid) {
* @param string $status
*/
public function setPresence($presence, $priority, $show, $status) {
list($jid, $resource) = explode("/", $presence);
$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]);
Expand Down

0 comments on commit a41b77c

Please sign in to comment.