A snippet that checks if you have unread email in your hotmail account.
/*
**
** /hotmail by hixxy ([email protected]) for mIRC 6.17 or above.
**
**
** What the script does
** ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
**
** This script will let you check if you have any unread emails in your hotmail account.
**
** To use this script you have to have SSL enabled in mIRC.
** For help installing OpenSSL please take a look at this page: http://www.mirc.co.uk/ssl.html
**
** If you're interested in learning the MSN Messenger protocol, take a look at http://www.hypothetic.org/docs/msn/ - that's where I learnt. Of course, you'll
** need socket knowledge.
**
** How to load
** ¯¯¯¯¯¯¯¯¯¯¯
**
** You can load this script by typing /load -rs <path to hotmail.mrc>. If you saved the file in your mIRC directory you can just do /load -rs hotmail.mrc.
** You can also just copy/paste it into remote from a website and then hit the OK button.
**
** How to use
** ¯¯¯¯¯¯¯¯¯¯
**
** The syntax is /hotmail <email address> <password>
**
** I think both arguments are fairly self explanatory.
**
** A few lines below this there is a line that says "alias -l failure_check_wait" - this is an alias that tells the script how many seconds wait
** before reporting no unread emails, because hotmail doesn't tell if we have no unread emails, only if we have some. If you have a slow connection I suggest
** increasing it to about 3-4 seconds (just change "return 1" to "return 3" or "return 4"). Just play around with it until it suits your connection nicely.
**
** Contact
** ¯¯¯¯¯¯¯
**
** If you have a feature suggestion, bug report or question, please send an email to [email protected]
** If you got the script from a scripting website and I (hixxy) submitted the code, you may also leave feedback on the script's comment page.
**
*/
alias -l failure_check_wait { return 1 }
alias -l raiseerror {
if (!$line($active,0)) { linesep -a }
echo $colour(info) -a $1-
linesep -a
halt
}
alias -l failure {
sockclose hotmail_notification
unset %hotmail_trid
raiseerror * /hotmail: You have no unread emails
}
alias -l trid {
inc %hotmail_trid
return %hotmail_trid
}
alias hotmail {
if ($0 < 2) { raiseerror * /hotmail: Insufficient parameters }
if (@ !isin $1) { raiseerror * /hotmail: Invalid email address }
if (!$portfree(1863)) { raiseerror * /hotmail: Port in use }
if (!$sslready) { raiseerrror * /hotmail: SSL not ready }
sockopen hotmail_dispatch messenger.hotmail.com 1863
sockmark hotmail_dispatch $1-2
}
on *:sockopen:hotmail_dispatch:{
if ($sockerr) { raiseerror * /hotmail: Socket error }
sockwrite -n $sockname VER $trid MSNP9 MSNP8 CVR0
}
on *:sockread:hotmail_dispatch:{
var %data
sockread %data
tokenize 32 %data
if ($1 $3 == VER MSNP9) { sockwrite -n $sockname CVR $trid 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS $gettok($sock($sockname).mark,1,32) }
elseif ($1 == CVR) { sockwrite -n $sockname USR $trid TWN I $gettok($sock($sockname).mark,1,32) }
elseif ($1 $3 == XFR NS) {
sockopen hotmail_notification $gettok($4,1,58) $gettok($4,2,58)
sockmark hotmail_notification $sock($sockname).mark
sockclose $sockname
unset %hotmail_trid
}
}
on *:sockopen:hotmail_notification:{
if ($sockerr) {
unset %hotmail_trid
raiseerror * /hotmail: Socket error
}
sockwrite -n $sockname VER $trid MSNP9 MSNP8 CVR0
}
on *:sockread:hotmail_notification:{
var %data
sockread %data
tokenize 32 %data
if ($1 $3 == VER MSNP9) { sockwrite -n $sockname CVR $trid 0x0409 win 4.10 i386 MSNMSGR 5.0.0544 MSMSGS $gettok($sock($sockname).mark,1,32) }
elseif ($1 == CVR) { sockwrite -n $sockname USR $trid TWN I $gettok($sock($sockname).mark,1,32) }
elseif ($1 $3-4 == USR TWN S) {
var %email = $gettok($sock($sockname).mark,1,32), %password = $gettok($sock($sockname).mark,2,32)
sockopen -e hotmail_nexus nexus.passport.com 443
sockmark hotmail_nexus Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in= $+ %email $+ ,pwd= $+ %password $+ , $+ $5-
}
elseif ($1 $3 == USR OK) {
sockwrite -n $sockname CHG $trid HDN 0
.timerhotmail_failure 1 $failure_check_wait failure
}
elseif ($1 == inbox-unread:) {
.timerhotmail_failure off
sockclose $sockname
unset %hotmail_trid
raiseerror * /hotmail: You have $2 unread email $+ $iif($2 > 1,s)
}
}
on *:sockopen:hotmail_nexus:{
if ($sockerr) {
unset %hotmail_trid
sockclose hotmail_notification
raiseerror * /hotmail: Socket error
}
sockwrite -n $sockname GET /rdr/pprdr.asp HTTP/1.0
sockwrite -n $sockname
}
on *:sockread:hotmail_nexus:{
var %data
sockread %data
tokenize 32 %data
if ($1 == passporturls:) {
sockopen -e hotmail_login $gettok($gettok($gettok($2,2,44),1,47),2,61) 443
sockmark hotmail_login / $+ $gettok($gettok($2,2,44),2,47) $sock($sockname).mark
}
}
on *:sockopen:hotmail_login:{
if ($sockerr) {
unset %hotmail_trid
sockclose hotmail_notification
raiseerror * /hotmail: Socket error
}
sockwrite -n $sockname GET $gettok($sock($sockname).mark,1,32) HTTP/1.1
sockwrite -n $sockname Authorization: $gettok($sock($sockname).mark,2-,32)
sockwrite -n $sockname Host: $sock($sockname).ip
sockwrite -n $sockname
}
on *:sockread:hotmail_login:{
var %data
sockread %data
tokenize 32 %data
if ($1 == location:) {
var %mark = $gettok($sock($sockname).mark,2-,32)
sockclose $sockname
sockopen -e $sockname $gettok($2,2,47) 443
sockmark $sockname $gettok($2,3,47) %mark
}
elseif ($1 == authentication-info:) && (*'t=*'* iswm $1-) {
sockwrite -n hotmail_notification USR $trid TWN S $gettok($1-,2,39)
sockclose $sockname
}
}