fixed deleting of old users when using chatd, other minor fixes, reverting of changes in chatmsg - found some weird problems in FF

This commit is contained in:
skodak
2005-02-10 19:14:53 +00:00
parent 5bbbe0be91
commit a32c7772c6
5 changed files with 13 additions and 14 deletions
-2
View File
@@ -1,4 +1,2 @@
<html>
<body>
</body>
</html>
+1 -1
View File
@@ -46,7 +46,7 @@
$strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
if (!$chat_sid = chat_login_user($chat->id, 'header_js', $groupid, $course, true)) {
if (!$chat_sid = chat_login_user($chat->id, 'header_js', $groupid, $course)) {
error('Could not log in to chat room!!');
}
-6
View File
@@ -49,12 +49,6 @@
<meta http-equiv="content-type" content="text/html; charset=<?php echo get_string('thischarset'); ?>" />
<script type="text/javascript">
<!--
if (parent.msg.document.getElementById("msgStarted") == null) {
parent.msg.document.open("text/html","replace");
parent.msg.document.write("<html><head>");
parent.msg.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=<?php echo get_string('thischarset'); ?>\" />");
parent.msg.document.write("</head><body><div style=\"display: none\" id=\"msgStarted\">&nbsp;</div>");
}
<?php
$beep = false;
$refreshusers = false;
-2
View File
@@ -44,8 +44,6 @@
$groupname = '';
}
chat_delete_old_users();
$strchat = get_string('modulename', 'chat'); // must be before current_language() in chat_login_user() to force course language!!!
if (!$chat_sid = chat_login_user($chat->id, 'sockets', $groupid, $course)) {
+12 -3
View File
@@ -357,7 +357,7 @@ function chat_get_latest_message($chatid, $groupid=0) {
//////////////////////////////////////////////////////////////////////
// login if not already logged in
function chat_login_user($chatid, $version, $groupid, $course, $sendentermsg=false) {
function chat_login_user($chatid, $version, $groupid, $course) {
global $USER;
if ($chatuser = get_record_select('chat_users', "chatid='$chatid' AND userid='$USER->id' AND groupid='$groupid'")) {
$chatuser->version = $version;
@@ -387,7 +387,9 @@ function chat_login_user($chatid, $version, $groupid, $course, $sendentermsg=fal
return false;
}
if ($sendentermsg) {
if ($version == 'sockets') {
// do not send 'enter' message, chatd will do it
} else {
$message->chatid = $chatuser->chatid;
$message->userid = $chatuser->userid;
$message->groupid = $groupid;
@@ -409,7 +411,14 @@ function chat_delete_old_users() {
global $CFG;
$timeold = time() - $CFG->chat_old_ping;
if ($CFG->chat_method == 'sockets') {
// delete very outdated users not deleted by chatd,
// let normal deleting to chatd, because it needs to output the message
$timeold = time() - ($CFG->chat_old_ping * 3);
} else {
$timeold = time() - $CFG->chat_old_ping;
}
$query = "lastping < '$timeold'";
if ($oldusers = get_records_select('chat_users', $query) ) {