Changeset 386


Ignore:
Timestamp:
10/02/11 11:18:25 (13 years ago)
Author:
grenoya
Message:
  • return error message when :set and :unset are not used correcly
File:
1 edited

Legend:

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

    r382 r386  
    181181    my ( $self, $c, $reqspec, $var, $val ) = @_; 
    182182 
     183    if (!$var) { 
     184        return $c->stash->{xmlrpc} = { 
     185            private_reply => 1, 
     186            message => [ 
     187                "What must I set ?" 
     188            ] 
     189        } 
     190    }  
     191     
     192    if (!$val) { 
     193        return $c->stash->{xmlrpc} = { 
     194            private_reply => 1, 
     195            message => [ 
     196                "To what must I set $var ?" 
     197            ] 
     198        } 
     199    }  
     200     
    183201    $c->forward('/user/update_data', [ $reqspec->{from}, { $var => $val } ]); 
    184      
     202 
    185203    return $c->stash->{xmlrpc} = { 
    186204        private_reply => 1, 
     
    205223    my ( $self, $c, $reqspec, $var ) = @_; 
    206224 
     225 
     226    if (!$var) { 
     227        return $c->stash->{xmlrpc} = { 
     228            private_reply => 1, 
     229            message => [ 
     230                "What must I unset ?" 
     231            ] 
     232        } 
     233    }  
     234     
    207235    $c->forward('/user/update_data', [ $reqspec->{from}, { $var => undef } ]); 
    208236     
Note: See TracChangeset for help on using the changeset viewer.