-
- when(/^login$/i) {
- my ($user, $pass) = @args;
-
- eval { pwcheck $user, $pass };
-
- if ($@) {
- $self->{log}->debug("Login for $user failed");
- $self->{irc}->yield(privmsg => $nick, 'Bad username/password combination');
- } else {
- $self->{log}->debug("Login for $user succeded");
- $self->{nick_to_username}{$from} = $user;
- $self->{irc}->yield(privmsg => $nick, "Logged in as $user");
- }
- }
-
- when(/^logout$/i){
- delete $self->{nick_to_username}{$from};
- }
-
- when(/^prefix$/i){
- if (defined $username) {
- $self->{prefix}{$username} = [@args];
- } else {
- $self->{irc}->yield(privmsg => $nick, 'You are not logged in. Say "login your_username your_password" (where your_username and your_password are your login credentials) to login.');
- }
+ } elsif (/^logout$/i){
+ delete $self->{nick_to_username}{$from};
+ } elsif (/^prefix$/i){
+ if (defined $username) {
+ $self->{prefix}{$username} = [@args];
+ } else {
+ $self->{irc}->yield(privmsg => $nick, 'You are not logged in. Say "login your_username your_password" (where your_username and your_password are your login credentials) to login.');