aIRC — File Browser
aIRCv0.8.69 / aIRCv0.8.69 / addons / mail.mrc
mail.mrc — 31.05 KB — Download this file
;/**********************************************************************
; *
; * aIRC
; * Mail Client
; *
; **********************************************************************/
;
;
; This is the oldest part of the script.
; The SMTP dialog is my first mIRC dialog
;
; This is a very lame mail client
; You should never use it!
;
alias _mail.addonver { return 1.0 }
alias mail {
var %t,%s,%a,%n,%d
if ($1 isnum) {
%t = $iif($gettok($_list.get(cuentasmail,$1),2,176),$1,1)
tokenize 32 $2-
}
else { %t = 1 }
%t = $_list.get(cuentasmail,%t)
if ($_ismail($1) == $null) { %s = $1- }
else {
%a = $1
%s = $2-
}
while (1) {
inc %n
if ($dialog(SMTP [ $+ [ %n ] ] ) == $null) && ($sock(SMTP [ $+ [ %n ] ] ) == $null) { break }
}
%d = SMTP $+ %n
dialog -dm %d SMTP
dialog -t %d e-mail SMTP
dialog -s %d $calc(($window(-1).w - 500) / 2) $calc(($window(-1).h - 340) / 2) 500 340
if ($gettok(%t,2,176)) { did -o %d 19 1 $ifmatch }
if ($gettok(%t,3,176)) { did -o %d 17 1 $ifmatch }
if ($gettok(%t,4,176)) { did -o %d 27 1 $ifmatch }
if ($gettok(%t,5,176)) { did -o %d 15 1 $ifmatch }
if (%a != $null) { did -o %d 4 1 %a }
if (%s != $null) { did -o %d 8 1 %s }
did -f %d 13
}
alias _mail.unload {
if ($dialog(cuentamail)) || ($dialog(mailconf)) {
error.a Please close the account manager before you uninstall the Mail client
return 1
}
var %n,%d
while (1) {
inc %n
%d = $dialog(%n)
if (%d != $null) {
if (SMTP* iswm %d) || (ADDRBOOK* iswm %d) {
error.a Please close all mail sessions before you uninstall the Mail client
return 1
}
}
else { break }
}
_closematchingwindows @e-Mail POP3-*
.timerPOP3autover off
sockclose SMTP*
sockclose POP3*
}
alias mailconf { _dialog -m mailconf _simplelist }
alias _mail.mailnum {
if ($left($sockname,4) == POP3) { return $remove($sockname,POP3) }
if (@e-Mail POP3-* iswm $1) { return $remove($1,@e-Mail POP3-) }
if (@e-Mail POP3-* iswm $active) { return $remove($active,@e-Mail POP3-) }
}
alias _mail.mailnump {
if ($1) { return POP3 $+ $_mail.mailnum($1) }
return POP3 $+ $_mail.mailnum
}
alias _mail.mailvent { return $_sockmark(2) }
alias _mail.m.chmail.responder {
if (*message* iswm $window($active).title) { return $_window.cileft(&reply...) }
}
alias chmail {
var %t,%m,%ms,%pass,%n,%w
if ($1 isnum) { %t = $iif($_mail.escuentapop3($1),$1,1) }
else { %t = 1 }
if ($_mail.escuentapop3(%t) == $null) {
error.a There are no valid POP3 accounts
mailconf
return
}
%t = $_list.get(cuentasmail,%t)
%m = $iif($1 isnum,$2,$1)
if (%m == -min) { %ms = 1 }
elseif (%m == -ver) { %ms = 0 }
else { %ms = 2 }
%~pop3.serv = $gettok(%t,6,176)
%~pop3.logi = $gettok(%t,7,176)
%pass = $_decrypt($gettok(%t,8,176))
if (%pass) { %pass = $ifmatch }
else { %pass = 0 }
while (1) {
inc %n
if ($window(@e-Mail POP3- [ $+ [ %n ] ] ) == $null) && ($sock(POP3 [ $+ [ %n ] ] ) == $null) { break }
}
%w = @e-Mail POP3- $+ %n
if (%ms) {
if ($ifmatch == 1) {
window -akl5 %w $_window.conf(@e-Mail POP3)
_window.font.reset %w @e-Mail POP3
aline %w $^*** e-Mail POP3
}
else { window -akl -t3 %w $_window.conf(@e-Mail POP3) }
titlebar %w %~pop3.logi in %~pop3.serv - Connecting...
}
sockopen POP3 $+ %n %~pop3.serv 110
sockmark POP3 $+ %n %~pop3.serv $+ $chr(9) $+ %w $+ $chr(9) $+ %~pop3.logi $+ $chr(9) $+ %pass $+ $chr(9) $+ connecting $+ $chr(9) $+ 0 $+ $chr(9) $+ %ms $+ $chr(9) $+ 0
}
alias chmails {
var %n
while (1) {
inc %n
if ($_list.get(cuentasmail,%n)) {
if ($_mail.escuentapop3(%n) != $null) && ($gettok($_list.get(cuentasmail,%n),8,176)) { chmail %n -ver }
}
else { break }
}
.timerPOP3autover off
if ($_getsetup(email,pop3.autover)) { .timerPOP3autover -o 1 $calc($_getsetup(email,pop3.autoverevery) * 60) chmails }
}
alias _mail.mailsep { return $iif($1 == 1,$gettok($2-,1,60),$remove($gettok($2-,2,60),>)) }
alias _mail.escuentapop3 {
if ($gettok($_list.get(cuentasmail,$1),6,176)) && ($gettok($_list.get(cuentasmail,$1),7,176)) { return 1 }
}
alias _mail.smtpsr {
if ($1 == 220) {
_sw HELO $gettok($_sockmark(3),2,64)
did -o $_sockmark(2) 250 1 $_sockmark(1) - Sending info...
sockmark $sockname $puttok($sock($sockname).mark,1,6,9)
}
if ($1 == 221) {
did -o $_sockmark(2) 250 1 $_sockmark(1) - Mail Sent!
sockclose $sockname
}
if (25? iswm $1) {
if ($_sockmark(6) == 1) { _sw MAIL FROM:< $+ $_sockmark(3) $+ > }
elseif ($_sockmark(6) == 2) {
if ($_sockmark(9) > 0) {
:250_2
if ($gettok($_sockmark(10),$_sockmark(9),44) != $null) {
sockmark $sockname $puttok($sock($sockname).mark,$calc($_sockmark(9) + 1),9,9)
if ($_ismail($gettok($_sockmark(10),$calc($_sockmark(9) - 1),44)) != $null) || ($_ismail($_mail.mailsep(2,$gettok($_sockmark(10),$calc($_sockmark(9) - 1),44))) != $null) {
_sw RCPT TO:< $+ $ifmatch $+ >
return
}
else { goto 250_2 }
}
else { _sw DATA }
}
else {
_sw RCPT TO:< $+ $_sockmark(4) $+ >
sockmark $sockname $puttok($sock($sockname).mark,1,9,9)
if ($_sockmark(10) != 0) { return }
else { _sw DATA }
}
}
elseif ($_sockmark(6) == QUIT) { _sw QUIT }
if ($_sockmark(6) != QUIT) { sockmark $sockname $puttok($sock($sockname).mark,$calc($ifmatch + 1),6,9) }
}
if ($1 == 354) {
did -o $_sockmark(2) 250 1 $_sockmark(1) - Sending e-Mail...
_sw X-MAILER: aIRC v $+ $_vers by tabo
_sw X-SENDER: aIRC v $+ $_vers by tabo
_sw X-URL: $_aircweb
_sw DATE: $left($day,3) $+ , $gettok($fulldate,3,32) $gettok($fulldate,2,32) $right($fulldate,4) $time $iif(- isin $timezone,-,+) $+ $iif($calc($remove($timezone,-) / 36) < 1000,0) $+ $calc($remove($timezone,-) / 36)
_sw ORGANIZATION: tabo Corporation
_sw CONTENT-TYPE: TEXT/PLAIN
_sw PRIORITY: Urgent
_sw X-PRIORITY: Highest
_sw X-MSMAIL-Priority: High
if ($_sockmark(11)) { _sw REPLY-TO: $_sockmark(11) }
if ($_sockmark(7)) { _sw FROM: $_sockmark(7) < $+ $_sockmark(3) $+ > }
else { _sw FROM: $_sockmark(3) }
if ($_sockmark(8)) { _sw TO: $_sockmark(8) < $+ $_sockmark(4) $+ > }
else { _sw TO: $_sockmark(4) }
if ($_sockmark(10)) { _sw CC: $_sockmark(10) }
if ($_sockmark(5)) { _sw SUBJECT: $ifmatch }
_sw $crlf
var %mail13 = $did($_sockmark(2),13).lines,%mail354
:dltext
inc %mail354
if (%mail354 <= %mail13) {
if ($did($_sockmark(2),13,%mail354).text == .) { _sw $crlf }
elseif ($did($_sockmark(2),13,%mail354).text != $null) { _sw $ifmatch }
else { _sw $crlf }
goto dltext
}
_sw .
sockmark $sockname $puttok($sock($sockname).mark,QUIT,6,9)
}
if (4* iswm $1) || (5* iswm $1) {
_sw QUIT
did -o $_sockmark(2) 250 1 $_sockmark(1) - ERROR: $2-
error.s email - $2-
}
}
alias _mail.pop3sr {
if ($_sockmark(7)) && ($_mail.mailvent == $null) { sockclose $sockname }
if ($1 == -ERR) {
if ($_sockmark(7)) {
if (*Mailbox Locked* iswm $2-) {
error.w $_mail.mailvent POP3 Client - $2- - You are checking your mail from another client
.timer -o 1 3 close -@ $_mail.mailvent
}
else { error.w $_mail.mailvent POP3 Client - $2- }
}
_timeremote _mail.swp QUIT
}
elseif ($1 == +OK) {
if ($_sockmark(5) == connecting) {
sockmark $sockname $puttok($sock($sockname).mark,$calc($_sockmark(6) + 1),6,9)
if ($_sockmark(6) == 3) {
sockmark $sockname $puttok($puttok($sock($sockname).mark,0,6,9),stat,5,9)
_mail.swp STAT
}
}
elseif ($_sockmark(5) == read) {
if ($window($_mail.mailvent)) {
if ($_sockmark(7) == 1) { clear $_mail.mailvent }
if (deleted isin $2-) {
if ($_sockmark(7) == 1) { dline -l $_mail.mailvent $fline($_mail.mailvent,$3,1,1) }
else { dline -l $_mail.mailvent $fline($_mail.mailvent,$3 [ $+ [ * ] ] ,1) }
}
else {
if ($_sockmark(7) == 1) { aline $colour(info) $_mail.mailvent Downloading message $sline($_mail.mailvent,1) $+ ... }
var %tmp = $_tmpdir $+ mailtmp $+ $_mail.mailnum
if ($isfile(%tmp)) { .remove %tmp }
}
}
}
elseif ($_sockmark(5) == stat) {
if ($2 > 0) {
if ($_sockmark(7)) {
if ($_sockmark(7) == 1) {
titlebar $_mail.mailvent $_sockmark(3) in $_sockmark(1) - $_nsingoplur($2,e-Mail,e-Mails) $chr(91) $+ $_size($3) $+ $chr(93)
aline $colour(info) $_mail.mailvent You have $_nsingoplur($2,e-Mail,e-Mails) $chr(91) $+ $_size($3) $+ $chr(93)
sockmark $sockname $puttok($puttok($sock($sockname).mark,list,5,9),$2,8,9)
_mail.swp LIST
}
else {
titlebar $_mail.mailvent $_sockmark(3) in $_sockmark(1) - $_nsingoplur($2,e-Mail,e-Mails) $chr(91) $+ $_size($3) $+ $chr(93) - Downloading headers...
sockmark $sockname $puttok($puttok($sock($sockname).mark,list,5,9),$2,8,9)
_mail.swp LIST
}
}
else {
lecho.a $colour(info) $^*** You have $_nsingoplur($2,e-Mail,e-Mails) $chr(91) $+ $_size($3) $+ $chr(93) in you account $_sockmark(3) in $_sockmark(1)
sockclose $sockname
}
}
else {
if ($_sockmark(7)) {
aline $colour(info) $_mail.mailvent You don't have any mails... Disconnecting...
titlebar $_mail.mailvent $gettok($window($_mail.mailvent).title,1-3,32) - Disconnecting
.timer -o 1 3 close -@ $_mail.mailvent
sockclose $sockname
}
else {
lecho.a $colour(info) $^*** You don't have any mails in your account $_sockmark(3) in $_sockmark(1)
sockclose $sockname
}
}
}
}
elseif ($1- == .) {
if ($_sockmark(5) == read) {
if ($_sockmark(7) == 1) {
clear $_mail.mailvent
aline $_mail.mailvent $$^*** POP3 - Message $sline($_mail.mailvent,1)
titlebar $_mail.mailvent $_sockmark(3) in $_sockmark(1) - Message $sline($_mail.mailvent,1)
loadbuf -p $_mail.mailvent " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ "
}
elseif ($_sockmark(7) == 2) {
if ($window($replace($_mail.mailvent,e-mail,Reading e-mail)) == $null) { window -ak $replace($_mail.mailvent,e-mail,Reading e-mail)) $_window.conf(@e-Mail POP3) }
else { window -ak $replace($_mail.mailvent,e-mail,Reading e-mail)) }
titlebar $replace($_mail.mailvent,e-mail,Reading e-mail)) $_sockmark(3) in $_sockmark(1) - Message $gettok($sline($_mail.mailvent,1),1,9)
clear $replace($_mail.mailvent,e-mail,Reading e-mail)
aline $replace($_mail.mailvent,e-mail,Reading e-mail) $^*** POP3 - Mensaje $gettok($sline($_mail.mailvent,1),1,9)
loadbuf -p $replace($_mail.mailvent,e-mail,Reading e-mail) " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ "
}
}
elseif ($_sockmark(5) == header) {
if ($_sockmark(6) == $_sockmark(8)) {
sockmark $sockname $puttok($sock($sockname).mark,read,5,9)
titlebar $_mail.mailvent $remove($window($_mail.mailvent).title,- Downloading Headers...)
window -bk $_mail.mailvent
clear $_mail.mailvent
loadbuf -p $_mail.mailvent " $+ $_tmpdir $+ mailtmpl $+ $_mail.mailnum $+ "
.remove $_tmpdir $+ mailtmpl $+ $_mail.mailnum
}
else { sockmark $sockname $puttok($sock($sockname).mark,$calc($_sockmark(6) + 1),6,9) }
}
elseif ($_sockmark(5) == list) {
if ($_sockmark(7) == 1) { sockmark $sockname $puttok($sock($sockname).mark,read,5,9) }
if ($_sockmark(7) == 2) { sockmark $sockname $puttok($puttok($sock($sockname).mark,header,5,9),1,6,9) }
}
var %tmp = $_tmpdir $+ mailtmp $+ $_mail.mailnum
if ($isfile(%tmp)) { .remove %tmp }
}
else {
if ($_sockmark(5) == read) {
if (X-*: iswm $1) || (Content-*: iswm $1) || ($istok(Errors-To:!Message-ID:!Precedence:!Received:!References:!Status:,$1,33)) || ((mime isin $1) && ((: isin $1))) { goto yata }
elseif ($1 == From:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ FROM: $2- }
elseif ($1 == To:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ TO: $2- }
elseif ($1 == Reply-To:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ REPLYÂ TO: $2- }
elseif ($1 == Subject:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ SUBJECT: $2- }
elseif ($1 == Date:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ DATE: $2- }
elseif ($1 == Organization:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ ORGANIZATION: $2- }
elseif ($1 == Priority:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ PRIORITY: $2- }
elseif ($1 == In-reply-to:) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ INÂ REPLYÂ TO: $2- }
elseif (*: iswm $1) { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $+ $_color(info2) $+ $1 $+ $2- }
else { write " $+ $_tmpdir $+ mailtmp $+ $_mail.mailnum $+ " $1- }
}
elseif ($_sockmark(5) == header) {
if ($1 == From:) { write -l $+ $_sockmark(6) " $+ $_tmpdir $+ mailtmpl $+ $_mail.mailnum $+ " $read -l $+ $_sockmark(6) $_tmpdir $+ mailtmpl $+ $_mail.mailnum $2- }
elseif ($1 == Subject:) { write -l $+ $_sockmark(6) " $+ $_tmpdir $+ mailtmpl $+ $_mail.mailnum $+ " $read -l $+ $_sockmark(6) $_tmpdir $+ mailtmpl $+ $_mail.mailnum $2- }
}
elseif ($_sockmark(5) == list) {
if ($_sockmark(7) == 1) { aline -l $_mail.mailvent $1 }
if ($_sockmark(7) == 2) {
write " $+ $_tmpdir $+ mailtmpl $+ $_mail.mailnum $+ " $1 $+ $chr(9) $+ $_size($2)
_mail.swp TOP $1 0
}
}
}
:yata
unset %~pop3.*
}
alias _mail.pop3login { sockwrite -n $1 PASS $_parameterpass($null,0,POP3 Client [/chmail],1,$null,Password of account [ $2 ] in [ $3 ] <CRLF>[this password won't be saved]) }
alias _mail.swp { sockwrite -n $_mail.mailnump $1- }
alias _mail.smtpA {
if ($1 == 1) {
did -h $dname 14,15,16,17,18,19,20,21,22,23,24,25,26,27
did -v $dname 11,12,13
}
else {
did -h $dname 11,12,13
did -v $dname 14,15,16,17,18,19,20,21,22,23,24,25,26,27
}
}
alias _mail.import { _dialog.loadbuf $1 13 $dir="Import file:" $mircdir }
alias _mail.save { _dialog.savebuf $1 13 $dir="Save in file:" $logdir [ $+ [ $1.txt ] ] }
alias _mail.addrbook {
if ($dialog(addrbook) == $null) { return $dialog(addrbook,ADDRBOOK,-4) }
}
alias _mail.addrbookmete {
var %n = 1
_list.add addrbook $1-
while ($dialog(%n) != $null) {
if (SMTP* iswm $dialog(%n)) {
if ($2- != $null) { _dialog.add1 $dialog(%n) 20 $ifmatch < $+ $1 $+ > }
else { _dialog.add1 $dialog(%n) 20 $1 }
}
inc %n
}
}
alias _mail.addrbookborra {
var %n = 1
if ($0 > 1) { _list.del addrbook $_mail.mailsep(2,$1-) $_mail.mailsep(1,$1-) }
else { _list.del addrbook $1 }
while ($dialog(%n) != $null) {
if (SMTP* iswm $dialog(%n)) { _dialog.del $dialog(%n) 20 $1- }
inc %n
}
}
alias _mail.preguntacuenta {
unset %~mpregcuenta.*
%~mpregcuenta.p = $gettok($2-,2-,32)
%~mpregcuenta.t = $dialog(cuentamail,cuentamail,-4)
unset %~mpregcuenta.*
}
alias _mail.cuenta.graba {
var %tmp,%d = cuentamail
%tmp = $_list.tokadd(cuentasmail,1,176,$did(%d,2))
write -l $+ %tmp " $+ $_list.file(cuentasmail) $+ " $_text($did(%d,2)) $+ ° $+ $iif($did(%d,102),$did(%d,102),0) $+ ° $+ $iif($did(%d,112),$did(%d,112),0) $+ ° $+ $iif($did(%d,122),$did(%d,122),0) $+ ° $+ $iif($did(%d,132),$did(%d,132),0) $+ ° $+ $iif($did(%d,142),$did(%d,142),0) $+ ° $+ $iif($did(%d,152),$did(%d,152),0) $+ ° $+ $iif($did(%d,162),$_crypt($did(%d,162)),0)
_list.hash cuentasmail
did -o $dname 250 1 %tmp
_dialog.loadlist mailconf 2 1 176 cuentasmail 1 1
}
alias _mail.cuenta.revisaedit {
unset %~mcuentaredit.*
if ($_text($did(2)) == $null) {
%~mcuentaredit.nosmtp = 1
%~mcuentaredit.nopop3 = 1
goto revisa
}
if ($did(102) == $null) { %~mcuentaredit.nosmtp = 1 }
elseif ($did(102) != $null) && (($chr(32) isin $did(102)) || ($_ishost($did(102)) == $null)) { %~mcuentaredit.nosmtp = 1 }
elseif ($did(112) != $null && ($did(102) == $null || $_ismail($did(112)) == $null)) { %~mcuentaredit.nosmtp = 1 }
elseif ($did(122) != $null && ($did(102) == $null || $_ismail($did(122)) == $null)) { %~mcuentaredit.nosmtp = 1 }
elseif ($did(132) != $null && $did(102) == $null) { %~mcuentaredit.nosmtp = 1 }
if ($did(142) != $null) {
if ($chr(32) isin $did(142)) || ($_ishost($did(142)) == $null) { %~mcuentaredit.nopop3 = 1 }
elseif ($did(152) != $null) && (($chr(32) isin $did(152)) || ($chr(44) isin $did(152)) || ($chr(64) isin $did(152))) { %~mcuentaredit.nopop3 = 1 }
elseif ($did(152) == $null) { %~mcuentaredit.nopop3 = 1 }
elseif ($did(162) != $null) && (($chr(32) isin $did(162)) || ($chr(44) isin $did(162))) { %~mcuentaredit.nopop3 = 1 }
elseif ($did(162) == $null) { %~mcuentaredit.nopop3ver = 1 }
}
else { %~mcuentaredit.nopop3 = 1 }
:revisa
if (%~mcuentaredit.nosmtp) { did -b $dname 200 }
else { did -e $dname 200 }
if (%~mcuentaredit.nopop3ver) {
did -e $dname 201
did -e $dname 202
did -b $dname 203
}
elseif (%~mcuentaredit.nopop3) {
did -b $dname 201
did -b $dname 202
did -b $dname 203
}
else {
did -e $dname 201
did -e $dname 202
did -e $dname 203
}
if (%~mcuentaredit.nosmtp) && (%~mcuentaredit.nopop3) {
did -b $dname 243
did -o $dname 249 1 0
}
else {
did -e $dname 243
did -o $dname 249 1 1
}
unset %~mcuentaredit.*
}
ON *:SOCKOPEN:SMTP*:{
if ($sockerr) {
did -o $sockname 250 1 $_sockmark(1) - ERROR: $_sockerr
error.a $_sockerr
return
}
did -o $sockname 250 1 $_sockmark(1) - Connected
}
ON *:SOCKCLOSE:SMTP*:{
did -o $_sockmark(2) 250 1 $_sockmark(1) - ERROR: Connection Closed
error.a Connection Closed
}
ON *:SOCKWRITE:SMTP*:{
if ($sockerr) {
if ($dialog($_sockmark(2))) { did -o $_sockmark(2) 250 1 $_sockmark(1) - ERROR: $_sockerr }
error.a $_sockerr
}
}
ON *:SOCKREAD:SMTP*:{
if ($sockerr) {
did -o $_sockmark(2) 250 1 $_sockmark(1) - ERROR: $_sockerr
error.a $_sockerr
return
}
:smtp
if ($sockname) {
sockread %~smtp.sr
if ($sockbr) {
if (%~smtp.sr != $null) { _mail.smtpsr %~smtp.sr }
goto smtp
}
}
unset %~smtp.sr
}
ON *:SOCKWRITE:POP3*:{
if ($sockerr) { error.a POP3 Session: $_sockerr }
}
ON *:SOCKREAD:POP3*:{
if ($sockerr) {
error.a POP3 Session: $_sockerr
return
}
:pop3
if ($sockname) {
var %sr
sockread %sr
if ($sockbr) {
if (%sr == $null) { %sr = $chr(160) }
_mail.pop3sr %sr
goto pop3
}
}
}
ON *:SOCKOPEN:POP3*:{
if ($sockerr) {
error.a POP3 Session: $_sockerr
if ($_sockmark(7)) && ($window($_mail.mailvent)) { titlebar $_mail.mailvent }
return
}
if ($_sockmark(7)) { titlebar $_mail.mailvent $_sockmark(3) in $_sockmark(1) - Logging... }
sockwrite -n $sockname USER $_sockmark(3)
if ($_sockmark(4)) { sockwrite -n $sockname PASS $_sockmark(4) }
else { _timeremote _mail.pop3login $sockname $_sockmark(3) $_sockmark(1) }
}
ON *:SOCKCLOSE:POP3*:{
if ($window($_mail.mailvent)) { titlebar $_mail.mailvent }
}
menu @e-Mail POP3 {
dclick {
if (($mouse.lb) && ($sline($active,1) != $null)) { _mail.swp RETR $gettok($sline($active,1),1,9) }
}
$_window.ciright(&read [ $gettok($sline($active,1),1,9) ] ):{ _mail.swp RETR $gettok($sline($active,1),1,9) }
$_mail.m.chmail.responder:{
unset %~reply.*
%~reply.l = 1
:reply
inc %~reply.l
%~reply.c = $strip($line($active,%~reply.l))
if (*: iswm $gettok(%~reply.c,1,32)) {
if ($gettok(%~reply.c,1,32) == FROM:) {
if ($gettok(%~reply.c,3,32) != $null) { %~reply.a2 = $_mail.mailsep($gettok(%~reply.c,2-,32)) }
else { %~reply.a2 = $gettok(%~reply.c,2,32) }
}
elseif ($gettok(%~reply.c,1,32) == REPLYÂ TO:) {
if ($gettok(%~reply.c,3,32) != $null) { %~reply.a1 = $_mail.mailsep($gettok(%~reply.c,2-,32)) }
else { %~reply.a1 = $gettok(%~reply.c,2,32) }
}
elseif ($gettok(%~reply.c,1,32) == SUBJECT:) { %~reply.s = Re: $gettok(%~reply.c,2-,32) }
goto reply
}
%~reply.a = $iif(%~reply.a1,%~reply.a1,%~reply.a2)
mail %~reply.a %~reply.s
unset %~reply.*
}
$_window.ciright(&delete...):{
if ($sline($active,0) == $null) { return }
elseif ($sline($active,0) == 1) { %~pop3.m = Delete selected message? }
else { %~pop3.m = Delete $sline($active,0) selected messages? }
if ($_yesno(0,$null,0,%~pop3.m)) {
:borrar
inc %~pop3.b
if ($sline($active,%~pop3.b)) {
_mail.swp DELE $gettok($sline($active,%~pop3.b),1,9)
goto borrar
}
}
unset %~pop3.*
}
$iif(@Reading* !iswm $active,re&fresh):{
clear $active
clear -l $active
sockmark POP3 $+ $_mail.mailnum $puttok($sock(POP3 [ $+ [ $_mail.mailnum ] ] ).mark,STAT,5,9)
_mail.swp STAT
}
$iif(@Reading* !iswm $active,&disconnect):{
var %m = $menu
_window.size.save %m
_window.font.save %m
_window.onclose %m $active
}
}
dialog ADDRBOOK {
size -1 -1 150 75
title "Enter email and name [optional]"
option dbu
text "&e-mail",3,5 5 23 8
edit "",4,5 15 140 11,autohs
text "&name",5,5 30 20 8
edit "",6,5 40 140 11,autohs
button "&OK",1,85 55 28 15,ok disable
button "&Cancel",2,118 55 28 15,cancel
icon 249,5 55 15 15,etc\aIRC.ico
}
dialog SMTP {
size -1 -1 250 170
option dbu
button "&Send",1,185 150 28 15
button "&Close",2,218 150 28 15,cancel
text "&Address:",3,5 8 20 8
edit "",4,30 5 95 11,autohs
text "&Name:",5,128 8 20 8
edit "",6,150 5 95 11,autohs
text "&Subject:",7,5 20 20 8
edit "",8,30 18 215 11,autohs
text "CC:",9,5 33 20 8
edit "",10,30 30 215 11,autohs
button "&Import",11,95 45 28 10
button "Save",12,128 45 28 10
edit "",13,5 60 240 85,multi return vsbar hsbar
text "Name:",14,130 53 30 8,hide
edit "",15,153 50 90 11,hide autohs
text "E-Mail:",16,130 68 30 8,hide
edit "",17,153 65 90 11,hide autohs
text "Server:",18,130 83 30 8,hide
edit "",19,153 80 90 11,hide autohs
list 20,8 53 113 80,hide
button "New:",21,18 130 28 13,hide
button "Delete:",22,50 130 28 13,hide
button "Apply:",23,83 130 28 13,hide
box "Address Book:",24,5 43 118 103,hide
box "Your settings",25,128 43 118 103,hide
text "Reply-to:",26,130 98 30 8,hide
edit "",27,153 95 90 11,hide autohs
combo 248,25 153 30 999,drop
icon 249,5 150 15 15,etc\aIRC.ico
text "",250,60 150 120 15
}
ON *:DIALOG:SMTP*:*:*:{
unset %~tsmtpt.*
if ($devent == init) {
_mdx.init $_icofile(mailconf.ico,$scriptdir)
did -a $dname 248 Mail
did -a $dname 248 Extra
did -c $dname 248 1
:smtpi
inc %~tsmtpt.i
if ($_list.get(addrbook,%~tsmtpt.i) != $null) {
if ($gettok($ifmatch,2-,32)) { did -a $dname 20 $ifmatch < $+ $gettok($_list.get(addrbook,%~tsmtpt.i),1,32) $+ > }
else { did -a $dname 20 $_list.get(addrbook,%~tsmtpt.i) }
goto smtpi
}
}
if ($devent == dclick) && ($did == 20) {
if ($numtok($did($dname,20,$did($dname,20,1).sel).text,32) > 1) {
did -o $dname 4 1 $_mail.mailsep(2,$did($dname,20,$did($dname,20,1).sel).text)
did -o $dname 6 1 $_mail.mailsep(1,$did($dname,20,$did($dname,20,1).sel).text)
}
else {
did -o $dname 4 1 $did($dname,20,$did($dname,20,1).sel).text
did -r $dname 6
}
}
if ($devent == sclick) {
if ($did == 1) {
if ($did($dname,4).text == $null) { did -o $dname 250 1 ERROR: Destiny email missing }
elseif ($did($dname,17).text == $null) { did -o $dname 250 1 ERROR: Set up your email address }
elseif ($did($dname,19).text == $null) { did -o $dname 250 1 ERROR: You must set up a SMTP server }
elseif ($_ismail($did($dname,4).text) == $null) { did -o $dname 250 1 ERROR: invalid email address $did($dname,4).text }
elseif ($_ismail($did($dname,17).text) == $null) { did -o $dname 250 1 ERROR: invalid email address $did($dname,17).text }
else {
sockclose $dname
sockopen $dname $did($dname,19).text 25
sockmark $dname $did($dname,19).text $+ $chr(9) $+ $dname $+ $chr(9) $+ $did($dname,17).text $+ $chr(9) $+ $did($dname,4).text $+ $chr(9) $+ $$iif(did($dname,8).text,$did($dname,8).text,0) $+ $chr(9) $+ 0 $+ $chr(9) $+ $iif($did($dname,15).text,$did($dname,15).text,0) $+ $chr(9) $+ $iif($did($dname,6).text,$did($dname,6).text,0) $+ $chr(9) $+ 0 $+ $chr(9) $+ $iif($did($dname,10).text,$did($dname,10).text,0) $+ $chr(9) $+ $iif($did($dname,27).text,$did($dname,27).text,0)
did -o $dname 250 1 $did($dname,19).text - Connecting...
}
}
if ($did == 11) { _timeremote _mail.import $dname }
if ($did == 12) { _timeremote _mail.save $dname }
if ($did == 21) { _timeremote _mail.addrbook }
if ($did == 22) { _mail.addrbookborra $did($dname,20,$did($dname,20,1).sel).text }
if ($did == 23) {
if ($numtok($did($dname,20,$did($dname,20,1).sel).text,32) > 1) {
did -o $dname 4 1 $_mail.mailsep(2,$did($dname,20,$did($dname,20,1).sel).text)
did -o $dname 6 1 $_mail.mailsep(1,$did($dname,20,$did($dname,20,1).sel).text)
}
else {
did -o $dname 4 1 $did($dname,20,$did($dname,20,1).sel).text
did -r $dname 6
}
did -f $dname 23
}
if ($did == 248) {
if ($did($dname,248).sel == 1) { _mail.smtpA 1 $dname }
else { _mail.smtpA 2 $dname }
}
}
unset %~tsmtpt.*
}
dialog cuentamail {
size -1 -1 200 177
option dbu
box "",10,-45 18 9999 138
text "&Account:",1,10 8 40 8,right
edit "",2,55 6 85 11,autohs result
box "SMTP",51,5 25 140 65
text "SMTP Server",101,10 38 40 8,right
edit "",102,55 36 85 11,autohs
text "E-Mail",111,10 50 40 8,right
edit "",112,55 48 85 11,autohs
text "Reply-to",121,10 63 40 8,right
edit "",122,55 61 85 11,autohs
text "Name",131,10 75 40 8,right
edit "",132,55 73 85 11,autohs
box "POP3",52,5 95 140 53
text "POP3 Server",141,10 108 40 8,right
edit "",142,55 106 85 11,autohs
text "login",151,10 120 40 8,right
edit "",152,55 118 85 11,autohs
text "Password",161,10 133 40 8,right
edit "",162,55 131 85 11,autohs pass
button "Send Mail",200,150 29 45 20
button "Check Mail",201,150 78 45 20
button "No headers",202,150 103 45 20
button "Verify",203,150 127 45 20
button "&OK",243,60 160 33 15,ok disable
button "&Cancel",244,108 160 33 15,cancel
text "0",248,1 1 1 1,hide
text "0",249,1 1 1 1,hide
text "",250,1 1 1 1,hide
}
ON *:DIALOG:cuentamail:init:0:{
_mdx.init $_icofile(mailconf.ico,$scriptdir)
dialog -t $dname email account
if (%~mpregcuenta.p != $null) {
:init1
inc %~mpregcuenta.1
if ($_list.get(cuentasmail,%~mpregcuenta.1)) {
%~mpregcuenta.c = $ifmatch
if ($gettok(%~mpregcuenta.c,1,176) == %~mpregcuenta.p) {
did -o $dname 250 1 %~mpregcuenta.1
did -a $dname 2 %~mpregcuenta.p
if ($gettok(%~mpregcuenta.c,2,176)) { did -a $dname 102 $ifmatch }
if ($gettok(%~mpregcuenta.c,3,176)) { did -a $dname 112 $ifmatch }
if ($gettok(%~mpregcuenta.c,4,176)) { did -a $dname 122 $ifmatch }
if ($gettok(%~mpregcuenta.c,5,176)) { did -a $dname 132 $ifmatch }
if ($gettok(%~mpregcuenta.c,6,176)) { did -a $dname 142 $ifmatch }
if ($gettok(%~mpregcuenta.c,7,176)) { did -a $dname 152 $ifmatch }
if ($gettok(%~mpregcuenta.c,8,176)) { did -a $dname 162 $_decrypt($ifmatch) }
did -e $dname 243
did -o $dname 249 1 1
did -m $dname 2
goto yatainit
}
goto init1
}
}
:yatainit
_mail.cuenta.revisaedit
}
ON *:DIALOG:cuentamail:edit:*:{ _mail.cuenta.revisaedit }
ON *:DIALOG:cuentamail:sclick:243:{
if ($did(249)) && ($did(2)) { _mail.cuenta.graba }
}
ON *:DIALOG:cuentamail:sclick:244:{ _dialog.loadlist mailconf 2 1 176 cuentasmail 1 1 }
ON *:DIALOG:cuentamail:sclick:*:{
if ($istok(200 201 202 203,$did,32)) {
_mail.cuenta.graba
if ($did == 200) { _timeremote mail $did(250) }
elseif ($did == 201) { _timeremote chmail $did(250) }
elseif ($did == 202) { _timeremote chmail -min $did(250) }
elseif ($did == 203) { _timeremote chmail -ver $did(250) }
dialog -x $dname
}
}
ON *:DIALOG:ADDRBOOK*:init:0:{ _mdx.init $_icofile(mailconf.ico,$scriptdir) }
ON *:DIALOG:ADDRBOOK*:edit:4:{
if ($_ismail($did($dname,4).text) != $null) { did -e $dname 1 }
else { did -b $dname 1 }
did -f $dname 4
}
ON *:DIALOG:ADDRBOOK*:sclick:1:{
if ($_ismail($did($dname,4).text) != $null) { _mail.addrbookmete $did($dname,4).text $did($dname,6).text }
else { halt }
}
ON *:DIALOG:mailconf:init:0:{
_mdx.init $_icofile(mailconf.ico,$scriptdir)
_dialog.loadlist mailconf 2 1 176 cuentasmail 1 1
did -h $dname 201
did -o $dname 202 1 Close
dialog -t $dname email accounts
did -h $dname 1
did -v $dname 2
did -o $dname 101 1 &New...
did -ov $dname 103 1 &Edit...
did -ov $dname 104 1 &Up
did -ov $dname 105 1 &Down
did -f $dname 201
}
ON *:DIALOG:mailconf:dclick:2:{
if ($did($dname,2,1).sel != $null) { _timeremote _mail.preguntacuenta $did($dname,2,1).sel $did($dname,2,$did($dname,2,1).sel).text }
}
ON *:DIALOG:mailconf:sclick:*:{
set -u %~mailconf.sclick $did($dname,2,1).sel
if ($did == 101) { _timeremote _mail.preguntacuenta }
elseif ($did == 102) && (%~mailconf.sclick != $null) {
_list.tokdel cuentasmail 1 176 $gettok($did($dname,2,%~mailconf.sclick).text,2-,32)
_dialog.loadlist mailconf 2 1 176 cuentasmail 1 1
if ($did(2,%~mailconf.sclick) != $null) { did -c $dname 2 %~mailconf.sclick }
}
elseif ($did == 104) && (%~mailconf.sclick != $null) && (%~mailconf.sclick > 1) {
_list.moveup cuentasmail %~mailconf.sclick
_dialog.loadlist mailconf 2 1 176 cuentasmail 1 1
did -c $dname 2 $calc(%~mailconf.sclick - 1)
}
elseif ($did == 105) && (%~mailconf.sclick != $null) && (%~mailconf.sclick < $did($dname,2,1).lines) {
_list.movedown cuentasmail %~mailconf.sclick
_dialog.loadlist mailconf 2 1 176 cuentasmail 1 1
did -c $dname 2 $calc(%~mailconf.sclick + 1)
}
elseif ($did == 103) {
if (%~mailconf.sclick != $null) { _timeremote _mail.preguntacuenta %~mailconf.sclick $did($dname,2,%~mailconf.sclick).text }
}
elseif ($did == 201) || ($did == 202) { showmirc -s }
}
alias _onclosewin.e-Mail POP3 {
if (@e-Mail POP3* iswm $2) {
info.a Closing POP3 session $mailnum($2)
if ($sock($mailnump($2))) { _timeremote sockclose $mailnump($2) }
}
}
alias _windowsize.e-Mail POP3 { return X Y 562 249 }
alias _windowopts.e-Mail POP3 { return 0 1 1 }