App-FonBot-Daemon

 view release on metacpan or  search on metacpan

lib/App/FonBot/Plugin/Email.pm  view on Meta::CPAN

		my $replyto=$email->header('From');
		return unless defined $replyto;

		my ($user,$password)=split ' ', $email->header('Subject'), 2;
		chomp $password;

		$log->debug("Processing email from $user");

		eval { pwcheck $user, $password };
		if ($@) {
			$log->debug("Incorrect credentials in email subject from user $user. Exception: $@");
			POE::Kernel->yield(send_message => $replyto, "Incorrect credentials");
			return
		}

		$ok_user_addresses{"$user EMAIL $replyto"}=1;

		my $process_email_part = sub {
			local *__ANON__ = "process_email_part";	#Name this sub. See http://www.perlmonks.org/?node_id=304883

			my $part=$_[0];
			return unless $part->content_type =~ /text\/plain/;

lib/App/FonBot/Plugin/IRC.pm  view on Meta::CPAN

			$self->{log}->debug("Login for $user succeded");
			$self->{nick_to_username}{$from} = $user;
			$self->{irc}->yield(privmsg => $nick, "Logged in as $user");
		}
	} 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.');
		}
	} elsif (/^noprefix$/i){
		if (defined $username) {
			delete $self->{prefix}{$username}
		} 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.');
		}
	} else {
		if (defined $username) {
			$ok_user_addresses{"$username $address"}=1;
			$self->{log}->debug("Command $cmd @args from $username");
			if (exists $self->{prefix}{$username}) {
				sendmsg $username, undef, $address, @{$self->{prefix}{$username}}, $cmd, @args;
			} else {
				sendmsg $username, undef, $address, $cmd, @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.');
		}
	}
}

sub irc_public{
	# Do nothing
}

sub irc_001{
	# Do nothing



( run in 0.266 second using v1.01-cache-2.11-cpan-a5abf4f5562 )