#!/usr/bin/perl use strict; #use warnings; use GMail::Checker; my $gmail_login = "bla"; my $gmail_pass = "titten"; my $gwrapper = new GMail::Checker(); # gmail-login $gwrapper->login($gmail_login,$gmail_pass); my ($gmail_mails, $gmail_size) = $gwrapper->get_msg_nb_size(); # Get total number and size # mailbox info my $gmail_total = $gwrapper->get_pretty_nb_messages(ALERT => "TOTAL_MSG"); print("$gmail_total\n"); # parse messages my @mails = (1 .. $gmail_mails); foreach (@mails) { my $host; if ($host eq '') { shift } else { print("--\n"); } my @msg; my @msg = $gwrapper->get_msg(MSG => $_); my @irc_server_string = $msg[0]->{body} =~ /Connects to \"(.+)\" on port (\d+) \(TCP\)./; my $host = $irc_server_string[0]; my $port = $irc_server_string[1]; if ($host eq '') { shift } else { print("Host: $host\n"); } if ($port eq '') { shift } else { print("Port: $port\n"); } my @irc_bot_nick = $msg[0]->{body} =~ /IRC: Uses nickname (.+)./; chop(my $botnick = $irc_bot_nick[0]); if ($botnick eq '') { shift } else { print("Botnick: $botnick\n"); } my @irc_bot_username = $msg[0]->{body} =~ /IRC: Uses username (.+)./; chop(my $botusername = $irc_bot_username[0]); if ($botusername eq '') { shift } else { print("Botusername: $botusername\n"); } my @irc_bot_usermode = $msg[0]->{body} =~ /IRC: Sets the usermode for user .+ to (.+)./; chop(my $botusermode = $irc_bot_usermode[0]); # =~ s/./\+/g; if (($botusermode eq '') or ($botusermode eq 'is')) { shift } else { print("Mode On Connect: $botusermode\n"); } my @irc_channel_string = $msg[0]->{body} =~ /IRC: Joins channel (.+) with password (.+)./; chop(my $ircchannel = $irc_channel_string[0]); chop(my $ircpass = $irc_channel_string[1]); if ($ircchannel eq '') { shift } else { print("IRC-Channel: $ircchannel\n"); } if (($ircpass eq '') or ($ircpass eq ' ')) { shift; } else { print("Channel-Pass: $ircpass\n"); } my @irc_channel_modes = $msg[0]->{body} =~ /IRC: Sets the channel mode for channel .+ to (.+)./; chop(my $ircchannelmode = $irc_channel_modes[0]); if ($ircchannelmode eq '') { shift } else { print("Channel-Mode: $ircchannelmode\n"); } if ($host eq '') { shift } else { print("--\n");} if ($_ > 2) { $gwrapper->get_msg(DELETE => '$_--'); } }