From: pdbogen Date: Tue, 29 Jan 2008 17:27:47 +0000 (+0000) Subject: Add support for channel keys to JOIN X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=a8cd41a0ca90a40a16d4bab0a3f5d3f0c948171b;p=destult.git Add support for channel keys to JOIN git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@36 088b83a4-0077-4247-935c-42ec02c2848b --- diff --git a/commands.yaml b/commands.yaml index 0793e41..b189e8c 100644 --- a/commands.yaml +++ b/commands.yaml @@ -921,11 +921,12 @@ RSS: |- JOIN: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; - if( $what =~ /^[#&][^ ,]+$/ ) { - $kernel->post( $src, "do_join", $what ); + my( $chan, $key ) = split( / /, $what, 2 ); + if( $chan =~ /^[#&][^ ,]+$/ ) { + $kernel->post( $src, "do_join", $chan, $key ); $kernel->post( $src, $replypath, "Okay.", $dest ); } else { - $kernel->post( $src, $replypath, "'$what' is not a valid channel name.", $dest ); + $kernel->post( $src, $replypath, "'$chan' is not a valid channel name.", $dest ); } } diff --git a/irc.pl b/irc.pl index 3f00206..7a92c50 100644 --- a/irc.pl +++ b/irc.pl @@ -71,10 +71,10 @@ sub new { } sub do_join { - my( $kernel, $heap, $what ) = @_[ KERNEL, HEAP, ARG0 ]; + my( $kernel, $heap, $what, $key ) = @_[ KERNEL, HEAP, ARG0 ]; if( $what =~ /^[#&][^ ,]+$/ ) { print( "IRC : Joining '$what'\n" ); - $kernel->post( $heap->{ 'ircobject' }->session_id(), "join", $what ); + $kernel->post( $heap->{ 'ircobject' }->session_id(), "join", $what, $key ); } else { warn( "'$what' is an invalid channel name" ); }