Ignore:
Timestamp:
11/04/11 23:31:47 (13 years ago)
Author:
grenoya
Message:
  • add test in set function to be sure that the user spell correctly the variable to set
File:
1 edited

Legend:

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

    r389 r392  
    196196sub set : XMLRPC { 
    197197    my ( $self, $c, $reqspec, $var, $val ) = @_; 
    198  
     198     
     199    # if there is no variable to fix, Sophie ask and stop 
    199200    if (!$var) { 
    200201        return $c->stash->{xmlrpc} = { 
     
    206207    }  
    207208     
     209    # if the variable is not 'distribution', 'release' or 'arch', Sophie 
     210    # complains and stop 
     211    if ($var != "distribution" || $var != "release" || $var != "arch") { 
     212        return $c->stash->{xmlrpc} = { 
     213            private_reply => 1, 
     214            message => [ 
     215                "'$var' is not valid ! possible parameters are : 'distribution', 
     216                'release' and 'arch'." 
     217            ] 
     218        } 
     219    } 
     220 
     221    # if there is no value to give to the variable, Sophie ask and stop 
    208222    if (!$val) { 
    209223        return $c->stash->{xmlrpc} = { 
     
    239253    my ( $self, $c, $reqspec, $var ) = @_; 
    240254 
    241  
     255    # if there is no variable to fix, Sophie ask and stop 
    242256    if (!$var) { 
    243257        return $c->stash->{xmlrpc} = { 
     
    249263    }  
    250264     
     265    # if the variable is not 'distribution', 'release' or 'arch', Sophie 
     266    # complains and stop 
     267    if ($var != "distribution" || $var != "release" || $var != "arch") { 
     268        return $c->stash->{xmlrpc} = { 
     269            private_reply => 1, 
     270            message => [ 
     271                "'$var' is not valid ! possible parameters are : 'distribution', 
     272                'release' and 'arch'." 
     273            ] 
     274        } 
     275    } 
     276 
    251277    $c->forward('/user/update_data', [ $reqspec->{from}, { $var => undef } ]); 
    252278     
Note: See TracChangeset for help on using the changeset viewer.