Skip to content

Commit

Permalink
Merge pull request #3 from shibayu36/master
Browse files Browse the repository at this point in the history
channelへの入る時のpassword追加
  • Loading branch information
yappo committed Dec 29, 2011
2 parents 688dfb1 + e2d9624 commit 7eeab05
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bin/ikachan
Expand Up @@ -60,8 +60,8 @@ sub rendar {

my $channels = {};
sub join_channel {
my $channel = shift;
$irc->join_channel($channel);
my ($channel, $key) = @_;
$irc->join_channel($channel, $key);
$channels->{$channel} = {
join_at => time(),
};
Expand Down Expand Up @@ -98,11 +98,12 @@ my $code = sub {
<table border="1">
<tr><td>method</td><td>POST</td></tr>
<tr><td>url</td><td>${base}join</td></tr>
<tr><td>form params</td><td>channel=#channel</td></tr>
<tr><td>form params</td><td>channel=#channel&channel_keyword=keyword</td></tr>
</table>
<h4>testing form</h4>
<form action="/join" method="post">
join channel: <input name="channel" /><input type="submit" value="join" />
join channel: <input name="channel" /><br />
channel keyword(option): <input name="channel_keyword" /><input type="submit" value="join" />
</form>
<section>
Expand Down Expand Up @@ -158,7 +159,8 @@ HTML

if ($path eq '/join') {
return rendar(403, "joinned channel: $channel") if $channels->{$channel};
join_channel($channel);
my $channel_keyword = $req->param('channel_keyword');
join_channel($channel, $channel_keyword);
return rendar(200, "join success channel: $channel");
} elsif ($path eq '/leave' || $path eq '/part') {
return rendar(404, "not joinned channel: $channel") unless $channels->{$channel};
Expand Down

0 comments on commit 7eeab05

Please sign in to comment.