aboutsummaryrefslogtreecommitdiffstats
path: root/include/chat.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-01-29 17:09:20 -0800
committerfriendica <info@friendica.com>2014-01-29 17:09:20 -0800
commitb8fb6a437335ce16e658f8acda632916bb28e574 (patch)
treef1c4c0349eb06d2077fae874f52bf6d57ca5ebde /include/chat.php
parent677f5f641e6c37244ee67459b6fa2c7e5aea119b (diff)
downloadvolse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.tar.gz
volse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.tar.bz2
volse-hubzilla-b8fb6a437335ce16e658f8acda632916bb28e574.zip
more chat infrastructure
Diffstat (limited to 'include/chat.php')
-rw-r--r--include/chat.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/chat.php b/include/chat.php
index f682fe6fe..a8c3db429 100644
--- a/include/chat.php
+++ b/include/chat.php
@@ -83,8 +83,10 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
$r = q("select * from chatroom where cr_id = %d limit 1",
intval($room_id)
);
- if(! $r)
- return;
+ if(! $r) {
+ notice( t('Room not found.') . EOL);
+ return false;
+ }
require_once('include/security.php');
$sql_extra = permissions_sql($r[0]['cr_uid']);
@@ -94,7 +96,7 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
);
if(! $x) {
notice( t('Permission denied.') . EOL);
- return;
+ return false;
}
$r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
@@ -122,12 +124,13 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
}
-function chatroom_leave($observer_xchan,$room_id,$status) {
+function chatroom_leave($observer_xchan,$room_id,$client) {
if(! $room_id || ! $observer_xchan)
return;
- $r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
+ $r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d and cp_client = '%s' limit 1",
dbesc($observer_xchan),
- intval($room_id)
+ intval($room_id),
+ dbesc($client)
);
if($r) {
q("delete from chatpresence where cp_id = %d limit 1",