<commit_before>#include "modinclude.h"

class m_modetest : public Module {
	public:
		void onChannelMsg(std::string server, std::string channel, char status, std::string nick, std::string message);
};

void m_modetest::onChannelMsg(std::string server, std::string channel, char status, std::string nick, std::string message) {
	std::vector<std::string> splitMsg = splitBySpace(message);
	if (splitMsg[0] == "!mode") {
		unsigned int currParam = 2;
		bool addingMode = true;
		std::vector<std::vector<char> > chanModes = getServerChanModes(server);
		std::tr1::unordered_map<char, char> prefixes = getServerPrefixes(server);
		for (unsigned int i = 0; i < splitMsg[1].size(); i++) {
			if (splitMsg[1][i] == '+')
				addingMode = true;
			else if (splitMsg[1][i] == '-')
				addingMode = false;
			else {
				bool found = false;
				int category;
				for (std::tr1::unordered_map<char, char>::iterator prefixIter = prefixes.begin(); prefixIter != prefixes.end(); prefixIter++) {
					if (prefixIter->first == splitMsg[1][i]) {
						found = true;
						category = 0;
						break;
					}
				}
				if (!found) {
					for (unsigned int j = 0; j < chanModes.size(); j++) {
						for (unsigned int k = 0; k < chanModes[j].size(); k++) {
							if (chanModes[j][k] == splitMsg[1][i]) {
								found = true;
								category = j;
								break;
							}
						}
						if (found)
							break;
					}
				}
				if (!found)
					category = 4;
				
				if (category == 0 || category == 1 || (category == 2 && addingMode))
					setMode(server, channel, splitMsg[1][i], addingMode, splitMsg[currParam++]);
				else
					setMode(server, channel, splitMsg[1][i], addingMode);
			}
		}
	}
}

extern "C" Module* spawn() {
	return new m_modetest;
}

extern "C" void unspawn(Module* mod) {
	delete mod;
}<commit_msg>Add a description to the mode test module.<commit_after>#include "modinclude.h"

class m_modetest : public Module {
	public:
		void onChannelMsg(std::string server, std::string channel, char status, std::string nick, std::string message);
		std::string getDesc();
};

void m_modetest::onChannelMsg(std::string server, std::string channel, char status, std::string nick, std::string message) {
	std::vector<std::string> splitMsg = splitBySpace(message);
	if (splitMsg[0] == "!mode") {
		unsigned int currParam = 2;
		bool addingMode = true;
		std::vector<std::vector<char> > chanModes = getServerChanModes(server);
		std::tr1::unordered_map<char, char> prefixes = getServerPrefixes(server);
		for (unsigned int i = 0; i < splitMsg[1].size(); i++) {
			if (splitMsg[1][i] == '+')
				addingMode = true;
			else if (splitMsg[1][i] == '-')
				addingMode = false;
			else {
				bool found = false;
				int category;
				for (std::tr1::unordered_map<char, char>::iterator prefixIter = prefixes.begin(); prefixIter != prefixes.end(); prefixIter++) {
					if (prefixIter->first == splitMsg[1][i]) {
						found = true;
						category = 0;
						break;
					}
				}
				if (!found) {
					for (unsigned int j = 0; j < chanModes.size(); j++) {
						for (unsigned int k = 0; k < chanModes[j].size(); k++) {
							if (chanModes[j][k] == splitMsg[1][i]) {
								found = true;
								category = j;
								break;
							}
						}
						if (found)
							break;
					}
				}
				if (!found)
					category = 4;
				
				if (category == 0 || category == 1 || (category == 2 && addingMode))
					setMode(server, channel, splitMsg[1][i], addingMode, splitMsg[currParam++]);
				else
					setMode(server, channel, splitMsg[1][i], addingMode);
			}
		}
	}
}

std::string m_modetest::getDesc() { return "This module sets channel modes based on the parameters given with the !mode fantasy command."; }

extern "C" Module* spawn() {
	return new m_modetest;
}

extern "C" void unspawn(Module* mod) {
	delete mod;
}
{'fraction_non_alphanumeric': 0.16262519768054823, 'fraction_numerical': 0.010015814443858724, 'mean_word_length': 3.307604994324631, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, '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': '3477411', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1271, 'n_words': 333}