aboutsummaryrefslogtreecommitdiffstats
path: root/mod/ping.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-29 02:25:21 -0800
committerfriendica <info@friendica.com>2014-01-29 02:25:21 -0800
commit10b51a9471bba2a1b058eee2d362d3d2189627be (patch)
treeee53aa7e6a106efc85ca5a32f1ab9db14411ed24 /mod/ping.php
parentf84ba95e870ce5b63e5af4cc7be43b516d4c163d (diff)
downloadvolse-hubzilla-10b51a9471bba2a1b058eee2d362d3d2189627be.tar.gz
volse-hubzilla-10b51a9471bba2a1b058eee2d362d3d2189627be.tar.bz2
volse-hubzilla-10b51a9471bba2a1b058eee2d362d3d2189627be.zip
issues uncovered whilst testing the chatroom API
Diffstat (limited to 'mod/ping.php')
-rw-r--r--mod/ping.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/mod/ping.php b/mod/ping.php
index e205dbea7..c3c81992f 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -44,18 +44,22 @@ function ping_init(&$a) {
}
if(get_observer_hash() && (! $result['invalid'])) {
- $r = q("select cp_id from chatpresence where cp_xchan = '%s'",
- dbesc(get_observer_hash())
+ $r = q("select cp_id from chatpresence where cp_xchan = '%s' and cp_client = '%s'",
+ dbesc(get_observer_hash()),
+ dbesc($_SERVER['REMOTE_ADDR'])
);
+ $basic_presence = false;
if($r) {
foreach($r as $rr) {
+ if($rr['cp_id'] == 0)
+ $basic_presence = true;
q("update chatpresence set cp_last = '%s' where cp_id = %d limit 1",
dbesc(datetime_convert()),
intval($rr['cp_id'])
);
}
}
- else {
+ if(! $basic_presence) {
q("insert into chatpresence ( cp_xchan, cp_last, cp_status, cp_client)
values( '%s', '%s', '%s', '%s' ) ",
dbesc(get_observer_hash()),