Commit 9d89f660 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4468 (Chat keeps saying user left room)

parent c3af8570
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ function chat_poller()
    $message_id = get_param_integer('message_id', -1);
    $event_id = get_param_integer('event_id', -1);

    $hash_filename = 'chat_last_full_check_' . @substr(md5(serialize(array($_COOKIE, $_SERVER['REMOTE_ADDR']))), 0, 2) . '.bin'; // 1 in 1296 chance of conflict with another user - good enough!

    if (
        ((file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.bin')) && (filemtime(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.bin') >= time() - intval(floatval(CHAT_ACTIVITY_PRUNE) / 2.0))) && // If we've done a check within CHAT_ACTIVITY_PRUNE/2 seconds don't try again unless something is new (we do need to allow pruning to happen sometimes)
        ((file_exists(get_custom_file_base() . '/data_custom/modules/chat/' . $hash_filename)) && (filemtime(get_custom_file_base() . '/data_custom/modules/chat/' . $hash_filename) >= time() - intval(floatval(CHAT_ACTIVITY_PRUNE) / 2.0))) && // If we've done a check within CHAT_ACTIVITY_PRUNE/2 seconds don't try again unless something is new (we do need to allow pruning to happen sometimes)
        (($message_id != -1) && (file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.bin')) && (intval(/*cms_file_get_contents_safe not available yet*/file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_msg.bin')) <= $message_id)) &&
        (($event_id != -1) && (file_exists(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.bin')) && (intval(/*cms_file_get_contents_safe not available yet*/file_get_contents(get_custom_file_base() . '/data_custom/modules/chat/chat_last_event.bin')) <= $event_id))
    ) {
@@ -53,7 +55,7 @@ function chat_poller()
    if (!file_exists(get_custom_file_base() . '/data_custom/modules/chat')) {
        return; // Directory missing, but we will have to create it elsewhere (not booted up fully enough)
    }
    touch(get_custom_file_base() . '/data_custom/modules/chat/chat_last_full_check.bin');
    touch(get_custom_file_base() . '/data_custom/modules/chat/' . $hash_filename);
}

/**
+2 −2
Original line number Diff line number Diff line
@@ -526,10 +526,10 @@ function should_ignore_file($filepath, $bitmask = 0, $bitmask_defaults = 0)
    }

    if ((($bitmask & IGNORE_BUNDLED_VOLATILE) != 0) || (($bitmask & IGNORE_BUNDLED_UNSHIPPED_VOLATILE) != 0)) {
        $ignore_extensions['bin'] .= '|data_custom/modules/chat';

        $ignore_filenames_and_dir_names += array(
            // Bundled stuff that is not necessarily in a *_custom dir yet is volatile and should not be included in shipped builds
            'chat_last_full_check.bin' => 'data_custom/modules/chat',
            'chat_last_msg.bin' => 'data_custom/modules/chat',
            'latest.bin' => 'data_custom/modules/web_notifications',
            'permissioncheckslog.php' => 'data_custom',
            'failover_rewritemap.txt' => 'data_custom',