From eaf5d83e70feb3cb6b98c4643f184258702e9fc4 Mon Sep 17 00:00:00 2001 From: pdbogen Date: Wed, 29 Aug 2007 21:39:53 +0000 Subject: [PATCH] Add "PART" command as compliment to JOIN, along with corresponding support in the IRC module. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@8 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 11 +++++++++++ irc.pl | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/commands.yaml b/commands.yaml index e68d11b..1d88461 100644 --- a/commands.yaml +++ b/commands.yaml @@ -848,6 +848,17 @@ JOIN: |- } } +PART: |- + sub { + my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; + if( $what =~ /^[#&][^ ,]+$/ ) { + $kernel->post( "mod_irc", "do_part", $what ); + $kernel->post( $src, $replypath, "Okay.", $dest ); + } else { + $kernel->post( $src, $replypath, "'$what' is not a valid channel name.", $dest ); + } + } + IGNORE: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; diff --git a/irc.pl b/irc.pl index 87f598b..55f9ac0 100644 --- a/irc.pl +++ b/irc.pl @@ -53,6 +53,7 @@ sub new { send_public_to => \&send_public_to, do_abort => \&do_abort, do_join => \&do_join, + do_part => \&do_part, do_mode => \&do_mode, watchdog => \&watchdog, }, @@ -75,6 +76,15 @@ sub do_join { } } +sub do_part { + my( $kernel, $heap, $what ) = @_[ KERNEL, HEAP, ARG0 ]; + if( $what =~ /^[#&][^ ,]+$/ ) { + $kernel->post( $heap->{ 'ircobject' }->session_id(), "part", $what ); + } else { + warn( "'$what' is an invalid channel name" ); + } +} + sub do_abort { my( $kernel, $heap ) = @_[ KERNEL, HEAP ]; $heap->{ 'ircobject' }->{ 'send_queue' } = []; -- 2.11.0