Author: muffin
Date: 2005-01-06 21:22:52 -0500 (Thu, 06 Jan 2005)
New Revision: 531

Removed:
   trunk/clients/havirc/havirc.pl
Log:
Removed the havIRC script for now.  Will return later when I have something 
worth using.


Deleted: trunk/clients/havirc/havirc.pl
===================================================================
--- trunk/clients/havirc/havirc.pl      2005-01-07 02:07:32 UTC (rev 530)
+++ trunk/clients/havirc/havirc.pl      2005-01-07 02:22:52 UTC (rev 531)
@@ -1,189 +0,0 @@
-#!/usr/bin/perl
-#
-# vim: set ft=perl ts=4 sw=4
-#
-# HavIRC - A basic IRC to Haver protocol gateway, thus defeating the whole 
point of Haver's pretty protocol.
-#
-# Copyright (C) 2005 ElasticMuffin (aka "The Muffin Man", or "Mmm, tasty.").
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# 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;
-
-use POE qw(Component::Server::TCP Component::Client::TCP);
-
-use Haver::Config;
-use Haver::Protocol::Filter;
-
-use Data::Dumper;
-
-## 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;
-
-#Shorten the server name to a variable for convenience.
-my $sname = $config->{ServerName};
-
-msg("start", "Config file loaded successfully.");
-
-## TCP server initialization
-
-POE::Component::Server::TCP->new(
-       Port => $config->{Port},
-       InlineStates => {
-               send_client => sub {
-                       my ( $heap, $message ) = @_[ HEAP, ARG0 ];
-                       $heap->{client}->put($message);
-               },
-               _child => sub {
-                       my ( $heap, $child_op, $child ) = @_[ HEAP, ARG0, ARG1 
];
-                       if ( $child_op eq "create" ) {
-                               $heap->{client_id} = $child->ID;
-                       }
-               },
-       },
-       ClientConnected         => \&client_connect,
-       ClientError             => \&client_error,
-       ClientDisconnected      => \&client_disconnect,
-       ClientInput             => \&client_input,
-);
-
-msg("start", "Server started on port $config->{Port}.");
-
-##Start
-$poe_kernel->run();
-exit 0;
-
-####### SERVERSIDE HANDLERS #######
-
-## Server handlers
-
-sub client_connect {
-       my ($heap, $session) = @_[HEAP, SESSION];
-       my ($session_id, $r_ip, $r_port) = ($session->ID, $heap->{remote_ip}, 
$heap->{remote_port});
-       msg("client", "Incoming connection from $r_ip\:$r_port.");
-
-       #Set some info about the user.
-       $User{$session_id}{loggedin} = 0;
-       $User{$session_id}{ip} = $r_ip;
-       create_haver_client();
-}
-
-sub client_error {
-       my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];
-       my $session_id = $session->ID;
-       msg("client", "Socket error to client $User{$session_id}{ip}.");
-       
-       $kernel->post($heap->{client_id} => "shutdown");
-       delete $User{$session_id};
-       $kernel->post($session_id, "shutdown");
-}
-
-sub client_disconnect {
-       my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];
-       my $session_id = $session->ID;
-       msg("client", "Session $session_id closed.");
-       
-       if (defined $User{$session_id}) {
-               $kernel->post($heap->{client_id} => "shutdown");
-               delete $User{$session_id};
-       }
-}
-
-sub client_input { 
-       my ($kernel, $heap, $session, $input) = @_[KERNEL, HEAP, SESSION, ARG0];
-       my $session_id = $session->ID;
-       $input = split(/\s+/, $input);
-}
-
-####### HAVER CLIENT INIT & HANDLERS #######
-
-## Haver client creation
-
-sub create_haver_client() {
-       POE::Component::Client::TCP->new(
-               RemoteAddress   => $config->{RemoteServer},
-               RemotePort      => $config->{RemotePort},
-               Filter          => "Haver::Protocol::Filter",
-
-               Started => sub {
-                       $_[HEAP]->{server_id} = $_[SENDER]->ID;
-                       $poe_kernel->post( $_[HEAP]->{server_id} => send_client 
=> ":$sname NOTICE AUTH :Welcome to the HavIRC gateway.");
-                       $poe_kernel->post( $_[HEAP]->{server_id} => send_client 
=> ":$sname NOTICE AUTH :Connecting to server...")
-               },
-
-               Connected       => \&haver_connected,
-               ConnectError    => \&haver_cfail,
-               ServerInput     => \&haver_input, 
-               Disconnected    => \&haver_discon,
-       );
-}
-
-sub haver_connected {
-       my ($kernel, $heap) = @_[KERNEL, HEAP];
-       $kernel->post($heap->{server_id} => send_client => ":$sname NOTICE AUTH 
Connected.  Logging in...");
-       $heap->{server}->put(['HAVER', 'HavIRC/0.01']);
-}
-
-sub haver_cfail {
-       my ($kernel, $heap) = @_[KERNEL, HEAP];
-       $kernel->post( $heap->{server_id} => send_client => ":$sname NOTICE 
ERROR :The connection to the Haver server has failed.  Please try again later." 
);
-       $kernel->post( $heap->{server_id} => send_client => "ERROR :Haver 
connection failed." );
-       $kernel->post( $heap->{server_id} => "shutdown" );
-}
-
-sub haver_input {
-       my ($kernel, $heap, $input) = @_[KERNEL, HEAP, ARG0];
-       print Dumper \$input;
-}
-
-sub haver_discon {
-       my ($kernel, $heap) = @_[KERNEL, HEAP];
-       $kernel->post( $heap->{server_id} => send_client => ":$sname NOTICE 
ERROR :The connection to the Haver server has been closed." );
-       $kernel->post( $heap->{server_id} => send_client => "ERROR :Haver 
connection lost." );
-       $kernel->post( $heap->{server_id} => "shutdown" );
-}
-
-
-
-
-####### MISC #######
-
-## Utils
-sub msg {
-       my ($type, $message) = @_;
-       warn "[$type\t] $message\n";
-}        


Reply via email to