Changeset 373


Ignore:
Timestamp:
05/18/11 23:11:46 (13 years ago)
Author:
grenoya
Message:
  • add search spec in replies
File:
1 edited

Legend:

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

    r370 r373  
    9696    } 
    9797    return join(', ', @loc); 
     98} 
     99 
     100sub _fmt_question : Private { 
     101    my ($self, $c, $searchspec) = @_; 
     102 
     103    my $loc; 
     104    $loc = sprintf( 
     105        '(%s, %s, %s)', 
     106        $searchspec->{dist} || $searchspec->{distribution} || "*", 
     107        $searchspec->{release} || "*", 
     108        $searchspec->{arch} || "*", 
     109    ); 
     110     
     111    return $loc; 
    98112} 
    99113 
     
    231245    if (!@{ $res }) { 
    232246        return $c->stash->{xmlrpc} = { 
    233             message => [ 'Nothing matches `' . $args[0] . '\'' ] 
     247            message => [ "Nothing matches `$args[0]' in " 
     248                    .$c->forward('_fmt_question', [$reqspec])], 
    234249        }; 
    235250    } else { 
    236         my @message = 'rpm name matching `' . $args[0] . '\':'; 
     251        my @message = "rpm name matching `$args[0]' in " 
     252                    .$c->forward('_fmt_question', [$reqspec])." :"; 
    237253        while (@{ $res }) { 
    238254            my $str = ''; 
     
    274290        if (@{ $res } > 100) { 
    275291            return $c->stash->{xmlrpc} = { 
    276                 message => [ 'I have ' . @{ $res } . ' results' ], 
     292                message => [ 'I have ' . @{ $res } . ' results in ' 
     293                    .$c->forward('_fmt_question', [$reqspec])], 
    277294            }; 
    278295        } else { 
     
    282299                push(@names, $info->{name}); 
    283300            } 
    284             my @message = 'rpm name matching `' . $args[0] . '\':'; 
     301            my @message = "rpm name matching `$args[0]' in " 
     302                    .$c->forward('_fmt_question', [$reqspec])." :"; 
    285303            while (@names) { 
    286304                my $str = ''; 
     
    298316    } else { 
    299317        return $c->stash->{xmlrpc} = { 
    300             message => [ 'No rpm description matches this keywords' ], 
     318            message => [ 'No rpm description matches this keywords in ' 
     319                    .$c->forward('_fmt_question', [$reqspec])], 
    301320        }; 
    302321    } 
     
    326345    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    327346        return $c->stash->{xmlrpc} = { 
    328             message => [ "I don't have such distribution" ] 
     347            message => [ "I don't have such distribution : "  
     348                    .$c->forward('_fmt_question', [$reqspec])], 
    329349        }; 
    330350    } 
     
    336356            return $c->stash->{xmlrpc} = { 
    337357                message => [  
    338                     "There is no rpm named `$args[0]', but the word matches in " . $else 
     358                    "There is no rpm named `$args[0]' in " 
     359                    .$c->forward('_fmt_question', [$reqspec]) 
     360                    .", but the word matches in " . $else 
    339361                ], 
    340362            } 
    341363        } else { 
    342364            return $c->stash->{xmlrpc} = { 
    343                 message => [ "The rpm named `$args[0]' has not been found" ], 
     365                message => [ "The rpm named `$args[0]' has not been found in " 
     366                    .$c->forward('_fmt_question', [$reqspec])], 
    344367            } 
    345368        } 
     
    702725    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    703726        return $c->stash->{xmlrpc} = { 
    704             message => [ "I don't have such distribution" ] 
     727            message => [ "I don't have such distribution : " 
     728                    .$c->forward('_fmt_question', [$reqspec])], 
    705729        }; 
    706730    } 
     
    712736            return $c->stash->{xmlrpc} = { 
    713737                message => [  
    714                     "There is no rpm named `$args[0]', but the word matches in " . $else 
     738                    "There is no rpm named `$args[0]' in " 
     739                    .$c->forward('_fmt_question', [$reqspec]) 
     740                    .", but the word matches in " . $else 
    715741                ], 
    716742            } 
    717743        } else { 
    718744            return $c->stash->{xmlrpc} = { 
    719                 message => [ "The rpm named `$args[0]' has not been found" ], 
     745                message => [ "The rpm named `$args[0]' has not been found in " 
     746                    .$c->forward('_fmt_question', [$reqspec])], 
    720747            } 
    721748        } 
     
    753780    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    754781        return $c->stash->{xmlrpc} = { 
    755             message => [ "I don't have such distribution" ] 
     782            message => [ "I don't have such distribution : " 
     783                    .$c->forward('_fmt_question', [$reqspec])], 
    756784        }; 
    757785    } 
     
    763791            return $c->stash->{xmlrpc} = { 
    764792                message => [  
    765                     "There is no rpm named `$args[0]', but the word matches in " . $else 
     793                    "There is no rpm named `$args[0]' in " 
     794                    .$c->forward('_fmt_question', [$reqspec]) 
     795                    .", but the word matches in " . $else 
    766796                ], 
    767797            } 
    768798        } else { 
    769799            return $c->stash->{xmlrpc} = { 
    770                 message => [ "The rpm named `$args[0]' has not been found" ], 
     800                message => [ "The rpm named `$args[0]' has not been found in " 
     801                    .$c->forward('_fmt_question', [$reqspec])], 
    771802            } 
    772803        } 
     
    800831    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    801832        return $c->stash->{xmlrpc} = { 
    802             message => [ "I don't have such distribution" ] 
     833            message => [ "I don't have such distribution in " 
     834                    .$c->forward('_fmt_question', [$reqspec])], 
    803835        }; 
    804836    } 
     
    809841            return $c->stash->{xmlrpc} = { 
    810842                message => [  
    811                     "There is no rpm named `$args[0]', but the word matches in " . $else 
     843                    "There is no rpm named `$args[0]' in " 
     844                    .$c->forward('_fmt_question', [$reqspec]) 
     845                    .", but the word matches in " . $else 
    812846                ], 
    813847            } 
    814848        } else { 
    815849            return $c->stash->{xmlrpc} = { 
    816                 message => [ "The rpm named `$args[0]' has not been found" ], 
     850                message => [ "The rpm named `$args[0]' has not been found in " 
     851                    .$c->forward('_fmt_question', [$reqspec])], 
    817852            } 
    818853        } 
     
    855890    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    856891        return $c->stash->{xmlrpc} = { 
    857             message => [ "I don't have such distribution" ] 
     892            message => [ "I don't have such distribution in " 
     893                    .$c->forward('_fmt_question', [$reqspec])], 
    858894        }; 
    859895    } 
     
    862898    if (!@{ $rpmlist }) { 
    863899        return $c->stash->{xmlrpc} = { 
    864             message => [ "Sorry, no file $args[0] found" ], 
     900            message => [ "Sorry, no file $args[0] found in " 
     901                    .$c->forward('_fmt_question', [$reqspec])], 
    865902        } 
    866903    } elsif (@{ $rpmlist } > 20) { 
     
    919956            message => [ 
    920957                "Package matching $depname" . ($evr ? " $sense $evr" : '') . 
    921                 ':',  
     958                " in " 
     959                .$c->forward('_fmt_question', [$reqspec]) 
     960                .':',  
    922961                join(' ', @name), 
    923962            ], 
     
    925964    } else { 
    926965        return $c->stash->{xmlrpc} = { 
    927             message => [ 'Too many results' ], 
     966            message => [ 'Too many results in '  
     967                    .$c->forward('_fmt_question', [$reqspec])], 
    928968        }; 
    929969    } 
     
    951991    if (!$c->forward('/distrib/exists', [ $reqspec ])) { 
    952992        return $c->stash->{xmlrpc} = { 
    953             message => [ "I don't have such distribution" ] 
     993            message => [ "I don't have such distribution : "  
     994                    .$c->forward('_fmt_question', [$reqspec])], 
    954995        }; 
    955996    } 
     
    9601001            return $c->stash->{xmlrpc} = { 
    9611002                message => [  
    962                     "There is no rpm named `$args[0]', but the word matches in " . $else 
     1003                    "There is no rpm named `$args[0]' in " 
     1004                    .$c->forward('_fmt_question', [$reqspec]) 
     1005                    .", but the word matches in " . $else 
    9631006                ], 
    9641007            } 
    9651008        } else { 
    9661009            return $c->stash->{xmlrpc} = { 
    967                 message => [ "The rpm named `$args[0]' has not been found" ], 
     1010                message => [ "The rpm named `$args[0]' has not been found in " 
     1011                    .$c->forward('_fmt_question', [$reqspec])], 
    9681012            } 
    9691013        } 
     
    9981042    if (!$c->forward('/distrib/exists', [ $dist ])) { 
    9991043        return $c->stash->{xmlrpc} = { 
    1000             message => [ "I don't have such distribution" ] 
     1044            message => [ "I don't have such distribution : " 
     1045                    .$c->forward('_fmt_question', [$reqspec])], 
    10011046        }; 
    10021047    } 
     
    10071052        return $c->stash->{xmlrpc} = { 
    10081053            message => [  
    1009                 scalar(@$maints) . " maintainers found matching `$args[0]'" 
    1010             ] 
     1054                scalar(@$maints) . " maintainers found matching `$args[0]' in " 
     1055                    .$c->forward('_fmt_question', [$reqspec])], 
    10111056        }; 
    10121057    } elsif (! @$maints) { 
    10131058        return $c->stash->{xmlrpc} = { 
    1014             message => [ "No maintainer found matching `$args[0]'" ] 
     1059            message => [ "No maintainer found matching `$args[0]' in "  
     1060                    .$c->forward('_fmt_question', [$reqspec])], 
    10151061        }; 
    10161062    } else { 
Note: See TracChangeset for help on using the changeset viewer.