Thread Versuche eine mail zu löschen...: GMail::Checker (4 answers)
Opened by FlorianL at 2007-07-24 23:08

FlorianL
 2007-07-24 23:08
#37611 #37611
User since
2007-05-18
142 Artikel
BenutzerIn
[default_avatar]
Hi, ich hole mir alle mails vom gmail konto ab, parse ein paar sachen raus und möchte die mail dann anschliessen löschen, bis aufs löschen klappts auch...

hier der code:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/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 => '$_--'); }
}


output:

mindfuck@mindfucked:~/scripts/judas$ ./judas.pl
You have 2075 messages in your inbox (size 9.50 Mbytes)

Can't use string ("9959216") as an ARRAY ref while "strict refs" in use at /usr/local/share/perl/5.8.8/GMail/Checker.pm line 271.
mindfuck@mindfucked:~/scripts/judas$

hat jemand ne idee dazu? :)

View full thread Versuche eine mail zu löschen...: GMail::Checker