From: timriker Date: Thu, 22 Jul 2004 21:23:33 +0000 (+0000) Subject: join channel with key X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8a8aaa3dc4bb040a94e5b96a19c38c58993d0de7;p=infobot.git join channel with key git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1012 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/IRC/Irc.pl b/blootbot/src/IRC/Irc.pl index d359f30..e07ab26 100644 --- a/blootbot/src/IRC/Irc.pl +++ b/blootbot/src/IRC/Irc.pl @@ -170,6 +170,11 @@ sub irc { $ircstats{'Server'} = "$server:$port"; + #&DEBUG("foo" . ); + #open(FH, "<:utf8", "input"); + #$irc->addfh(, \&on_stdin, "r"); + #close(STDIN); + $irc->start; } @@ -445,8 +450,9 @@ sub dcc_close { } sub joinchan { - my ($chan) = @_; - my $key = &getChanConf("chankey", $chan) || ""; + my ($chan, $key) = @_; + $key ||= &getChanConf("chankey", $chan); + $key ||= ""; # forgot for about 2 years to implement channel keys when moving # over to Net::IRC... @@ -456,7 +462,7 @@ sub joinchan { &status("join: already on $chan?"); } #} else { - &status("joining $b_blue$chan$ob"); + &status("joining $b_blue$chan $key$ob"); return if ($conn->join($chan, $key)); return if (&validChan($chan)); diff --git a/blootbot/src/Process.pl b/blootbot/src/Process.pl index c1b277e..b2f5d61 100644 --- a/blootbot/src/Process.pl +++ b/blootbot/src/Process.pl @@ -65,36 +65,34 @@ sub process { if ($message =~ /^join(\s+(.*))?\s*$/i) { return 'join: not addr' unless ($addressed); - $2 =~ /^($mask{chan})(,(\S+))?/; - my($thischan, $key) = (lc $1, $3); - my $chankey = lc $thischan; - $chankey .= " $key" if (defined $key); + $2 =~ /^($mask{chan})(\s+(\S+))?/; + my($joinchan, $key) = (lc $1, $3); - if ($thischan eq "") { + if ($joinchan eq "") { &help("join"); return; } - if ($thischan !~ /^$mask{chan}$/) { - &msg($who, "$thischan is not a valid channel name."); + if ($joinchan !~ /^$mask{chan}$/) { + &msg($who, "$joinchan is not a valid channel name."); return; } if (&IsFlag("o") ne "o") { - if (!exists $chanconf{$thischan}) { - &msg($who, "I am not allowed to join $thischan."); + if (!exists $chanconf{$joinchan}) { + &msg($who, "I am not allowed to join $joinchan."); return; } - if (&validChan($thischan)) { - &msg($who,"warn: I'm already on $thischan, joining anyway..."); + if (&validChan($joinchan)) { + &msg($who,"warn: I'm already on $joinchan, joining anyway..."); } } - $cache{join}{$thischan} = $who; # used for on_join self. + $cache{join}{$joinchan} = $who; # used for on_join self. - &joinchan($chankey); - &status("JOIN $chankey <$who>"); - &msg($who, "joining $chankey"); + &status("JOIN $joinchan $key <$who>"); + &msg($who, "joining $joinchan $key"); + &joinchan($joinchan, $key); &joinNextChan(); # hack. return;