Author: muffin
Date: 2005-01-05 21:28:20 -0500 (Wed, 05 Jan 2005)
New Revision: 525
Modified:
trunk/clients/havirc/havirc.pl
Log:
TCP server now starts, and pretty much does nothing.
Modified: trunk/clients/havirc/havirc.pl
===================================================================
--- trunk/clients/havirc/havirc.pl 2005-01-06 01:56:12 UTC (rev 524)
+++ trunk/clients/havirc/havirc.pl 2005-01-06 02:28:20 UTC (rev 525)
@@ -20,6 +20,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+####### STARTUP #######
+
+warn("HavIRC daemon starting...");
+
+## Modules load
+
use warnings;
use diagnostics;
use strict;
@@ -29,4 +35,61 @@
use Haver::Config;
use Haver::Protocol::Filter;
-#Do something here. Anything, really.
+## Global vars
+my $user = {};
+
+
+## Initialize config file
+
+my $config_obj = Haver::Config->new(
+ file => "havirc.cfg",
+ default => {
+ Port => '6668',
+ ServerName => 'HavIRC',
+ RemoteServer => 'odin.haverdev.org',
+ RemotePort => '7070'
+ },
+);
+
+my $config = $config_obj->config;
+msg("start", "Config file loaded successfully.");
+
+## TCP server initialization
+
+POE::Component::Server::TCP->new (
+ Alias => "havirc",
+ Port => $config->{Port},
+ InlineStates => {
+ send => \&handle_send,
+ },
+ ClientConnected => \&server_connect,
+ ClientError => \&server_error,
+ ClientDisconnected => \&server_disconnect,
+ ClientInput => \&server_input,
+ );
+msg("start", "Server initialized on port $config->{Port}.");
+
+##Start
+$poe_kernel->run();
+exit 0;
+
+####### HANDLERS #######
+
+## Server handlers
+
+sub server_connect { }
+
+sub server_error { }
+
+sub server_disconnect { }
+
+sub server_input { }
+
+
+####### MISC #######
+
+## Utils
+sub msg {
+ my ($type, $message) = @_;
+ warn "[$type\t] $message\n";
+}