Code: Select all
set msn_version "v1.1"
set msn_watchlist "+astra +MARI-ANA +foobar"
set msn_passport "demond@gmx.net"
set msn_password "parola"
set msn_who "lubomirr@hotmail.com"
set msn_header "MIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8\r\n"
set msn_header2 "X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=B; CO=0000FF; CS=0; PF=22\r\n"
set msn_didx 0
set msn_nidx 0
set msn_sidx 0
set msn_inuse 0
proc msn {message} {
global msn_didx msn_message
global msn_inuse
if {$msn_inuse} {return}
set msn_message $message
set msn_didx [connect messenger.hotmail.com 1863]
control $msn_didx msn_control
putdcc $msn_didx "VER 0 MSNP7 MSNP6 MSNP5 MSNP4 CVR0"
set msn_inuse 1
utimer 15 "set msn_inuse 0"
}
proc msn_control {idx text} {
global msn_didx msn_nidx msn_sidx
global msn_passport msn_password
global msn_message msn_who
global msn_header msn_header2
if {$text != ""} {putlog "MSN<<< $text"}
set reply [lrange $text 0 1]
if {$idx == $msn_didx} {
if {$text == ""} {putlog "MSN<<< (Dispatch closed connection)"; set msn_didx 0}
switch $reply {
"VER 0" {putdcc $msn_didx "INF 1"}
"INF 1" {putdcc $msn_didx "USR 2 MD5 I $msn_passport"}
"XFR 2" {
set msn_nhost [lindex [split [lindex $text 3] :] 0]
set msn_nport [lindex [split [lindex $text 3] :] 1]
set msn_nidx [connect $msn_nhost $msn_nport]
control $msn_nidx msn_control
putdcc $msn_nidx "VER 3 MSNP7 MSNP6 MSNP5 MSNP4 CVR0"
}
}
}
if {$idx == $msn_nidx} {
if {$text == ""} {putlog "MSN<<< (Notification closed connection)"; set msn_nidx 0}
switch $reply {
"VER 3" {putdcc $msn_nidx "INF 4"}
"INF 4" {putdcc $msn_nidx "USR 5 MD5 I $msn_passport"}
"USR 5" {
set msn_hash [lindex $text 4]
putdcc $msn_nidx "USR 6 MD5 S [md5 "${msn_hash}${msn_password}"]"
}
"USR 6" {putdcc $msn_nidx "CHG 7 NLN"}
"CHG 7" {putdcc $msn_nidx "SYN 8 0"}
"SYN 8" {utimer 5 "putdcc $msn_nidx \"ADD 9 AL $msn_who $msn_who\""}
"ADD 9" {putdcc $msn_nidx "XFR 10 SB"}
"215 9" {putdcc $msn_nidx "XFR 10 SB"}
"XFR 10" {
set msn_shost [lindex [split [lindex $text 3] :] 0]
set msn_sport [lindex [split [lindex $text 3] :] 1]
set msn_hash [lindex $text 5]
set msn_sidx [connect $msn_shost $msn_sport]
control $msn_sidx msn_control
putdcc $msn_sidx "USR 11 $msn_passport $msn_hash"
}
"CHL 0" {putdcc $msn_nidx "OUT"}
}
}
if {$idx == $msn_sidx} {
if {$text == ""} {putlog "MSN<<< (Switchboard closed connection)"; set msn_sidx 0}
switch -glob $reply {
"USR 11" {putdcc $msn_sidx "CAL 12 $msn_who"}
"JOI *" {
set message "${msn_header}${msn_header2}\r\n${msn_message}"
putdcc $msn_sidx "MSG 13 A [string length $message]"
putdcc $msn_sidx $message
putlog "MSG 13 A [string length $message]\n$message"
}
}
}
}
proc msn_initserver {type} {
global msn_watchlist
puthelp "WATCH $msn_watchlist"
}
proc msn_rawwatch {from keyword args} {
set args [lindex $args 0]
set nick [lindex $args 1]
set user [lindex $args 2]
set host [lindex $args 3]
switch $keyword {
"600" {set what "is on IRC!"}
"601" {set what "has left IRC"}
}
msn "${nick}!${user}@${host} $what"
}
proc msn_msnsay {hand idx args} {
set args [lindex $args 0]
if {$args == ""} {putdcc $idx "Usage: .msnsay <message>"; return}
putlog "#$hand# msnsay $args"
msn "<$hand> $args"
}
bind evnt - init-server msn_initserver
bind raw - 600 msn_rawwatch
bind raw - 601 msn_rawwatch
bind dcc o|o msnsay msn_msnsay
putlog "MSN notify pager $msn_version by demond loaded"