aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-20 20:49:03 -0700
committerfriendica <info@friendica.com>2014-08-20 20:49:03 -0700
commitaf45b34ee044966210e6101585fe362acf1ca098 (patch)
treef5368f967d6c3f1335915a1a6c5f8f91d7be4934
parentb8a5b7a610fa940297b4bd3f66c912c3f3e7e161 (diff)
downloadvolse-hubzilla-af45b34ee044966210e6101585fe362acf1ca098.tar.gz
volse-hubzilla-af45b34ee044966210e6101585fe362acf1ca098.tar.bz2
volse-hubzilla-af45b34ee044966210e6101585fe362acf1ca098.zip
verified that chatroom expire is working, so doing away with the second function to do the same thing.
If you have a problem with chatroom expiration, check that it was created with cr_expire set to 120 (minutes). Chatrooms created during the first couple of days of the chat feature didn't have this. You can set the DB value manually.
-rwxr-xr-xboot.php5
-rw-r--r--include/chat.php23
2 files changed, 4 insertions, 24 deletions
diff --git a/boot.php b/boot.php
index 267999d07..f8bd29f37 100755
--- a/boot.php
+++ b/boot.php
@@ -358,11 +358,6 @@ define ( 'MAX_LIKERS', 10);
define ( 'ZCURL_TIMEOUT' , (-1));
-/**
- * Hours before chat lines are deleted
- */
-
-define ( 'MAX_CHATROOM_HOURS' , 36);
/**
* email notification options
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;
-}