forked from GNUsocial/gnu-social
naughty extlib fix (PHP7)
The explode function didn't return empty elements (which split did)
This commit is contained in:
parent
3e9b0d6018
commit
e4f688fcfd
@ -118,12 +118,13 @@ class Roster {
|
|||||||
* @param string $status
|
* @param string $status
|
||||||
*/
|
*/
|
||||||
public function setPresence($presence, $priority, $show, $status) {
|
public function setPresence($presence, $priority, $show, $status) {
|
||||||
list($jid, $resource) = explode("/", $presence);
|
$parts = explode('/', $presence);
|
||||||
|
$jid = $parts[0];
|
||||||
|
$resource = isset($parts[1]) ? $parts[1] : ''; // apparently we can do '' as an associative array index
|
||||||
if ($show != 'unavailable') {
|
if ($show != 'unavailable') {
|
||||||
if (!$this->isContact($jid)) {
|
if (!$this->isContact($jid)) {
|
||||||
$this->addContact($jid, 'not-in-roster');
|
$this->addContact($jid, 'not-in-roster');
|
||||||
}
|
}
|
||||||
$resource = $resource ? $resource : '';
|
|
||||||
$this->roster_array[$jid]['presence'][$resource] = array('priority' => $priority, 'show' => $show, 'status' => $status);
|
$this->roster_array[$jid]['presence'][$resource] = array('priority' => $priority, 'show' => $show, 'status' => $status);
|
||||||
} else { //Nuke unavailable resources to save memory
|
} else { //Nuke unavailable resources to save memory
|
||||||
unset($this->roster_array[$jid]['resource'][$resource]);
|
unset($this->roster_array[$jid]['resource'][$resource]);
|
||||||
|
Loading…
Reference in New Issue
Block a user