From b8fb6a437335ce16e658f8acda632916bb28e574 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 29 Jan 2014 17:09:20 -0800 Subject: more chat infrastructure --- include/chat.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include') 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", -- cgit v1.2.3