Add support for channel keys to JOIN
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 29 Jan 2008 17:27:47 +0000 (17:27 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 29 Jan 2008 17:27:47 +0000 (17:27 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@36 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml
irc.pl

index 0793e41..b189e8c 100644 (file)
@@ -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 (file)
--- 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" );
        }