2 #Kyberia client... (Harvie 2oo9)
15 sub new
{ #constructor
16 my ($self, $kurl) = @_;
18 $browser = LWP
::UserAgent
->new( );
19 $browser->cookie_jar( {} );
24 my ($self, $user, $pass) = @_;
25 my $response = $browser->post( $url,
29 'login_type' => 'name',
32 return $response->is_success;
36 my $response = $browser->post( $url,
40 return $response->is_success;
44 my ($self, $user, $message) = @_;
45 my $response = $browser->post( $url,
48 'mail_to_type' => 'name',
49 'mail_text' => $message,
52 return $response->is_success;
57 my $response = $browser->get("$url/id/$id/");
58 return $response->content;
62 my $response = $browser->get("$url/id/2176597/");
63 my @mails = split(/\n/, $response->content); $response = '';
64 shift(@mails); #remove CSV header
66 my ($MSG_ID, $FROM, $FROM_ID, $TO, $TO_ID, $TIME, $NEW, $TEXT) = split(/;/, $_, 8); #parse CSV
67 $TEXT =~ s/\\n/\n/g; decode_entities
($TEXT); #unescape message
68 print("#$MSG_ID $FROM --> $TO ($TIME)\n\n$TEXT\n---------------------------------\n");
70 return $response->is_success;
74 my $response = $browser->get("$url/ajax/check_new_mail.php");
75 my @mails = split(/;/, $response->content);
76 return ($mails[0], $mails[1], "You have $mails[0] unread mails, last from $mails[1].");
This page took 0.695085 seconds and 4 git commands to generate.