i wonder if it is possible to make that script works on a windrop installed on my home computer using the smtp servver from my email account
any help welcome
Code: Select all
##################################
### eNote.tcl - nix@underz.org ###
##################################
# .eCfg #
##################################
#set this to 1 if you use sendmail - 0=no
set eNoteCfg(sendmail) 0
#and set the path bellow
set eNoteCfg(smpath) "/usr/sbin/sendmail"
#you can use an SMTP server...
set eNoteCfg(smtp) smtp.videotron.ca
#port for the SMTP server
set eNoteCfg(port) 25
##################################
bind dcc - eNote eNote
proc eNote {hand idx text} {
global eNote botnick
if {([string tolower [lindex $text 0]] == "none") && ([info exists eNote([string tolower $hand])])} {
putidx $idx "Removed $eNote([string tolower $hand])."
unset eNote([string tolower $hand])
eNoteSave
return 1
} elseif {([string tolower [lindex $text 0]] == "none") && (![info exists eNote([string tolower $hand])])} {
putidx $idx "there is no address to delete"
return 0
}
if {([string match *@*.* $text]) && ([llength $text] == 1)} {
set eNote([string tolower $hand]) $text
eNoteSave
putidx $idx "All note will be forwarded to $text."
return 1
} elseif {([string match *@*.* $text]) && ([llength $text] > 1)} {
eNoteSend $hand [lindex $text 0] [join [lrange $text 1 end]]
putidx $idx "eNoting [lindex $text 0]..."
return 0
}
putidx $idx "Usage:\n .eNote <email> (set your email) \n .eNote <none> (delete your email) \n .eNote <to email> <message> (send an email to someone)"
if {[info exists eNote([string tolower $hand])]} {putidx $idx "Your email: $eNote([string tolower $hand])"}
return 0
}
bind filt - ".note *" eNoteFilt
proc eNoteFilt {idx arg} {
global eNote
if {([validuser [lindex $arg 1]]) && ([info exists eNote([string tolower [lindex $arg 1]])])} {
set test 1
if {[hand2idx [lindex $arg 1]] > -1} {
if {([getdccaway [hand2idx [lindex $arg 1]]] == "") && ([getdccidle [hand2idx [lindex $arg 1]]] < 1800)} {set test 0}
}
if {$test} {eNoteSend [idx2hand $idx] $eNote([string tolower [lindex $arg 1]]) [join [lrange $arg 2 end]]}
}
return $arg
}
proc eNoteSend {from to texte} {
global eNoteCfg botnick
if {$eNoteCfg(sendmail)} {
if {![catch {open "| $eNoteCfg(smpath) -f $from@$botnick -t" "w"} ml]} {
puts $ml "To: $to"
puts $ml "From: $from@$botnick"
puts $ml "$texte"
close $ml
}
} else {
if {![catch {connect $eNoteCfg(smtp) $eNoteCfg(port)} ml]} {
putidx $ml "HELO $eNoteCfg(smtp)"
putidx $ml "MAIL FROM: $from@$botnick.bot"
putidx $ml "RCPT TO: $to"
putidx $ml "DATA"
putidx $ml "$texte"
putdcc $ml "."
putdcc $ml "QUIT"
}
}
}
proc eNoteSave {} {
global eNote
set f [open eNote.tcl.conf w]
foreach c [array names eNote] {puts $f "$c $eNote($c)"}
close $f
}
proc eNoteLoad {} {
global eNote
if {![file exists "eNote.tcl.conf"]} {set f [open eNote.tcl.conf w]; close $f; return 0}
set f [open eNote.tcl.conf r]
while {[gets $f line] >= 0} {set eNote([lindex $line 0]) [lindex $line 1]}
close $f
}
eNoteLoad
bind dcc n eCfg eCfg
proc eCfg {hand idx text} {
global eNoteCfg
if {[string tolower [lindex $text 0]] == "type"} {
if {$eNoteCfg(sendmail) == 0} {set eNoteCfg(sendmail) 1; putidx $idx "using sendmail now"; eCfgSave
} else {set eNoteCfg(sendmail) 0; putidx $idx "using SMTP now"}
return 1
} elseif {[string tolower [lindex $text 0]] == "smpath"} {
if {[lindex $text 1] != ""} {set eNoteCfg(smpath) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
} else {putidx $idx "Usage: .eCfg smpath <path to sendmail>"; return 0}
} elseif {[string tolower [lindex $text 0]] == "smtp"} {
if {[lindex $text 1] != ""} {set eNoteCfg(smtp) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
} else {putidx $idx "Usage: .eCfg smtp <ip of your smtp server>"; return 0}
} elseif {[string tolower [lindex $text 0]] == "port"} {
if {[lindex $text 1] != ""} {set eNoteCfg(port) "[lindex $text 1]"; putidx $idx "Done"; eCfgSave; return 1
} else {putidx $idx "Usage: .eCfg port <port of your smtp server>"; return 0}
} elseif {[string tolower [lindex $text 0]] == "status"} {
putidx $idx " eNote.tcl "
if {$eNoteCfg(sendmail)} {putidx $idx "Using sendmail ($eNoteCfg(smpath))"
} else {putidx $idx "Using SMTP server at $eNoteCfg(smtp) port $eNoteCfg(port)"}
return 1
} else {
putidx $idx "Usage: \n .eCfg TYPE <toggle SMTP/sendmail> \n .eCfg SMPATH <path to sendmail> \n .eCfg SMTP <ip of the smtp server> \n .eCfg PORT <port of the smtp server>"
return 0
}
}
proc eCfgSave {} {
global eNoteCfg
set f [open eNote.tcl.setup w]
foreach c [array names eNoteCfg] {puts $f "$c $eNoteCfg($c)"}
close $f
}
proc eCfgLoad {} {
global eNoteCfg
if {![file exists "eNote.tcl.setup"]} {set f [open eNote.tcl.setup w]; close $f; return 0}
set f [open eNote.tcl.setup r]
while {[gets $f line] >= 0} {set eNoteCfg([lindex $line 0]) [lindex $line 1]}
close $f
}
eCfgLoad
putlog "\002eNote.tcl\002 - (.eNote / .eCfg)"