diff options
author | friendica <info@friendica.com> | 2014-02-06 15:23:20 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-06 15:23:20 -0800 |
commit | a46fa1fbaecb5623fb6287ff9fb4479ad2f4f1d1 (patch) | |
tree | 22f410121bc4edefb2d787a98dc6addb4d6fb8ad /include/chat.php | |
parent | 3e677ec53de7517c249114dd30539141fbde85e3 (diff) | |
download | volse-hubzilla-a46fa1fbaecb5623fb6287ff9fb4479ad2f4f1d1.tar.gz volse-hubzilla-a46fa1fbaecb5623fb6287ff9fb4479ad2f4f1d1.tar.bz2 volse-hubzilla-a46fa1fbaecb5623fb6287ff9fb4479ad2f4f1d1.zip |
apply service class restriction to the number of channels allowed in a chatroom at a time ('chatters_inroom'). If you've got a public site you probably want to restrict this.
Diffstat (limited to 'include/chat.php')
-rw-r--r-- | include/chat.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/chat.php b/include/chat.php index 5af3a3a9a..fb1d4fe65 100644 --- a/include/chat.php +++ b/include/chat.php @@ -114,6 +114,17 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) { return false; } + $limit = service_class_fetch($r[0]['cr_uid'],'chatters_inroom'); + if($limit !== false) { + $x = q("select count(*) as total from chatpresence where cp_room = %d", + intval($room_id) + ); + if($x && $x[0]['total'] > $limit) { + notice( t('Room is full') . EOL); + return false; + } + } + if(intval($x[0]['cr_expire'])) $r = q("delete from chat where created < UTC_TIMESTAMP() - INTERVAL " . intval($x[0]['cr_expire']) . " MINUTE and chat_room = " . intval($x[0]['cr_id'])); |