changeset 2:19227b0b7cc1

.h => .hpp for the headers added year 2008 to copyright notes renamed some functions for better meaning prepared parser module for rewriting added showHelp() function some code clean up
author Vlad Glagolev <enqlave@gmail.com>
date Mon, 21 Jan 2008 01:14:10 +0300
parents 08d8cdf4fe7f
children cd60300cae0b
files sources/Makefile sources/cabal.cpp sources/connection.cpp sources/core.cpp sources/engine.cpp sources/headers/cabal.h sources/headers/cabal.hpp sources/headers/conf.h sources/headers/conf.hpp sources/headers/connection.h sources/headers/connection.hpp sources/headers/core.h sources/headers/core.hpp sources/headers/engine.h sources/headers/engine.hpp sources/headers/network.h sources/headers/network.hpp sources/headers/os.h sources/headers/os.hpp sources/headers/parser.h sources/headers/parser.hpp sources/network.cpp sources/parser.cpp
diffstat 23 files changed, 790 insertions(+), 873 deletions(-) [+]
line wrap: on
line diff
--- a/sources/Makefile	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/Makefile	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
 #
 # -- CABAL -- build script
 #
-# Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+# Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
 # All rights reserved.
 #
 # Permission to use, copy, modify, and distribute this software for any
--- a/sources/cabal.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/cabal.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
  *
  * -- CABAL -- primary module
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cabal.h"
+#include "cabal.hpp"
 
 Core *CABAL;
 
@@ -37,32 +37,37 @@
 	exit(0);
 }
 
-int main(int argc, char *argv[])
+void showHelp()
+{
+	cout
+		<< "\nUsage:\n" \
+		<< "\t-d, --daemon		| daemon mode\n" \
+		<< "\t-c, --config <file>	| configuration file\n" \
+		<< "\t-h, --help		| this message\n" \
+		<< "\nCopyright (c) 2007-2008 Vlad Glagolev (BSD license)\n" << endl;
+
+	exit(0);
+}
+
+int main(int argc, char **argv)
 {
 	cout
 		<< "-- CABAL -- " << VERSION << " (CORE: " << VERSION_CORE ") | " \
 		<< "Compiled: " << __DATE__ << " at " << __TIME__ << endl;
 
-	if (argc < 2) {
-		cout
-			<< "\nUsage:\n" \
-			<< "\t-d, --daemon		| daemon mode\n" \
-			<< "\t-c, --config <file>	| configuration file\n" \
-			<< "\nCopyright (c) 2007 Vlad Glagolev (under the BSD license)\n";
-
-		exit(0);
-	}
+	if (argc < 2)
+		showHelp();
 
 	CABAL = new Core();
 
-	CABAL->commandParse(argc, argv);
-	CABAL->configParse();
-	CABAL->pidCheck();
+	CABAL->parseCommandLine(argc, argv);
+	CABAL->parseConfig();
+	CABAL->checkPID();
 
 	if (!CABAL->debug)
 		daemonize();
 
-	CABAL->pidWrite();
+	CABAL->writePID();
 
 	CABAL->work();
 
--- a/sources/connection.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/connection.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
  *
  * -- CABAL -- connection base (servers usage)
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,10 +19,9 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cabal.h"	// required: core.h
+#include "cabal.hpp"	// required: core.h
 
-Connection::Connection()
-	:
+Connection::Connection():
 	nick(NICK),
 	user(USER),
 	name(NAME),
@@ -86,10 +85,10 @@
 		return;
 	}
 
-	string buffer = msgReceive();
+	string buffer = receiveMsg();
 
 	if (buffer != "") {
-		Parser *DATA = new Parser (this, buffer);
+		Parser *DATA = new Parser(this, buffer);
 
 		DATA->Parse (this);
 
@@ -97,52 +96,52 @@
 	}
 }
 
-void Connection::ircPass (string pass)
+void Connection::ircPass(string pass)
 {
-	msgSend ("PASS " + pass);
+	sendMsg("PASS " + pass);
 }
 
-void Connection::ircNick (string nnick)
+void Connection::ircNick(string nnick)
 {
-	msgSend ("NICK " + (nnick != "" ? nnick : NICK));
+	sendMsg("NICK " + (nnick != "" ? nnick : NICK));
 }
 
-void Connection::ircUser (string nuser, string nname)
+void Connection::ircUser(string nuser, string nname)
 {
-	msgSend ("USER " + nuser + (virtualhost != 0 ? " " + (string)virtualhost + \
+	sendMsg("USER " + nuser + (virtualhost != 0 ? " " + (string)virtualhost + \
 		" " : " 0 ") + (string)current->host + " :" + nname);
 }
 
-void Connection::ircAway (string away)
+void Connection::ircAway(string away)
 {
-	msgSend ("AWAY :" + away);
+	sendMsg("AWAY :" + away);
 }
 
-void Connection::ircJoin (string nchan, string nckey)
+void Connection::ircJoin(string nchan, string nckey)
 {
-	msgSend ("JOIN " + nchan + (nckey != "" ? " " + nckey : ""));
+	sendMsg("JOIN " + nchan + (nckey != "" ? " " + nckey : ""));
 }
 
-void Connection::ircPart (string nchan)
+void Connection::ircPart(string nchan)
 {
-	msgSend ("PART " + nchan);
+	sendMsg("PART " + nchan);
 }
 
-void Connection::ircCycle (string nchan)
+void Connection::ircCycle(string nchan)
 {
-	msgSend ("PART " + nchan);
-	msgSend ("JOIN " + nchan);
+	sendMsg("PART " + nchan);
+	sendMsg("JOIN " + nchan);
 }
 
 Connection::host_type *
-Connection::hostAdd (host_type *list, pchar host, int port, pchar password)
+	Connection::addHost(host_type *list, pchar host, int port, pchar password)
 {
-	if (list == 0)
-		current = list = new host_type (host, port, password);
+	if (!list)
+		current = list = new host_type(host, port, password);
 	else if (list->next == current)
-		list->next = new host_type (host, port, password, current);
+		list->next = new host_type(host, port, password, current);
 	else
-		return hostAdd (list->next, host, port, password);
+		return addHost(list->next, host, port, password);
 
 	return list;
 }
--- a/sources/core.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/core.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -2,7 +2,7 @@
  *
  * -- CABAL -- core module
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -18,15 +18,15 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
+#include "core.hpp"
 
 Connection *C;
 
-Core::Core()
-	:
-	pid(PID),
+Core::Core():
 	commander(COMMANDER)
 {
+	pid = PID;
+
 	cout << "CORE: initializing...\n";
 
 	debug = true;
@@ -46,12 +46,12 @@
 
 	servers = 0;
 
-	remove (pid);
+	remove(pid);
 
 	cout << "CORE: shutdown complete\n";
 }
 
-void Core::commandParse(int argc, char *argv[])
+void Core::parseCommandLine(int argc, char **argv)
 {
 	for (int e = 1; e < argc; e++) {
 		while (1) {
@@ -59,8 +59,10 @@
 				if (!argv[++e])
 					shut ("missing configuration file");
 
-				cfg = argv[e];
+				config = argv[e];
 				break;
+			} else if (!strcmp(argv[e], "-h") || !strcmp(argv[e], "--help")) {
+				showHelp();
 			} else if (!strcmp(argv[e], "-d") || !strcmp(argv[e], "--daemon")) {
 				debug = false;
 				break;
@@ -70,18 +72,18 @@
 	}
 }
 
-void Core::configParse()
+void Core::parseConfig()
 {
 	servers = -1;
 
-	C = 0;
+	C = false;
 
-	ifstream config(cfg, ios::in);
+	ifstream sysconfig(config, ios::in);
 
-	if (!config)
+	if (!sysconfig)
 		shut ("unable to open configuration file");
 	else {
-		cout << "CORE: parsing configuration file: " << cfg << endl;
+		cout << "CORE: parsing configuration file: " << config << endl;
 
 		if (servers + 1 < MAX_SERVERS) {
 			connections[++servers] = new Connection();
@@ -90,16 +92,16 @@
 		else
 			cout << "Error: maximum connections exceed\n";
 // TEST
-		C->hosts = C->hostAdd (C->hosts, "irc.enqlave.net", 6667, 0);
+		C->hosts = C->addHost(C->hosts, "irc.enqlave.net", 6667, 0);
 // TEST
 	}
 
 	servers++;
 
-	config.close();
+	sysconfig.close();
 }
 
-void Core::pidCheck()
+void Core::checkPID()
 {
 	ifstream procid(pid, ios::in);
 
@@ -115,7 +117,7 @@
 	procid.close();
 }
 
-void Core::pidWrite()
+void Core::writePID()
 {
 	ofstream procid(pid, ios::out);
 
--- a/sources/engine.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/engine.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
  *
  * -- CABAL -- engine (useful functions)
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "engine.h"
+#include "engine.hpp"
 
 bool daemonize()
 {
@@ -38,278 +38,275 @@
 	return time (&t);
 }
 
-char *eTime (time_t t)
+char *eTime(time_t t)
 {
-	char *nt = asctime (localtime (&t));
+	char *nt = asctime(localtime(&t));
 
-	nt[strlen (nt) - 1] = 0;
+	nt[strlen(nt) - 1] = 0;
 
 	return nt;
 }
 
-char *eCountry (char *c)
+string getCountry(string c)
 {
-	if (!*c)
+	if (c == "")
 		return "Enter the correct code of country";
-	else
-		sscanf (c, "%s", c);
 
 	struct countries {
-		char *code;
-		char *country;
+		string code;
+		string country;
 	} countries[] = {
-		"AC", "Ascension Island",
-		"AD", "Andorra",
-		"AE", "United Arab Emirates",
-		"AF", "Afghanistan",
-		"AG", "Antigua and Barbuda",
-		"AI", "Anguilla",
-		"AL", "Albania",
-		"AM", "Armenia",
-		"AN", "Netherlands Antilles",
-		"AO", "Angola",
-		"AQ", "Antarctica",
-		"AR", "Argentina",
-		"AS", "American Samoa",
-		"AT", "Austria",
-		"AU", "Australia",
-		"AW", "Aruba",
-		"AX", "Aland Islands",
-		"AZ", "Azerbaijan",
-		"BA", "Bosnia and Herzegovina",
-		"BB", "Barbados",
-		"BD", "Bangladesh",
-		"BE", "Belgium",
-		"BF", "Burkina Faso",
-		"BG", "Bulgaria",
-		"BH", "Bahrain",
-		"BI", "Burundi",
-		"BJ", "Benin",
-		"BM", "Bermuda",
-		"BN", "Brunei Darussalam",
-		"BO", "Bolivia",
-		"BR", "Brazil",
-		"BS", "Bahamas",
-		"BT", "Bhutan",
-		"BU", "Burma",
-		"BV", "Bouvet Island",
-		"BW", "Botswana",
-		"BY", "Belarus",
-		"BZ", "Belize",
-		"CA", "Canada",
-		"CC", "Cocos (Keeling) Islands",
-		"CD", "The Democratic Republic of the Congo",
-		"CF", "Central African Republic",
-		"CG", "Congo",
-		"CH", "Switzerland",
-		"CI", "Cote d'Ivoire (Ivory Coast)",
-		"CK", "Cook Islands",
-		"CL", "Chile",
-		"CM", "Cameroon",
-		"CN", "China",
-		"CO", "Colombia",
-		"CR", "Costa Rica",
-		"CS", "Serbia and Montenegro",
-		"CU", "Cuba",
-		"CV", "Cape Verde",
-		"CX", "Christmas Island",
-		"CY", "Cyprus",
-		"CZ", "Czech Republic",
-		"DE", "Germany",
-		"DJ", "Djibouti",
-		"DK", "Denmark",
-		"DM", "Dominica",
-		"DO", "Dominican Republic",
-		"DZ", "Algeria",
-		"EC", "Ecuador",
-		"EE", "Estonia",
-		"EG", "Egypt",
-		"EH", "Western Sahara",
-		"ER", "Eritrea",
-		"ES", "Spain (including Canary Islands, Ceuta and Melilla)",
-		"ET", "Ethiopia",
-		"EU", "European Union",
-		"FI", "Finland",
-		"FJ", "Fiji",
-		"FK", "Falkland Islands (Malvinas)",
-		"FM", "Federated States of Micronesia",
-		"FO", "Faroe Islands",
-		"FR", "France",
-		"GA", "Gabon",
-		"GD", "Grenada",
-		"GE", "Georgia",
-		"GF", "French Guiana",
-		"GG", "Guernsey",
-		"GH", "Ghana",
-		"GI", "Gibraltar",
-		"GL", "Greenland",
-		"GM", "Gambia",
-		"GN", "Guinea",
-		"GP", "Guadeloupe",
-		"GQ", "Equatorial Guinea",
-		"GR", "Greece",
-		"GS", "South Georgia and the South Sandwich Islands",
-		"GT", "Guatemala",
-		"GU", "Guam",
-		"GW", "Guinea-Bissau",
-		"GY", "Guyana",
-		"HK", "Hong Kong",
-		"HM", "Heard Island and McDonald Islands",
-		"HN", "Honduras",
-		"HR", "Croatia",
-		"HT", "Haiti",
-		"HU", "Hungary",
-		"ID", "Indonesia",
-		"IE", "Ireland",
-		"IL", "Israel",
-		"IM", "Isle of Man",
-		"IN", "India",
-		"IO", "British Indian Ocean Territory (including Diego Garcia)",
-		"IQ", "Iraq",
-		"IR", "Islamic Republic of Iran",
-		"IS", "Iceland",
-		"IT", "Italy",
-		"JE", "Jersey",
-		"JM", "Jamaica",
-		"JO", "Jordan",
-		"JP", "Japan",
-		"KE", "Kenya",
-		"KG", "Kyrgyzstan",
-		"KH", "Cambodia",
-		"KI", "Kiribati",
-		"KM", "Comoros",
-		"KN", "Saint Kitts and Nevis",
-		"KP", "Democratic People's Republic of Korea (North Korea)",
-		"KR", "Republic of Korea (South Korea)",
-		"KW", "Kuwait",
-		"KY", "Cayman Islands",
-		"KZ", "Kazakhstan",
-		"LA", "Lao People's Democratic Republic",
-		"LB", "Lebanon",
-		"LC", "Saint Lucia",
-		"LI", "Liechtenstein",
-		"LK", "Sri Lanka",
-		"LR", "Liberia",
-		"LS", "Lesotho",
-		"LT", "Lithuania",
-		"LU", "Luxembourg",
-		"LV", "Latvia",
-		"LY", "Libyan Arab Jamahiriya",
-		"MA", "Morocco",
-		"MC", "Monaco",
-		"MD", "Republic of Moldova",
-		"MG", "Madagascar",
-		"MH", "Marshall Islands",
-		"MK", "Macedonia",
-		"ML", "Mali",
-		"MM", "Myanmar",
-		"MN", "Mongolia",
-		"MO", "Macao",
-		"MP", "Northern Mariana Islands",
-		"MQ", "Martinique",
-		"MR", "Mauritania",
-		"MS", "Montserrat",
-		"MT", "Malta",
-		"MU", "Mauritius",
-		"MV", "Maldives",
-		"MW", "Malawi",
-		"MX", "Mexico",
-		"MY", "Malaysia",
-		"MZ", "Mozambique",
-		"NA", "Namibia",
-		"NC", "New Caledonia",
-		"NE", "Niger",
-		"NF", "Norfolk Island",
-		"NG", "Nigeria",
-		"NI", "Nicaragua",
-		"NL", "Netherlands",
-		"NO", "Norway",
-		"NP", "Nepal",
-		"NR", "Nauru",
-		"NU", "Niue",
-		"NZ", "New Zealand",
-		"OM", "Oman",
-		"PA", "Panama",
-		"PE", "Peru",
-		"PF", "French Polynesia (including Clipperton Island)",
-		"PG", "Papua New Guinea",
-		"PH", "Philippines",
-		"PK", "Pakistan",
-		"PL", "Poland",
-		"PM", "Saint Pierre and Miquelon",
-		"PN", "Pitcairn",
-		"PR", "Puerto Rico",
-		"PS", "Palestinian Territory, Occupied",
-		"PT", "Portugal",
-		"PW", "Palau",
-		"PY", "Paraguay",
-		"QA", "Qatar",
-		"RE", "Reunion",
-		"RO", "Romania",
-		"RU", "Russian Federation",
-		"RW", "Rwanda",
-		"SA", "Saudi Arabia",
-		"SB", "Solomon Islands",
-		"SC", "Seychelles",
-		"SD", "Sudan",
-		"SE", "Sweden",
-		"SG", "Singapore",
-		"SH", "Saint Helena (including Ascension Island and Tristan da Cunha)",
-		"SI", "Slovenia",
-		"SJ", "Svalbard and Jan Mayen consisting of Svalbard and Jan Mayen",
-		"SK", "Slovakia",
-		"SL", "Sierra Leone",
-		"SM", "San Marino",
-		"SN", "Senegal",
-		"SO", "Somalia",
-		"SR", "Suriname",
-		"ST", "Sao Tome and Principe",
-		"SU", "Soviet Union",
-		"SV", "El Salvador",
-		"SY", "Syrian Arab Republic",
-		"SZ", "Swaziland",
-		"TC", "Turks and Caicos Islands",
-		"TD", "Chad",
-		"TF", "French Southern Territories",
-		"TG", "Togo",
-		"TH", "Thailand",
-		"TJ", "Tajikistan",
-		"TK", "Tokelau",
-		"TL", "Timor-Leste (East Timor)",
-		"TM", "Turkmenistan",
-		"TN", "Tunisia",
-		"TO", "Tonga",
-		"TR", "Turkey",
-		"TT", "Trinidad and Tobago",
-		"TV", "Tuvalu",
-		"TW", "Taiwan, Province of China",
-		"TZ", "United Republic of Tanzania",
-		"UA", "Ukraine",
-		"UG", "Uganda",
-		"UK", "United Kingdom",
-		"UM", "United States Minor Outlying Islands",
-		"US", "United States",
-		"UY", "Uruguay",
-		"UZ", "Uzbekistan",
-		"VA", "Holy See (Vatican City State)",
-		"VC", "Saint Vincent and the Grenadines",
-		"VE", "Venezuela",
-		"VG", "Virgin Islands, British",
-		"VI", "Virgin Islands, U.S.",
-		"VN", "Viet Nam",
-		"VU", "Vanuatu",
-		"WF", "Wallis and Futuna",
-		"WS", "Samoa",
-		"YE", "Yemen",
-		"YT", "Mayotte",
-		"ZA", "South Africa",
-		"ZM", "Zambia",
-		"ZW", "Zimbabwe",
-		0
+		{"AC", "Ascension Island"},
+		{"AD", "Andorra"},
+		{"AE", "United Arab Emirates"},
+		{"AF", "Afghanistan"},
+		{"AG", "Antigua and Barbuda"},
+		{"AI", "Anguilla"},
+		{"AL", "Albania"},
+		{"AM", "Armenia"},
+		{"AN", "Netherlands Antilles"},
+		{"AO", "Angola"},
+		{"AQ", "Antarctica"},
+		{"AR", "Argentina"},
+		{"AS", "American Samoa"},
+		{"AT", "Austria"},
+		{"AU", "Australia"},
+		{"AW", "Aruba"},
+		{"AX", "Aland Islands"},
+		{"AZ", "Azerbaijan"},
+		{"BA", "Bosnia and Herzegovina"},
+		{"BB", "Barbados"},
+		{"BD", "Bangladesh"},
+		{"BE", "Belgium"},
+		{"BF", "Burkina Faso"},
+		{"BG", "Bulgaria"},
+		{"BH", "Bahrain"},
+		{"BI", "Burundi"},
+		{"BJ", "Benin"},
+		{"BM", "Bermuda"},
+		{"BN", "Brunei Darussalam"},
+		{"BO", "Bolivia"},
+		{"BR", "Brazil"},
+		{"BS", "Bahamas"},
+		{"BT", "Bhutan"},
+		{"BU", "Burma"},
+		{"BV", "Bouvet Island"},
+		{"BW", "Botswana"},
+		{"BY", "Belarus"},
+		{"BZ", "Belize"},
+		{"CA", "Canada"},
+		{"CC", "Cocos (Keeling) Islands"},
+		{"CD", "The Democratic Republic of the Congo"},
+		{"CF", "Central African Republic"},
+		{"CG", "Congo"},
+		{"CH", "Switzerland"},
+		{"CI", "Cote d'Ivoire (Ivory Coast)"},
+		{"CK", "Cook Islands"},
+		{"CL", "Chile"},
+		{"CM", "Cameroon"},
+		{"CN", "China"},
+		{"CO", "Colombia"},
+		{"CR", "Costa Rica"},
+		{"CS", "Serbia and Montenegro"},
+		{"CU", "Cuba"},
+		{"CV", "Cape Verde"},
+		{"CX", "Christmas Island"},
+		{"CY", "Cyprus"},
+		{"CZ", "Czech Republic"},
+		{"DE", "Germany"},
+		{"DJ", "Djibouti"},
+		{"DK", "Denmark"},
+		{"DM", "Dominica"},
+		{"DO", "Dominican Republic"},
+		{"DZ", "Algeria"},
+		{"EC", "Ecuador"},
+		{"EE", "Estonia"},
+		{"EG", "Egypt"},
+		{"EH", "Western Sahara"},
+		{"ER", "Eritrea"},
+		{"ES", "Spain (inc. Canary Islands, Ceuta and Melilla)"},
+		{"ET", "Ethiopia"},
+		{"EU", "European Union"},
+		{"FI", "Finland"},
+		{"FJ", "Fiji"},
+		{"FK", "Falkland Islands (Malvinas)"},
+		{"FM", "Federated States of Micronesia"},
+		{"FO", "Faroe Islands"},
+		{"FR", "France"},
+		{"GA", "Gabon"},
+		{"GD", "Grenada"},
+		{"GE", "Georgia"},
+		{"GF", "French Guiana"},
+		{"GG", "Guernsey"},
+		{"GH", "Ghana"},
+		{"GI", "Gibraltar"},
+		{"GL", "Greenland"},
+		{"GM", "Gambia"},
+		{"GN", "Guinea"},
+		{"GP", "Guadeloupe"},
+		{"GQ", "Equatorial Guinea"},
+		{"GR", "Greece"},
+		{"GS", "South Georgia and the South Sandwich Islands"},
+		{"GT", "Guatemala"},
+		{"GU", "Guam"},
+		{"GW", "Guinea-Bissau"},
+		{"GY", "Guyana"},
+		{"HK", "Hong Kong"},
+		{"HM", "Heard Island and McDonald Islands"},
+		{"HN", "Honduras"},
+		{"HR", "Croatia"},
+		{"HT", "Haiti"},
+		{"HU", "Hungary"},
+		{"ID", "Indonesia"},
+		{"IE", "Ireland"},
+		{"IL", "Israel"},
+		{"IM", "Isle of Man"},
+		{"IN", "India"},
+		{"IO", "British Indian Ocean Territory (inc. Diego Garcia)"},
+		{"IQ", "Iraq"},
+		{"IR", "Islamic Republic of Iran"},
+		{"IS", "Iceland"},
+		{"IT", "Italy"},
+		{"JE", "Jersey"},
+		{"JM", "Jamaica"},
+		{"JO", "Jordan"},
+		{"JP", "Japan"},
+		{"KE", "Kenya"},
+		{"KG", "Kyrgyzstan"},
+		{"KH", "Cambodia"},
+		{"KI", "Kiribati"},
+		{"KM", "Comoros"},
+		{"KN", "Saint Kitts and Nevis"},
+		{"KP", "Democratic People's Republic of Korea (North Korea)"},
+		{"KR", "Republic of Korea (South Korea)"},
+		{"KW", "Kuwait"},
+		{"KY", "Cayman Islands"},
+		{"KZ", "Kazakhstan"},
+		{"LA", "Lao People's Democratic Republic"},
+		{"LB", "Lebanon"},
+		{"LC", "Saint Lucia"},
+		{"LI", "Liechtenstein"},
+		{"LK", "Sri Lanka"},
+		{"LR", "Liberia"},
+		{"LS", "Lesotho"},
+		{"LT", "Lithuania"},
+		{"LU", "Luxembourg"},
+		{"LV", "Latvia"},
+		{"LY", "Libyan Arab Jamahiriya"},
+		{"MA", "Morocco"},
+		{"MC", "Monaco"},
+		{"MD", "Republic of Moldova"},
+		{"MG", "Madagascar"},
+		{"MH", "Marshall Islands"},
+		{"MK", "Macedonia"},
+		{"ML", "Mali"},
+		{"MM", "Myanmar"},
+		{"MN", "Mongolia"},
+		{"MO", "Macao"},
+		{"MP", "Northern Mariana Islands"},
+		{"MQ", "Martinique"},
+		{"MR", "Mauritania"},
+		{"MS", "Montserrat"},
+		{"MT", "Malta"},
+		{"MU", "Mauritius"},
+		{"MV", "Maldives"},
+		{"MW", "Malawi"},
+		{"MX", "Mexico"},
+		{"MY", "Malaysia"},
+		{"MZ", "Mozambique"},
+		{"NA", "Namibia"},
+		{"NC", "New Caledonia"},
+		{"NE", "Niger"},
+		{"NF", "Norfolk Island"},
+		{"NG", "Nigeria"},
+		{"NI", "Nicaragua"},
+		{"NL", "Netherlands"},
+		{"NO", "Norway"},
+		{"NP", "Nepal"},
+		{"NR", "Nauru"},
+		{"NU", "Niue"},
+		{"NZ", "New Zealand"},
+		{"OM", "Oman"},
+		{"PA", "Panama"},
+		{"PE", "Peru"},
+		{"PF", "French Polynesia (inc. Clipperton Island)"},
+		{"PG", "Papua New Guinea"},
+		{"PH", "Philippines"},
+		{"PK", "Pakistan"},
+		{"PL", "Poland"},
+		{"PM", "Saint Pierre and Miquelon"},
+		{"PN", "Pitcairn"},
+		{"PR", "Puerto Rico"},
+		{"PS", "Palestinian Territory, Occupied"},
+		{"PT", "Portugal"},
+		{"PW", "Palau"},
+		{"PY", "Paraguay"},
+		{"QA", "Qatar"},
+		{"RE", "Reunion"},
+		{"RO", "Romania"},
+		{"RU", "Russian Federation"},
+		{"RW", "Rwanda"},
+		{"SA", "Saudi Arabia"},
+		{"SB", "Solomon Islands"},
+		{"SC", "Seychelles"},
+		{"SD", "Sudan"},
+		{"SE", "Sweden"},
+		{"SG", "Singapore"},
+		{"SH", "Saint Helena (inc. Ascension Island and Tristan da Cunha)"},
+		{"SI", "Slovenia"},
+		{"SJ", "Svalbard and Jan Mayen consisting of Svalbard and Jan Mayen"},
+		{"SK", "Slovakia"},
+		{"SL", "Sierra Leone"},
+		{"SM", "San Marino"},
+		{"SN", "Senegal"},
+		{"SO", "Somalia"},
+		{"SR", "Suriname"},
+		{"ST", "Sao Tome and Principe"},
+		{"SU", "Soviet Union"},
+		{"SV", "El Salvador"},
+		{"SY", "Syrian Arab Republic"},
+		{"SZ", "Swaziland"},
+		{"TC", "Turks and Caicos Islands"},
+		{"TD", "Chad"},
+		{"TF", "French Southern Territories"},
+		{"TG", "Togo"},
+		{"TH", "Thailand"},
+		{"TJ", "Tajikistan"},
+		{"TK", "Tokelau"},
+		{"TL", "Timor-Leste (East Timor)"},
+		{"TM", "Turkmenistan"},
+		{"TN", "Tunisia"},
+		{"TO", "Tonga"},
+		{"TR", "Turkey"},
+		{"TT", "Trinidad and Tobago"},
+		{"TV", "Tuvalu"},
+		{"TW", "Taiwan, Province of China"},
+		{"TZ", "United Republic of Tanzania"},
+		{"UA", "Ukraine"},
+		{"UG", "Uganda"},
+		{"UK", "United Kingdom"},
+		{"UM", "United States Minor Outlying Islands"},
+		{"US", "United States"},
+		{"UY", "Uruguay"},
+		{"UZ", "Uzbekistan"},
+		{"VA", "Holy See (Vatican City State)"},
+		{"VC", "Saint Vincent and the Grenadines"},
+		{"VE", "Venezuela"},
+		{"VG", "Virgin Islands, British"},
+		{"VI", "Virgin Islands, U.S."},
+		{"VN", "Viet Nam"},
+		{"VU", "Vanuatu"},
+		{"WF", "Wallis and Futuna"},
+		{"WS", "Samoa"},
+		{"YE", "Yemen"},
+		{"YT", "Mayotte"},
+		{"ZA", "South Africa"},
+		{"ZM", "Zambia"},
+		{"ZW", "Zimbabwe"},
 	};
 
-	for (int e = 0; countries[e].code; e++)
-		if (!strcasecmp (countries[e].code, c))
+	for (int e = 0; countries[e].code != ""; e++)
+		if (countries[e].code == c)
 			return countries[e].country;
 
 	return "Incorrect country code, try again";
--- a/sources/headers/cabal.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/**
- * cabal.h (2007-03-04)
- *
- * -- CABAL -- main header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _CABAL_H_
-#define _CABAL_H_
-
-#define VERSION "0.0.5" // 2007-05-18
-
-#include "core.h"
-
-extern Core *CABAL;
-
-#endif // _CABAL_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/cabal.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,31 @@
+/**
+ * cabal.hpp (2007-03-04)
+ *
+ * -- CABAL -- main header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CABAL_HPP_
+#define _CABAL_HPP_
+
+#define VERSION "0.0.5" // 2007-05-18
+
+#include "core.hpp"
+
+extern Core *CABAL;
+
+#endif // _CABAL_HPP_
--- a/sources/headers/conf.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/**
- * conf.h (2007-03-04)
- *
- * -- CABAL -- user configuration
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define ENABLE_IPV6 1
-
-#define HAVE_FSTREAM 1
-
-#define HAVE_IOSTREAM 1
-
-#define HAVE_UNISTD_H 1
-
-#define HAVE_STRING 1
-
-#define HAVE_NETINET_TCP_H 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/conf.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,32 @@
+/**
+ * conf.hpp (2007-03-04)
+ *
+ * -- CABAL -- user configuration
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#define ENABLE_IPV6 1
+
+#define HAVE_FSTREAM 1
+
+#define HAVE_IOSTREAM 1
+
+#define HAVE_UNISTD_H 1
+
+#define HAVE_STRING 1
+
+#define HAVE_NETINET_TCP_H 1
--- a/sources/headers/connection.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/**
- * connection.h (2007-04-12)
- *
- * -- CABAL -- connection header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _CONNECTION_H_
-#define _CONNECTION_H_
-
-#include "network.h"
-
-class Connection
-	: public Network
-{
-public:
-	Connection();
-	~Connection();
-
-	void ircConnect();
-
-	void ircPass(string);
-	void ircNick(string);
-	void ircUser(string, string);
-	void ircAway(string);
-	void ircJoin(string, string);
-	void ircPart(string);
-	void ircCycle(string);
-
-	void establish();
-
-	struct host_type {
-		pchar host;
-		int port;
-		pchar password;
-		host_type *next;
-
-		host_type(pchar h, int p, pchar pw)
-			:
-			host(h),
-			port(p),
-			password(pw),
-			next(this)
-			{};
-		host_type(pchar h, int p, pchar pw, host_type *t)
-			:
-			host(h),
-			port(p),
-			password(pw),
-			next(t)
-			{};
-	} *hosts, *current;
-
-	host_type *hostAdd(host_type *, pchar, int, pchar);
-
-	pchar virtualhost, nick, user, name, chan, key;
-
-	time_t now, uptime;
-};
-
-#endif // _CONNECTION_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/connection.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,75 @@
+/**
+ * connection.hpp (2007-04-12)
+ *
+ * -- CABAL -- connection header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CONNECTION_HPP_
+#define _CONNECTION_HPP_
+
+#include "network.hpp"
+
+class Connection
+	: public Network
+{
+public:
+	Connection();
+	~Connection();
+
+	void ircConnect();
+
+	void ircPass(string);
+	void ircNick(string);
+	void ircUser(string, string);
+	void ircAway(string);
+	void ircJoin(string, string);
+	void ircPart(string);
+	void ircCycle(string);
+
+	void establish();
+
+	struct host_type {
+		pchar host;
+		int port;
+		pchar password;
+		host_type *next;
+
+		host_type(pchar h, int p, pchar pw):
+			host(h),
+			port(p),
+			password(pw),
+			next(this)
+			{
+			};
+		host_type(pchar h, int p, pchar pw, host_type *t):
+			host(h),
+			port(p),
+			password(pw),
+			next(t)
+			{
+			};
+	} *hosts, *current;
+
+	host_type *addHost(host_type *, pchar, int, pchar);
+
+	pchar virtualhost, nick, user, name, chan, key;
+
+	time_t now, uptime;
+};
+
+#endif // _CONNECTION_HPP_
--- a/sources/headers/core.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/**
- * core.h (2007-03-04)
- *
- * -- CABAL -- core header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _CORE_H_
-#define _CORE_H_
-
-#define VERSION_CORE "0.0.7" // 2007-05-13
-
-#include "engine.h"
-#include "connection.h"
-#include "parser.h"
-
-class Core {
-
-public:
-	Core();
-	~Core();
-
-	void commandParse (int argc, char *argv[]);
-	void configParse();
-	void pidCheck();
-	void pidWrite();
-
-	void work();
-
-	int servers;
-	Connection *connections[MAX_SERVERS];
-
-	char *cfg;
-	char *pid;
-
-	char commander;
-
-	bool debug;
-
-	time_t now;
-};
-
-extern Connection *C;
-
-#endif // _CORE_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/core.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,59 @@
+/**
+ * core.hpp (2007-03-04)
+ *
+ * -- CABAL -- core header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _CORE_HPP_
+#define _CORE_HPP_
+
+#define VERSION_CORE "0.0.7" // 2007-05-13
+
+#include "engine.hpp"
+#include "connection.hpp"
+#include "parser.hpp"
+
+class Core
+{
+public:
+	Core();
+	~Core();
+
+	void parseCommandLine(int, char **);
+	void parseConfig();
+	void checkPID();
+	void writePID();
+
+	void work();
+
+	int servers;
+	Connection *connections[MAX_SERVERS];
+
+	char *pid;
+	char *config;
+
+	char commander;
+
+	bool debug;
+
+	time_t now;
+};
+
+extern Connection *C;
+
+#endif // _CORE_HPP_
--- a/sources/headers/engine.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/**
- * engine.h (2007-03-05)
- *
- * -- CABAL -- engine header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _ENGINE_H_
-#define _ENGINE_H_
-
-#include "os.h"
-
-void shut();
-void shut(string);
-
-bool daemonize();
-
-time_t gettime();
-
-// Global definitions (constants)
-
-#define MAX_SERVERS 50
-
-// Default values
-
-#define PID "cabal.pid"
-
-#define NICK "CABAL"
-#define USER "cabal"
-#define NAME "C++ Automatic Bot As a Lifeform"
-#define CHANNEL "#cabal"
-#define CHANNEL_KEY ""
-
-#define COMMANDER '.'
-
-#endif // _ENGINE_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/engine.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,53 @@
+/**
+ * engine.hpp (2007-03-05)
+ *
+ * -- CABAL -- engine header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _ENGINE_HPP_
+#define _ENGINE_HPP_
+
+#include "os.hpp"
+
+void shut();
+void shut(string);
+void showHelp();
+
+bool daemonize();
+
+time_t gettime();
+
+string showCountry(string);
+
+// Global definitions (constants)
+
+#define MAX_SERVERS 50
+
+// Default values
+
+#define PID "cabal.pid"
+
+#define NICK "CABAL"
+#define USER "cabal"
+#define NAME "C++ Automatic Bot As a Lifeform"
+#define CHANNEL "#cabal"
+#define CHANNEL_KEY ""
+
+#define COMMANDER '.'
+
+#endif // _ENGINE_HPP_
--- a/sources/headers/network.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/**
- * network.h (2007-04-02)
- *
- * -- CABAL -- network header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _NETWORK_H_
-#define _NETWORK_H_
-
-#include "core.h"
-
-class Network {
-
-public:
-	Network();
-	~Network();
-
-	void msgSend(string);
-	string msgReceive();
-
-	int cs;
-
-	struct address_type {
-		int inet;
-		struct sockaddr_in sa;
-#ifdef ENABLE_IPV6
-		struct sockaddr_in6 sa6;
-#endif
-	} address;
-
-	bool socketClose();
-
-	bool hostResolve(pchar, address_type *, int inet = 0);
-	bool tcpActivate(int, pchar host = 0);
-	bool hostOpen();
-
-	int canRead(int);
-	int canWrite(int);
-
-	fd_set rs, ws;
-	timeval timeout;
-
-	bool connecting, connected;
-};
-
-#endif // _NETWORK_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/network.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,61 @@
+/**
+ * network.hpp (2007-04-02)
+ *
+ * -- CABAL -- network header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _NETWORK_HPP_
+#define _NETWORK_HPP_
+
+#include "core.hpp"
+
+class Network {
+
+public:
+	Network();
+	~Network();
+
+	void sendMsg(string);
+	string receiveMsg();
+
+	int cs;
+
+	struct address_type {
+		int inet;
+		struct sockaddr_in sa;
+#ifdef ENABLE_IPV6
+		struct sockaddr_in6 sa6;
+#endif
+	} address;
+
+	bool socketClose();
+
+	bool hostResolve(pchar, address_type *, int inet = 0);
+	bool tcpActivate(int, pchar host = 0);
+	bool hostOpen();
+
+	int canRead(int);
+	int canWrite(int);
+
+	fd_set rs, ws;
+	timeval timeout;
+
+	bool connecting, connected;
+};
+
+#endif // _NETWORK_HPP_
--- a/sources/headers/os.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/**
- * os.h (2007-03-04)
- *
- * -- CABAL -- operating system detection
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _OS_H_
-#define _OS_H_
-
-#include "conf.h"
-
-typedef const char *pchar;
-
-#if HAVE_FSTREAM
-	#include <fstream>
-#endif // HAVE_FSTREAM
-
-#if HAVE_IOSTREAM
-	#include <iostream>
-	using namespace std;
-#else
-	#include <iostream.h>
-#endif // HAVE_IOSTREAM
-
-#include <errno.h>
-#include <signal.h>
-
-#if HAVE_UNISTD_H
-	#include <unistd.h>
-#endif // HAVE_UNISTD_H
-
-#if HAVE_STRING
-	#include <string.h>
-#endif // HAVE_STRING
-
-#include <sys/socket.h>
-
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#include <netinet/in.h>
-
-#if HAVE_NETINET_TCP_H
-	#include <netinet/tcp.h>
-#endif // HAVE_NETINET_TCP_H
-
-#endif // _OS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/os.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,62 @@
+/**
+ * os.hpp (2007-03-04)
+ *
+ * -- CABAL -- operating system detection
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _OS_HPP_
+#define _OS_HPP_
+
+#include "conf.hpp"
+
+typedef const char *pchar;
+
+#if HAVE_FSTREAM
+	#include <fstream>
+#endif // HAVE_FSTREAM
+
+#if HAVE_IOSTREAM
+	#include <iostream>
+	using namespace std;
+#else
+	#include <iostream.h>
+#endif // HAVE_IOSTREAM
+
+#include <errno.h>
+#include <signal.h>
+
+#if HAVE_UNISTD_H
+	#include <unistd.h>
+#endif // HAVE_UNISTD_H
+
+#if HAVE_STRING
+	#include <string.h>
+#endif // HAVE_STRING
+
+#include <sys/socket.h>
+
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include <netinet/in.h>
+
+#if HAVE_NETINET_TCP_H
+	#include <netinet/tcp.h>
+#endif // HAVE_NETINET_TCP_H
+
+#endif // _OS_HPP_
--- a/sources/headers/parser.h	Sun Jan 20 19:32:59 2008 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/**
- * parser.h (2007-05-13)
- *
- * -- CABAL -- irc commands parser header
- *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _PARSER_H_
-#define _PARSER_H_
-
-#include "core.h"
-
-class Parser {
-
-public:
-	Parser(Connection *, string);
-	~Parser();
-
-	void Parse (Connection *);
-
-	char *alien;
-	char *alienid;
-	char *alienact;
-	char *alienloc;
-	char *aliencmd;
-	char *alienmsg;
-};
-
-#endif // _PARSER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/headers/parser.hpp	Mon Jan 21 01:14:10 2008 +0300
@@ -0,0 +1,43 @@
+/**
+ * parser.hpp (2007-05-13)
+ *
+ * -- CABAL -- irc commands parser header
+ *
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _PARSER_HPP_
+#define _PARSER_HPP_
+
+#include "core.hpp"
+
+class Parser
+{
+public:
+	Parser(Connection *, string);
+	~Parser();
+
+	void Parse(Connection *);
+
+	string alien;
+	string alienID;
+	string alienAction;
+	string alienLocation;
+	string alienCommand;
+	string alienMessage;
+};
+
+#endif // _PARSER_HPP_
--- a/sources/network.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/network.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
  *
  * -- CABAL -- network essentials (sockets, etc.)
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,7 +19,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cabal.h"	// required: network.h
+#include "cabal.hpp"	// required: network.hpp
 
 Network::Network()
 {
@@ -33,36 +33,36 @@
 	cout << "NETWORK: offline\n";
 }
 
-void Network::msgSend (string data)
+void Network::sendMsg(string m)
 {
 	if (cs == -1)
 		return;
 
 	if (CABAL->debug)
-		cout << "<- " << cs << " -- " << data << endl;
+		cout << "<- " << cs << " -- " << m << endl;
 
-	send (cs, (data + "\n").c_str(), (data + "\n").size(), 0);
+	send(cs, (m + "\n").c_str(), (m + "\n").size(), 0);
 }
 
-string Network::msgReceive()
+string Network::receiveMsg()
 {
 	if (cs == -1)
 		return 0;
 
-	if (canRead(cs) == 1) {
+	if (canRead(cs)) {
 		string sbuffer = "";
 		char cbuffer;
 
-		int err = recv (cs, &cbuffer, 1, 0);
+		int err = recv(cs, &cbuffer, 1, 0);
 
 		if (err > 0) {
 			sbuffer += cbuffer;
 
 			while (1) {
 				if (sbuffer[sbuffer.size() - 1] == '\n') {
-					sbuffer = (sbuffer.substr (0, 1) == ":")
-						? sbuffer.substr (1, sbuffer.size() - 3)
-						: sbuffer.substr (0, sbuffer.size() - 2);
+					sbuffer = (sbuffer.substr(0, 1) == ":")
+						? sbuffer.substr(1, sbuffer.size() - 3)
+						: sbuffer.substr(0, sbuffer.size() - 2);
 
 					if (CABAL->debug)
 						cout << "-> " << cs << " -- " << sbuffer << endl;
@@ -70,16 +70,16 @@
 					return sbuffer;
 				}
 
-				err = recv (cs, &cbuffer, 1, 0);
+				err = recv(cs, &cbuffer, 1, 0);
 
-				if (err == 0)
+				if (!err)
 					shut ("remote server closed connection");
 				else if (err < 0)
 					shut ("failed to receive data");
 				else
 					sbuffer += cbuffer;
 			}
-		} else if (err == 0)
+		} else if (!err)
 			shut ("remote server closed connection");
 
 		return sbuffer;
@@ -107,7 +107,7 @@
 
 	reso = res;
 
-	while (res != 0) {
+	while (res) {
 		if (!inet || res->ai_family == inet) {
 			switch (res->ai_family) {
 				case AF_INET6:
@@ -135,26 +135,26 @@
 		res = res->ai_next;
 	}
 
-	freeaddrinfo (reso);
+	freeaddrinfo(reso);
 
 	return e;
 
 #else
 
-	if (inet != 0 && inet != AF_INET)
+	if (inet && inet != AF_INET)
 		return 0;
 
 	a->inet = AF_INET;
 
 	struct hostent *he;
 
-	if ((he = gethostbyname (name)) == 0) {
-		a->sa.sin_addr.s_addr = inet_addr (name);
+	if (!(he = gethostbyname(name))) {
+		a->sa.sin_addr.s_addr = inet_addr(name);
 
-		if (a->sa.sin_addr.s_addr == 1)
+		if (a->sa.sin_addr.s_addr)
 			return 0;
 	} else
-		memcpy (&a->sa.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
+		memcpy(&a->sa.sin_addr.s_addr, he->h_addr_list[0], he->h_length);
 
 	return 1;
 
@@ -163,16 +163,16 @@
 
 bool Network::tcpActivate (int port, pchar host)
 {
-	cs = socket (address.inet, SOCK_STREAM, IPPROTO_TCP);
+	cs = socket(address.inet, SOCK_STREAM, IPPROTO_TCP);
 
 	if (cs == -1)
 		return 0;
 
-	if (host != 0) {
+	if (host) {
 		struct address_type a;
 
-		if (!hostResolve (host, &a, address.inet)) {
-			close (cs);
+		if (!hostResolve(host, &a, address.inet)) {
+			close(cs);
 			return 0;
 		}
 
@@ -180,13 +180,13 @@
 
 #ifdef ENABLE_IPV6
 		if (a.inet == AF_INET6)
-			e = bind (cs, (struct sockaddr *)&a.sa6, sizeof (a.sa6));
+			e = bind(cs, (struct sockaddr *)&a.sa6, sizeof (a.sa6));
 		else
 #endif // ENABLE_IPV6
-			e = bind (cs, (struct sockaddr *)&a.sa, sizeof (a.sa));
+			e = bind(cs, (struct sockaddr *)&a.sa, sizeof (a.sa));
 
 		if (e == -1) {
-			close (cs);
+			close(cs);
 			return 0;
 		}
 	}
@@ -194,19 +194,19 @@
 #ifdef ENABLE_IPV6
 	if (address.inet == AF_INET6) {
 		address.sa6.sin6_family = AF_INET6;
-		address.sa6.sin6_port = htons (port);
+		address.sa6.sin6_port = htons(port);
 	}
 	else {
 #endif // ENABLE_IPV6
 		address.sa.sin_family = AF_INET;
-		address.sa.sin_port = htons (port);
+		address.sa.sin_port = htons(port);
 #ifdef ENABLE_IPV6
 	}
 #endif // ENABLE_IPV6
 
 	socklen_t parm;
 
-	setsockopt (cs, IPPROTO_TCP, TCP_NODELAY, (pchar)&parm, sizeof (parm));
+	setsockopt(cs, IPPROTO_TCP, TCP_NODELAY, (pchar)&parm, sizeof(parm));
 
 	connected = 0;
 	connecting = 1;
@@ -219,13 +219,12 @@
 bool Network::hostOpen()
 {
 	int e;
-
 #ifdef ENABLE_IPV6
 	if (address.inet == AF_INET6)
-		e = connect (cs, (struct sockaddr *)&address.sa6, sizeof (address.sa6));
+		e = connect(cs, (struct sockaddr *)&address.sa6, sizeof(address.sa6));
 	else
 #endif // ENABLE_IPV6
-		e = connect (cs, (struct sockaddr *)&address.sa, sizeof (address.sa));
+		e = connect(cs, (struct sockaddr *)&address.sa, sizeof(address.sa));
 
 	if (e == -1) {
 		if (errno == EISCONN) {
@@ -266,32 +265,32 @@
 	return 1;
 }
 
-int Network::canRead (int socket)
+int Network::canRead(int socket)
 {
-	FD_ZERO (&rs);
-	FD_SET (socket, &rs);
+	FD_ZERO(&rs);
+	FD_SET(socket, &rs);
 
 	timeout.tv_sec = 0;
 	timeout.tv_usec = 1;
 
-	int e = select (socket + 1, &rs, 0, 0, &timeout);
+	int e = select(socket + 1, &rs, 0, 0, &timeout);
 
-	FD_ZERO (&rs);
+	FD_ZERO(&rs);
 
 	return e;
 }
 
-int Network::canWrite (int socket)
+int Network::canWrite(int socket)
 {
-	FD_ZERO (&ws);
-	FD_SET (socket, &ws);
+	FD_ZERO(&ws);
+	FD_SET(socket, &ws);
 
 	timeout.tv_sec = 0;
 	timeout.tv_usec = 1;
 
-	int e = select (socket + 1, 0, &ws, 0, &timeout);
+	int e = select(socket + 1, 0, &ws, 0, &timeout);
 
-	FD_ZERO (&ws);
+	FD_ZERO(&ws);
 
 	return e;
 }
--- a/sources/parser.cpp	Sun Jan 20 19:32:59 2008 +0300
+++ b/sources/parser.cpp	Mon Jan 21 01:14:10 2008 +0300
@@ -3,7 +3,7 @@
  *
  * -- CABAL -- irc commands parser
  *
- * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com>
+ * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
  * All rights reserved.
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -19,109 +19,21 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "cabal.h"	// required: parser.h
+#include "cabal.hpp" // required: parser.hpp
 
 Parser::Parser(Connection *S, string parsing)
-	:
-	alien(""),
-	alienid(""),
-	alienact(""),
-	alienloc(""),
-	aliencmd(""),
-	alienmsg ("")
 {
 	if (parsing.substr(0, 6) == "PING :") {
-		string pong = parsing;
-		pong[1] = 'O';
-		S->msgSend(pong);
-	} else {
-		char *query = new char[parsing.size() + 1];
-
-		int e = 0;
-
-		while ((query[e] = parsing[e]))
-			e++;
-
-		char *who = new char[e];
-		char *what = new char[e];
-		char *where = new char[e];
-		char *message = new char[e];
-
-		if (sscanf (query, "%s %s %s", who, what, where) == 3) {
-			alienact = what;
-
-			if ((alienid = strchr (who, '!'))) {
-				alienid++, alien = strtok (who, "!");
-
-				if (*where == ':')
-					alienloc = where + 1;
-				else {
-					alienloc = where;
-
-					if ((aliencmd = strchr (strstr (query, alienloc), ' ')) \
-						&& *++aliencmd == ':') {
-						if (!strcmp (alienloc, S->nick))
-							alienloc = alien;
-
-						if (*++aliencmd == CABAL->commander) {
-							if ((alienmsg = strchr (aliencmd, ' ')))
-								alienmsg++;
-							else
-								alienmsg = "";
-
-							aliencmd = strtok (aliencmd, " "), aliencmd++;
-						}
-						else
-							alienmsg = aliencmd, aliencmd = "";
-					}
-					else
-						alienmsg = strtok (aliencmd, " "), aliencmd = "";
-				}
-			}
-			else
-				alienid = "";
-/* DEBUG
-			cout
-				<< "-----------------------------------\n" \
-				<< "Alien:	\t" << alien << endl \
-				<< "Alien ID:\t" << alienid << endl \
-				<< "Alien action:\t" << alienact << endl \
-				<< "Alien location:\t" << alienloc << endl \
-				<< "Alien command:\t" << aliencmd << endl \
-				<< "Alien message:\t" << alienmsg << endl \
-				<< "-----------------------------------\n";
-*/		}
-
-		delete[] who;
-		delete[] what;
-		delete[] where;
-		delete[] message;
-		delete[] query;
-	}
+		parsing[1] = 'O';
+		S->sendMsg(parsing);
+	} else
+		cout << "Processed line" << endl;
 }
 
 Parser::~Parser()
 {
-	alien = alienid = alienact = alienloc = aliencmd = alienmsg = "";
 }
 
-void Parser::Parse (Connection *S)
+void Parser::Parse(Connection *S)
 {
-	if (!strcmp (aliencmd, "die") && !strcmp (alienid, "stealth@ru.raver"))
-		shut ("Requested shutdown");
-	else if (!strcmp (aliencmd, "hi"))
-		S->msgSend ("PRIVMSG " + (string)alienloc + " :" + "Hello, " + \
-			(string)alien + " (" + (string)alienid + ")");
-	else if (!strcmp (aliencmd, "nick"))
-		S->ircNick (alienmsg);
-	else if (!strcmp (aliencmd, "away"))
-		S->ircAway (alienmsg);
-	else if (!strcmp (aliencmd, "join"))
-		S->ircJoin (alienmsg, "");
-	else if (!strcmp (aliencmd, "part"))
-		S->ircPart (alienmsg);
-	else if (!strcmp (aliencmd, "cycle") && strcmp (alienloc, S->nick))
-		S->ircCycle (alienloc);
-	else if (!strcmp (alienact, "KICK") && !strcmp (alienmsg, S->nick))
-		S->ircJoin (alienloc, "");
 }