Ignore:
Timestamp:
12/18/10 18:04:03 (13 years ago)
Author:
nanardon
Message:
  • add commands to Chat
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Chat/Cmd.pm

    r115 r136  
    260260} 
    261261 
     262=head2 group [-s] NAME 
     263 
     264Show the group of package C<NAME>. 
     265 
     266=cut  
     267 
     268sub group : XMLRPC { 
     269    my ($self, $c, $reqspec, @args) = @_; 
     270 
     271    my @message; 
     272    $reqspec->{src} = 0; 
     273 
     274    @args = @{ $c->forward('_getopt', [ 
     275        { 
     276            'd=s' => \$reqspec->{distribution}, 
     277            'v=s' => \$reqspec->{release}, 
     278            'a=s' => \$reqspec->{arch}, 
     279            's'   => sub { $reqspec->{src} = 1 }, 
     280        }, @args ]) }; 
     281 
     282    my $rpmlist = $c->forward('/search/byname', [ $reqspec, $args[0] ]); 
     283    foreach (@{ $rpmlist->{results} }) { 
     284        my $info = $c->forward('/rpms/queryformat', [ $_, '%{group}' ]); 
     285        push @message, $info . ' // ' . 
     286            $c->forward('_fmt_location', [ $_ ]); 
     287    } 
     288    return $c->stash->{xmlrpc} = { 
     289        message => \@message, 
     290    } 
     291} 
     292 
     293=head2 g 
     294 
     295Is an alias to C<group> command. 
     296 
     297=cut  
     298 
     299sub g : XMLRPC { 
     300    my ($self, $c, @args) = @_; 
     301    $c->forward('group', [ @args ]); 
     302} 
     303 
     304=head2 license [-s] NAME 
     305 
     306Show the license of package C<NAME>. 
     307 
     308=cut  
     309 
     310sub group : XMLRPC { 
     311    my ($self, $c, $reqspec, @args) = @_; 
     312 
     313    my @message; 
     314    $reqspec->{src} = 0; 
     315 
     316    @args = @{ $c->forward('_getopt', [ 
     317        { 
     318            'd=s' => \$reqspec->{distribution}, 
     319            'v=s' => \$reqspec->{release}, 
     320            'a=s' => \$reqspec->{arch}, 
     321            's'   => sub { $reqspec->{src} = 1 }, 
     322        }, @args ]) }; 
     323 
     324    my $rpmlist = $c->forward('/search/byname', [ $reqspec, $args[0] ]); 
     325    foreach (@{ $rpmlist->{results} }) { 
     326        my $info = $c->forward('/rpms/queryformat', [ $_, '%{license}' ]); 
     327        push @message, $info . ' // ' . 
     328            $c->forward('_fmt_location', [ $_ ]); 
     329    } 
     330    return $c->stash->{xmlrpc} = { 
     331        message => \@message, 
     332    } 
     333} 
     334 
     335=head2 l 
     336 
     337Is an alias to C<license> command. 
     338 
     339=cut  
     340 
     341sub l : XMLRPC { 
     342    my ($self, $c, @args) = @_; 
     343    $c->forward('license', [ @args ]); 
     344} 
     345 
    262346=head2 buildtime [-s] NAME 
    263347 
Note: See TracChangeset for help on using the changeset viewer.