GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
POE::Component::IRC::Plugin::Blowfish(3) User Contributed Perl Documentation POE::Component::IRC::Plugin::Blowfish(3)

POE::Component::IRC::Plugin::Blowfish - A POE::Component::IRC plugin that provides blowfish encryption.

    #!/usr/bin/perl
    use strict;
    use warnings;
    use POE qw(Component::IRC Component::IRC::Plugin::Blowfish);

    my $nickname  = 'BlowFish' . $$;
    my $ircname   = 'Blowing fish';
    my $ircserver = 'irc.perl.org';
    my $port      = 6667;
    my $channel   = '#POE-Component-IRC-Plugin-Blowfish';
    my $bfkey     = 'secret';

    my $irc = POE::Component::IRC->spawn(
        nick         => $nickname,
        server       => $ircserver,
        port         => $port,
        ircname      => $ircname,
        debug        => 0,
        plugin_debug => 1,
        options      => { trace => 0 },
    ) or die "Oh noooo! $!";

    POE::Session->create(
        package_states => [ 'main' => [qw(_start irc_public irc_001 irc_join)], ],
    );

    $poe_kernel->run();
    exit 0;

    sub _start {

        # Create and load our plugin
        $irc->plugin_add( 'BlowFish' =>
              POE::Component::IRC::Plugin::Blowfish->new( $channel => $bfkey ) );

        $irc->yield( register => 'all' );
        $irc->yield( connect  => {} );
        undef;
    }

    sub irc_001 {
        $irc->yield( join => $channel );
        undef;
    }

    sub irc_join {
        my ( $kernel, $sender, $channel ) = @_[ KERNEL, SENDER, ARG1 ];
        $kernel->post(
            $irc => privmsg => $channel => 'hello this is an encrypted message' );
        undef;
    }

    sub irc_public {
        my ( $kernel, $sender, $who, $where, $msg ) =
          @_[ KERNEL, SENDER, ARG0, ARG1, ARG2 ];
        my $nick = ( split /!/, $who )[0];
        my $chan = $where->[0];

        my @args = split /\s+/, $msg;
        my $cmd = shift @args;

        if ( $cmd eq '!setkey' ) {
            $kernel->yield( set_blowfish_key => (@args)[ 0, 1 ] );
        }

        elsif ( $cmd eq '!delkey' ) {
            $kernel->yield( del_blowfish_key => $args[0] );
        }

        elsif ( $cmd eq '!test' ) {
            $kernel->post(
                $irc => privmsg => $chan => 'this is a test message...' );
        }
    }

POE::Component::IRC::Plugin::Blowfish, is a POE::Component::IRC plugin that provides a mechanism for encrypting and decrypting IRC messages using Crypt::Blowfish_PP. If there is a blowfish key set for a IRC channel this plugin will always encrypt and decrypt IRC messages of that channel. After the plugin has registered it will push itself to the first position in the plugin pipeline. This is necessary that all other plugins will get the decrypted IRC messages.

This plugin is compatible to blowfish irssi plugin: <http://fish.sekure.us/irssi/>

new
Creates a new plugin object. Takes a hash to set blowfish keys for channels:

    '#perl' => 'secret',
    '#poe' => 'foo',
    

It's possible to change this later using "INPUT EVENTS".

The plugin registers the following state handler within your session:

Parameters: $channel $blowfish_key

Set blowfish key for a channel. If there was a key set already it will be overwritten.

Remove blowfish key from a channel.

Parameters: $channel

Johannes 'plu' Plunien <plu@cpan.org <mailto:plu@cpan.org>>

POE::Component::IRC

Crypt::Blowfish_PP

2007-09-01 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.