Add a notification when people have left

This commit is contained in:
moodler 2003-07-09 04:27:23 +00:00
parent 9f85bed4c3
commit a2e9f1c579
3 changed files with 19 additions and 2 deletions

View File

@ -10,6 +10,7 @@ $string['chatname'] = "Name of this chat room";
$string['enterchat'] = "Click here to enter the chat";
$string['idle'] = "Idle";
$string['messageenter'] = "\$a has just entered this chat";
$string['messageexit'] = "\$a has left this chat";
$string['savemessages'] = "Number of messages to save";
$string['strftimemessage'] = "%%H:%%M";

View File

@ -37,7 +37,23 @@ if (isset($chat_enter)) {
$timeold = time() - CHAT_OLD_PING;
delete_records_select("chat_users", "lastping < '$timeold'");
if ($oldusers = get_records_select("chat_users", "lastping < '$timeold'") ) {
delete_records_select("chat_users", "lastping < '$timeold'");
foreach ($oldusers as $olduser) {
$message->chatid = $olduser->chatid;
$message->userid = $olduser->userid;
$message->message = "exit";
$message->system = 1;
$message->timestamp = time();
if (!insert_record("chat_messages", $message)) {
error("Could not insert a chat message!");
}
}
}
/// Get list of users

View File

@ -71,7 +71,7 @@
// chat_display_version("box", $browser);
// chat_display_version("text", $browser);
print_heading("");
print_heading($chat->name);
print_simple_box( text_to_html($chat->intro) , "center");