<commit_before>/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2018  <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kernel/user.h>
#include <kotaka/paths/ansi.h>
#include <kotaka/paths/string.h>
#include <kotaka/paths/system.h>
#include <kotaka/paths/text.h>
#include <kotaka/privilege.h>
#include <kotaka/telnet.h>

inherit LIB_FILTER;

string *lines;

static void create(int clone)
{
	if (clone) {
		::create();
	}
}

int login(string str)
{
	return ::login(str);
}

int receive_message(string str)
{
	if (!lines) {
		lines = ({ });

		call_out("trickle", 0);
	}

	lines += ({ str });

	return MODE_NOCHANGE;
}

static void trickle()
{
	string line;

	if (!lines || !sizeof(lines)) {
		return;
	}

	line = lines[0];
	lines = lines[1 ..];

	if (sizeof(lines)) {
		call_out("trickle", 0);
	} else {
		lines = nil;
	}

	catch {
		::receive_message(line);
	}
}<commit_msg>Update line filter to set this_user.<commit_after>/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2018  <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kernel/user.h>
#include <kotaka/paths/ansi.h>
#include <kotaka/paths/string.h>
#include <kotaka/paths/system.h>
#include <kotaka/paths/text.h>
#include <kotaka/privilege.h>
#include <kotaka/telnet.h>

inherit LIB_FILTER;

string *lines;

static void create(int clone)
{
	if (clone) {
		::create();
	}
}

int login(string str)
{
	return ::login(str);
}

int receive_message(string str)
{
	if (!lines) {
		lines = ({ });

		call_out("trickle", 0);
	}

	lines += ({ str });

	return MODE_NOCHANGE;
}

static void trickle()
{
	string line;
	object this_user;

	if (!lines || !sizeof(lines)) {
		return;
	}

	line = lines[0];
	lines = lines[1 ..];

	if (sizeof(lines)) {
		call_out("trickle", 0);
	} else {
		lines = nil;
	}

	this_user = SYSTEM_USERD->query_this_user();

	catch {
		object user;

		user = this_object();

		while (user && user <- LIB_CONN) {
			user = user->query_user();
		}

		SYSTEM_USERD->set_this_user(user);

		::receive_message(line);
	}

	SYSTEM_USERD->set_this_user(this_user());
}
{'fraction_non_alphanumeric': 0.12746806039488967, 'fraction_numerical': 0.005226480836236934, 'mean_word_length': 3.738651994497937, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5502264', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1148, 'n_words': 387}