home *** CD-ROM | disk | FTP | other *** search
- # -----------------------------------------------------------
- # HOTMAIL ROUTINES LIBRARY by A.I.Studio / Igor Afanasyev
- # -----------------------------------------------------------
-
- require 'http.lib'; # WatzNew http routines library
-
- # -----------------------------------------------------------
- sub CheckHotmailAccount {
- # -----------------------------------------------------------
- ($Login,$Password) = @_;
-
- $c = &HttpGet('www.hotmail.com',80,'/',always);
-
- die "ERR: No redirection location provided" if ($c ne 302);
-
- # ok, redirecting to some internal hotmail url
- ($HttpHeader =~ m/Location:[ ]*(.*?)\n/gi) && ($Location = $1); # we extract document location here
- die "ERR: Can't find the address to redirect\n" if ($Location eq '');
-
- $Location =~ s/\/login/\/start/;
- $ru = $Location;
- $Location =~ s/\/start/\/dologin/;
-
- $c = &HttpPost(&SplitUrl($Location),"login=$Login&passwd=$Password&sec=no&curmbox=ACTIVE&js=no&_lang=&beta=$ru&ishotmail=1\n");
-
- while (($c == 301) || ($c == 302) || ($c == 303)) {
- # ok, we logged in, redirecting to our page
- ($HttpHeader =~ m/Location:[ ]*(.*?)\n/gi) && ($Location = $1); # we extract document location here
- die "ERR: Can't find the address to redirect\n" if ($Location eq '');
- $c = &HttpGet(&SplitUrl($Location));
- }
-
- # no redirection information
- print "INF: Loading complete\n";
-
- if ($HttpBody =~ m/we cannot.*?process your request/si) {
- ($HttpBody =~ m/reason:.*?<b>(.*?)<\/b>/si) && ($Reason = $1);
- die "ERR: Can't process request. Reason: $Reason\n";
- }
-
- # getting first parameter ('X messages, Y new')
- ($HttpBody =~ m/<!-- FILE: title.asp-->.*?<font size="2">(.*?) /si);
- my $Amount = $1;
- $Amount =~ s/[\n ]$//g;
-
- print "MSG: $Amount\n";
-
- my $MsgText = '';
- my $count = 0;
- # collecting new message 'from' and 'subject' fields and appending them to $MsgText
- while ($HttpBody =~ m/alt="New".*?<td>.*?<td>.*?<a.*?>(.*?)<\/a>.*?<td>.*?<td> (.*?) /sgi) {
- $MsgText .= "<LI>$2 <I>(from $1)</I>";
- $count++;
- print "INF: Retrieving message [$count]\n";
- }
-
- print "MSG: $MsgText\n";
- } # end of sub
-
- # -----------------------------------------------------------
-
- 1; # return true