mod/ping should only update basic_presence - and clearing stale entries. otherwise let rooms handle presence for themselves.
This commit is contained in:
parent
f69bf5e598
commit
49f07bd90f
15
mod/ping.php
15
mod/ping.php
@ -44,20 +44,17 @@ function ping_init(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(get_observer_hash() && (! $result['invalid'])) {
|
if(get_observer_hash() && (! $result['invalid'])) {
|
||||||
$r = q("select cp_id, cp_room from chatpresence where cp_xchan = '%s' and cp_client = '%s'",
|
$r = q("select cp_id, cp_room from chatpresence where cp_xchan = '%s' and cp_client = '%s' and cp_room = 0 limit 1",
|
||||||
dbesc(get_observer_hash()),
|
dbesc(get_observer_hash()),
|
||||||
dbesc($_SERVER['REMOTE_ADDR'])
|
dbesc($_SERVER['REMOTE_ADDR'])
|
||||||
);
|
);
|
||||||
$basic_presence = false;
|
$basic_presence = false;
|
||||||
if($r) {
|
if($r) {
|
||||||
foreach($r as $rr) {
|
$basic_presence = true;
|
||||||
if($rr['cp_room'] == 0)
|
q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1",
|
||||||
$basic_presence = true;
|
dbesc(datetime_convert()),
|
||||||
q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1",
|
intval($r[0]['cp_id'])
|
||||||
dbesc(datetime_convert()),
|
);
|
||||||
intval($rr['cp_id'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(! $basic_presence) {
|
if(! $basic_presence) {
|
||||||
q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client)
|
q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client)
|
||||||
|
Reference in New Issue
Block a user