aboutsummaryrefslogtreecommitdiffstats
path: root/include/chat.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-09-02 13:15:59 +0200
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-09-02 13:15:59 +0200
commitfee5b6bd1599599da2f3b662f04b9651b23fb4e4 (patch)
treee4ab47f657ce1e6ae0aabf6be51bdf169e4b389d /include/chat.php
parenta1f85cda3ec0e6fc1c661ee12b1e7d87b3f242c5 (diff)
parent9dac46ca25b11f80dded42db31e7e062fc7b5142 (diff)
downloadvolse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.tar.gz
volse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.tar.bz2
volse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.zip
Merge pull request #2 from friendica/master
Merge from main project
Diffstat (limited to 'include/chat.php')
-rw-r--r--include/chat.php23
1 files changed, 4 insertions, 19 deletions
diff --git a/include/chat.php b/include/chat.php
index 5f69853e7..b8fb185df 100644
--- a/include/chat.php
+++ b/include/chat.php
@@ -128,8 +128,10 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
}
}
- 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']));
+ if(intval($x[0]['cr_expire'])) {
+ $sql = "delete from chat where created < UTC_TIMESTAMP() - INTERVAL " . intval($x[0]['cr_expire']) . " MINUTE and chat_room = " . intval($x[0]['cr_id']);
+ $r = q($sql);
+ }
$r = q("select * from chatpresence where cp_xchan = '%s' and cp_room = %d limit 1",
dbesc($observer_xchan),
@@ -153,7 +155,6 @@ function chatroom_enter($observer_xchan,$room_id,$status,$client) {
dbesc($client)
);
- chatroom_flush($room_id,$xchan);
return $r;
}
@@ -226,21 +227,5 @@ function chat_message($uid,$room_id,$xchan,$text) {
);
$ret['success'] = true;
- chatroom_flush($room_id,$xchan);
return $ret;
}
-
-/**
- * Reduces the number of lines shown in chat by removing those older than MAX_CHATROOM_HOURS
- */
-
-function chatroom_flush($room_id,$xchan) {
-
-
- $date_limit = date('Y-m-d H:i:s', time() - 3600 * MAX_CHATROOM_HOURS);
- $d = q("delete from chat where chat_room = %d and chat_xchan = '%s' and created < '%s'",
- intval($room_id),
- dbesc($xchan),
- datetime_convert('','', $date_limit));
- return true;
-}