Skip to content

Commit

Permalink
ソースを整形しつつ色々と
Browse files Browse the repository at this point in the history
  • Loading branch information
Kan Fushihara committed Jun 23, 2011
1 parent dbe73b2 commit 62ab682
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion META.yml
Expand Up @@ -8,7 +8,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 1.00'
generated_by: 'Module::Install version 0.91'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
Expand Down
2 changes: 0 additions & 2 deletions TODO
@@ -1,5 +1,3 @@
/channel/ 対応チャンネル一覧(type=jsonでjson出力)

- この辺で公開&リリース?
- 応答plugin機構
-- URL title view
Expand Down
1 change: 1 addition & 0 deletions lib/Donburi.pm
Expand Up @@ -25,6 +25,7 @@ Donburi is
=head1 AUTHOR
Kan Fushihara E<lt>kan dot fushihara at gmail dot comE<gt>
Nishibayashi Takuji E<lt>takuji {at} senchan.jpE<gt>
=head1 SEE ALSO
Expand Down
19 changes: 16 additions & 3 deletions lib/Donburi/Web/C/JSONRPC.pm
Expand Up @@ -16,9 +16,18 @@ sub do_call {

my $text = $params->{text};
my $channel = $params->{channel};
unless ( $method eq 'channels' || defined $text && defined $channel && grep /^$method$/,qw( privmsg notice ) ) {
unless (
$method eq 'channels'
|| defined $text && defined $channel && grep /^$method$/,
qw( privmsg notice )
)
{
#TODO Handle error?
return [ 500, ['Content-Type' => 'application/json'], [JSON->new->utf8->encode({message => 'internal server error', code => 000})] ];
return [
500,
[ 'Content-Type' => 'application/json' ],
[ JSON->new->utf8->encode({ message => 'internal server error', code => 000 }) ]
];
}

my $body;
Expand All @@ -33,7 +42,11 @@ sub do_call {
$body = 'ok';
}

return [ 200, ['Content-Type' => 'application/json'], [JSON->new->utf8->encode({json_rpc=> "2.0", result => $body})] ];
return [
200,
[ 'Content-Type' => 'application/json' ],
[ JSON->new->utf8->encode( { json_rpc => "2.0", result => $body } ) ]
];
}

1;

0 comments on commit 62ab682

Please sign in to comment.