<commit_before>var util = require("util");
var net = require("net");
var tls = require("tls");
var events = require("events");


var Client = module.exports = function(profile) {
	this.host = profile.host || "localhost";
	this.port = profile.port || 6667;
	
	this.name = profile.name || this.host;

	this.connected = false;
	this.connection = null;
	this.buffer = "";
	this.encoding = "utf8";
	this.timeout = 0;

	this.nick = profile.nick;
	this.user = profile.user || "guest";
	this.real = profile.real || "Guest";
	this.password = profile.password || <PASSWORD>;
	this.nickserv = profile.nickserv || null;

	this.channels = {};
	this.users = {};
	
	this.needspong = false;
	this.pong_timeout = null;
	this.lag_time = 0;
	this.profile = profile;
}


util.inherits(Client, process.EventEmitter);


Client.prototype.connect = function() {
	var connection;

	if (this.profile.ssl) {
		connection = tls.connect (this.port, this.host, {});
	} else {
		connection = net.createConnection(this.port, this.host);
	}

	if (connection.setTimeout) { connection.setTimeout (this.timeout); }
	if (connection.setKeepAlive) { connection.setKeepAlive (true); }
	connection.setEncoding(this.encoding);

	for (var i in this.events) {
		if (this.events.hasOwnProperty(i)) {
			connection.on(i, this.events[i].bind(this));
		}
	}

	this.connection = connection;
	this.connected = true;
};


Client.prototype.disconnect = function(why) {
	if (this.connected) {
		if (this.connection.readyState !== "closed") {
			this.raw ("QUIT :"+why);
			this.connection.end();
		}
		this.emit("disconnect", this, why);
	}
	this.connected = false;
};<commit_msg>Added `authenticate` command<commit_after>var util = require("util");
var net = require("net");
var tls = require("tls");
var events = require("events");


var Client = module.exports = function(profile) {
	this.host = profile.host || "localhost";
	this.port = profile.port || 6667;
	
	this.name = profile.name || this.host;

	this.connected = false;
	this.connection = null;
	this.buffer = "";
	this.encoding = "utf8";
	this.timeout = 0;

	this.nick = profile.nick;
	this.user = profile.user || "guest";
	this.real = profile.real || "Guest";
	this.password = profile.password || <PASSWORD>;
	this.nickserv = profile.nickserv || null;

	this.channels = {};
	this.users = {};
	
	this.needspong = false;
	this.pong_timeout = null;
	this.lag_time = 0;
	this.profile = profile;
}


util.inherits(Client, process.EventEmitter);


Client.prototype.connect = function() {
	var connection;

	if (this.profile.ssl) {
		connection = tls.connect (this.port, this.host, {});
	} else {
		connection = net.createConnection(this.port, this.host);
	}

	if (connection.setTimeout) { connection.setTimeout (this.timeout); }
	if (connection.setKeepAlive) { connection.setKeepAlive (true); }
	connection.setEncoding(this.encoding);

	for (var i in this.events) {
		if (this.events.hasOwnProperty(i)) {
			connection.on(i, this.events[i].bind(this));
		}
	}

	this.connection = connection;
	this.connected = true;
};

Client.prototype.authenticate = function() {
	if (typeof this.nickserv === "string") {
		this.get_user("NickServ").send("identify " + this.nickserv);
	} else if (typeof this.password === "string") {
		this.get_user("NickServ").send("identify " + this.nick + " " + this.password);
	}
};

Client.prototype.disconnect = function(why) {
	if (this.connected) {
		if (this.connection.readyState !== "closed") {
			this.raw ("QUIT :"+why);
			this.connection.end();
		}
		this.emit("disconnect", this, why);
	}
	this.connected = false;
};
{'fraction_non_alphanumeric': 0.17130801687763714, 'fraction_numerical': 0.003938115330520394, 'mean_word_length': 4.153623188405797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2834145', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1207, 'n_words': 242}