home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / chip-cd_2000_02.zip / 02 / software / shareware / watznew / netaddr.lib < prev    next >
Text File  |  1999-10-01  |  2KB  |  61 lines

  1. # -----------------------------------------------------------
  2. # NET@DDRESS ROUTINES LIBRARY by A.I.Studio / Igor Afanasyev
  3. # -----------------------------------------------------------
  4.  
  5. require 'http.lib'; # WatzNew http routines library
  6.  
  7. # -----------------------------------------------------------
  8. sub CheckNetAddressAccount {
  9. # -----------------------------------------------------------
  10.   ($Login,$Password) = @_;
  11.  
  12.   $c = &HttpPost('www.netaddress.com',80,'/tpl/Door/LoginPost',"LoginState=2&SuccessfulLogin=/tpl&NewServerName=www.netaddress.com&JavaScript=None&DomainID=4&NA31site=classic.netaddress.com&NA31port=80&UserID=$Login&passwd=$Password&Expire_Cache=&Use_Cookie=\n");
  13.  
  14.   $Location = 1;
  15.  
  16.   while (($c == 200) && $Location) {
  17.     $Location = undef;
  18.     ($HttpBody =~ m/<META HTTP-EQUIV="Refresh" CONTENT="0;URL=(.*?)">/sgi) && ($Location = $1);
  19.  
  20.     ($Location =~ m/Terminated\?Reason=(.*)/sgi) && (die "ERR: Login Terminated ($1)\n");
  21.  
  22.     #$Location =~ s/\/Welcome/\/Home/i;
  23.     $Location =~ s/\/tpl\/Door/\/tpl\/Mail/i;
  24.     $Location =~ s/\/Welcome/\/List?FolderId=-4/i;
  25.  
  26.     #print "Location: $Location\n";
  27.     #die "ERR: No redirection location provided" if ($Location eq undef);
  28.  
  29.     ($Location ne '') && ($c = &HttpGet(&SplitUrl($Location)));
  30.   }
  31.  
  32.   ($c ne 200) && (die "ERR: HTTP Error: $c\n");
  33.  
  34.   ($HttpBody =~ m/Inbox\((\d*)( unread, )*(\d+)( total)*\)/si);
  35.   my $all = $3;
  36.   my $new = $1;
  37.   ($all == 0) && ($all = 0);
  38.   ($new == 0) && ($new = 0);
  39.   print "MSG: $all message(s), $new new\n";
  40.  
  41.   my $MsgText = '';
  42.   ($new == 0) && exit;
  43.  
  44.   while ($HttpBody =~ m/MR\[i\] = new Object;.*?MR\[i\].R='(.*?)'.*?MR\[i\].A='(.*?)'.*?MR\[i\].T='(.*?)'.*?MR\[i\].S='(.*?)'/sgi) {
  45.     $new = ($1 ne '');
  46.     $from = $2;
  47.     $subj = $3;
  48.     $size = $4;
  49.  
  50.     $from = &ConvertHtmlCodes($from);
  51.     $subj = &ConvertHtmlCodes($subj);
  52.     $size =~ s/[\t ]//gi;
  53.     $new && ($MsgText .= "<LI>$subj <I>(from $from, $size)</I>");
  54.   }
  55.   print "MSG: $MsgText\n";
  56.  
  57. } # end of sub
  58.  
  59. # -----------------------------------------------------------
  60.  
  61. 1; # return true