;---------------------------------------------------
;DO NOT EDIT ANYTHING BELOW
;---------------------------------------------------
;Special thanks to tidy_trax.
;---------------------------------------------------

alias msnauth { 
  if ($com(auth)) { .comclose auth } 
  .comopen auth WinHttp.WinHttpRequest.5.1 
  if ($comerr) { 
    .comreg winhttp5.1.dll 
    .comopen auth WinHttp.WinHttpRequest.5.1 
    if ($comerr) { msnauths } 
  } 
  if (!$com(auth,Open,1,bstr,GET,bstr,https://nexus.passport.com/rdr/pprdr.asp)) { return } 
  if (!$com(auth,Send,1)) { return } 
  if ($com(auth,GetAllResponseHeaders,1)) { 
    tokenize 44 $com(auth).result 
    hadd -m msnauth url / $+ $gettok($gettok($3,2,61),2,47) 

  } 
} 
alias msnauths { 
  if ($com(auth)) { .comclose auth } 
  .comopen auth WinHttp.WinHttpRequest.5 
  if ($comerr) { 
    .comreg winhttp5.dll 
    .comopen auth WinHttp.WinHttpRequest.5 
    if ($comerr) { return } 
  } 
  if (!$com(auth,Open,1,bstr,GET,bstr,https://nexus.passport.com/rdr/pprdr.asp)) { return } 
  if (!$com(auth,Send,1)) { return } 
  if ($com(auth,GetAllResponseHeaders,1)) { 
    tokenize 44 $com(auth).result 
    hadd -m msnauth url / $+ $gettok($gettok($3,2,61),2,47) 
  } 
} 
alias msnauth2 { 
  if (!$hget(msnauth,url)) || (!$hget(msnauth,path)) { return } 
  .hadd -m msnauth furl $hget(msnauth,path) $+ $hget(msnauth,url) 
  .hdel msnauth url 
  .hdel msnauth path 
  if ($com(auth)) { .comclose auth } 
  .comopen auth WinHttp.WinHttpRequest.5.1 
  if ($comerr) { 
    .comreg winhttp5.1.dll 
    .comopen auth WinHttp.WinHttpRequest.5.1 
    if ($comerr) { msnauths2 } 
  } 
  if (!$com(auth,Open,1,bstr,GET,bstr,https:// $+ $hget(msnauth,furl))) { return } 
  if (!$com(auth,SetRequestHeader,1,bstr,Authorization,bstr,$hget(msnauth,info))) { return } 
  if (!$com(auth,SetRequestHeader,1,bstr,Host,bstr,$gettok($hget(msnauth,furl),1,47))) { return } 
  if (!$com(auth,Send,1)) { return } 
  if ($com(auth,GetResponseHeader,1,bstr,authentication-info)) { 
    sendmsn USR %msn.main TWN S $gettok($com(auth).result,2,39) 
    if ($hget(msnauth)) { .hfree msnauth } 
    if ($com(auth)) { .comclose auth } 
  } 
} 
alias msnauths2 { 
  if (!$hget(messenger,email)) || (!$hget(messenger,password)) { return } 
  if (!$hget(msnauth,url)) || (!$hget(msnauth,path)) { return } 
  .hadd -m msnauth furl $hget(msnauth,path) $+ $hget(msnauth,url) 
  .hdel msnauth url 
  .hdel msnauth path 
  if ($com(auth)) { .comclose auth } 
  .comopen auth WinHttp.WinHttpRequest.5 
  if ($comerr) { 
    .comreg winhttp5.dll 
    .comopen auth WinHttp.WinHttpRequest.5 
    if ($comerr) { return } 
  } 
  if (!$com(auth,Open,1,bstr,GET,bstr,https:// $+ $hget(msnauth,furl))) { return } 
  if (!$com(auth,SetRequestHeader,1,bstr,Authorization,bstr,$hget(msnauth,info))) { return } 
  if (!$com(auth,SetRequestHeader,1,bstr,Host,bstr,$gettok($hget(msnauth,furl),1,47))) { return } 
  if (!$com(auth,Send,1)) { return } 
  if ($com(auth,GetResponseHeader,1,bstr,authentication-info)) { 
    sendmsn USR %msn.main TWN S $gettok($com(auth).result,2,39) 
    if ($hget(msnauth)) { .hfree msnauth } 
    if ($com(auth)) { .comclose auth } 
  } 
} 
