[defname mail]
mailbox Mail
postage 30
packagedelay 3600 //determines how long it takes a message with an item attached to it to be mailed
[events e_mailalert]
on=@login
db.connect
DB.QUERY SELECT * FROM <def.Mailbox> WHERE uid='<uid>'
if <db.ROW.NUMROWS>>0
maileffectint
else
mailalert 0
endif
db.close
[itemdef i_mailbox]
id=3648
name=Mail Box
on=@dclick
src.events +e_mailalert
src.ctag.attached
src.dialogclose d_mail
src.dialogclose d_mail_send
src.DIALOGclose d_mail_open
src.dialogclose d_mail_tutorial
src.dialogclose d_mail_conf
//if <src.account.tag0.mailtutcomplete>=0
// src.dialog d_mail_tutorial
// return 1
//endif
src.dialog d_mail
region.events +r_mail
src.events +e_mail
return 1
[regiontype r_mail]
on=@step
src.dialogclose d_mail
on=@exit
src.dialogclose d_mail
[events e_mail]
on=@spellcast
dialogclose d_mail
events -e_mail
[itemdef i_move_check]
id=5355
type=t_script
layer=30
name=distance checker
on=@step
timer=1
on=@timer
try uid.<link.uid>.mailalert 1
remove
timer=1
return 1
[function mailalert]
dialogclose d_mail_alert
if <argv>=0
ctag0.newmail
ctag0.newmail
ctag0.mailframe
ctag0.mailflash
elif <argv0>=0
ctag0.newmail
ctag0.mailframe
ctag0.mailflash
elif <argv0>=1
if <ctag0.newmail>=0
mailalerteffect
endif
endif
dialog d_mail_alert
on=0
mailalert
[function maileffectint]
if <ctag0.newmail>=0
mailalerteffect
ctag0.newmail=1
endif
return 1
[function mailalerteffect]
ctag0.mailframe
ctag0.mailflash
newitem i_mail_effect
act.p=<p>
act.timerd=1
act.link=<uid>
[itemdef i_mail_effect]
id=i_hourglass
name=Maileffect
type=t_script
on=@create
attr=0b2
on=@timer
if <link.ctag0.newmail>=0
link.events +e_newmail
link.spelleffect 1,1000,<link.uid>
link.ctag0.mailframe
link.ctag0.mailflash
remove
return 1
endif
if <link.ctag0.mailframe>=0
link.ctag0.mailsend=1
link.ctag0.mailframe=32
elif <link.ctag0.mailframe><135
link.ctag0.mailflash=1
link.ctag0.mailframe=<eval <link.ctag0.mailframe>+5>
link.events +e_newmail
link.spelleffect 1,1000,<link.uid>
elif <tag0.count><20
tag0.count=<eval <tag0.count>+1>
doswitch <link.ctag0.mailflash>
link.ctag0.mailflash=1
link.ctag0.mailflash=0
enddo
link.events +e_newmail
link.spelleffect 1,1000,<link.uid>
elif <tag0.count>=20
tag0.count=<eval <tag0.count>+1>
link.events +e_newmail
link.spelleffect 1,1000,<link.uid>
timer=5
return 1
else
link.ctag0.mailframe
link.ctag0.mailflash
link.events +e_newmail
link.spelleffect 1,1000,<link.uid>
remove
return 1
endif
timerd=2
return 1
[dialog d_mail_alert]
-108, 50
nomove
noclose
page 0
if <ctag0.newmail>=0
gumppic 108 0 4001
else
if <ctag0.mailframe>!=0
if 0<ctag0.mailflash>=1
gumppic <ctag0.mailframe> 0 2445
dtext <eval <ctag0.mailframe>+5> 2 <eval 0481> You've Got Mail!
endif
endif
gumppic 108 0 4000
endif
[events e_newmail]
on=@spelleffect
if (0<ctag0.mailsend>=1)&&(<src.uid>=<uid>)
mailalert 1, <ctag0.mailframe>
events -e_newmail
endif
[function isdec]
local.i=<args>
if (<isnum <args>>)&&(strcmpi("<local.i>", "<args>")
return 1
endif
return 0
[function itemtest]
if <isitem>
src.ctag0.item=<itemtostring>
remove
else
additem <STREAT <ctag0.item>>
act.bounce
endif
[function return_tags]
if <argv>=0
if <tagcount>!=0
for i 0 <eval <tagcount>-1>
if <local.i>=0
local.out tag.<tagat.0.value> <tagat.0.key>
else
local.out tag.<tagat.<local.i>.value> <tagat.<local.i>.key>, <local.out>
endif
endif
endif
return <local.out>
endif
return tag.<tagat.<argv0>.value> <tagat.<argv0>.key>
[function itemtostring]
if strlen(<events>)=0
return BASEID <BASEID>, NAME <NAME>, TYPE <TYPE>, MORE1 <MORE1>, MORE2 <MORE2>, AMOUNT <AMOUNT>, MOREX <MOREX>, MOREY <MOREY>, MOREZ <MOREZ>, MOREM <MOREM>, COLOR <COLOR>, LAYER <LAYER>, ATTR <ATTR>, DISPID <DISPID>, <RETURN_TAGS>
endif
return BASEID <BASEID>, NAME <NAME>, TYPE <TYPE>, MORE1 <MORE1>, MORE2 <MORE2>, AMOUNT <AMOUNT>, MOREX <MOREX>, MOREY <MOREY>, MOREZ <MOREZ>, MOREM <MOREM>, COLOR <COLOR>, LAYER <LAYER>, ATTR <ATTR>, DISPID <DISPID>, <RETURN_TAGS>, events +<events>
[function additem]
newitem <argv0>
for i 1 <eval <argv>-1>
if !<isnum.<argv<eval <local.i>>>>
try new.<argv<eval <local.i>>>
endif
endfor
[function newmail]
db.connect
if (<DB.CONNECTED>)&&(<account.plevel>>1)
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>>0
DB.QUERY SELECT * FROM <def.mailbox> WHERE uid='<uid>'
else
DB.EXECUTE "create table <def.mailbox>(uid varchar(30) not null primary key, message varchar(10000) not null );"
newmail <args>
endif
db.close
endif
[DIALOG d_mail_send]
100,50
PAGE 0
dorigin 0, 50
resizepic 50 0 5054 353 52
resizepic 25 10 5054 28 342
gumppictiled 30 14 16 312 10153
gumppic 30 324 10154
resizepic 20 346 5054 200 52
resizepic 50 10 3600 353 379
checkertrans 63 50 324 323
resizepic 50 42 3600 353 82
checkertrans 63 66 326 46
resizepic 50 10 3600 353 42
checkertrans 63 24 326 16
dtext 95 60 152 To:
gumppic 116 55 1143
checkertrans 124 60 257 17
dtextentry 124 60 257 17 0 10 <ctag.argtxt10>//To
dtext 67 85 152 Subject:
gumppic 116 80 1143
checkertrans 124 85 257 17
dtextentry 124 85 257 17 0 11 <ctag.argtxt11>//Subject
dtext 87 20 152 Send Mail
resizepic 85 150 2620 275 134
gumppictiled 85 146 275 11 50
dtext 67 124 152 Body:
gumppictiled 90 154 265 120 <eval 09dc>
dtextentry 90 154 263 120 0 12 <ctag.argtxt12>//Body
gumppictiled 85 273 275 11 50
//gumppic 21 97 50
resizepic 361 0 5054 42 32
resizepic 91 363 5054 273 35
button 366 6 4017 4019 1 0 0//close
button 181 369 4011 4013 1 0 1//send
button 271 369 4005 4007 1 0 2//attach
//resizepic 161 289 3600 45 75
button 100 369 4008 4009 1 0 3//make copy
dtext 135 369 152 Copy
//resizepic 365 163 2620 65 202
if <ctag0.attached>!=0
resizepic 90 289 2620 75 75
gumppictiled 95 294 65 65 1124
checkertrans 95 294 65 65
tilepichue 95 304 <serv.uid.<ctag0.attached>.dispiddec> <eval <serv.uid.<ctag0.attached>.color>>
dtext 90 284 152 Attached
endif
dtext 185 299 152 Send Gold:
resizepic 185 319 2620 175 30
gumppictiled 190 324 165 20 1124
checkertrans 190 324 165 20
dtextentry 190 324 165 20 0 13 <eval <ctag0.argtxt13>>//gold
//resizepic 185 319 2620 175 30
dtext 221 369 152 Send
dtext 311 369 152 Attach
//gumppic 50 7 10152
gumppic 0 0 1417
gumppic 25 20 4001
//clear the ctags
for i 0 <ctag0.argtxt>
try ctag.argtxt<eval <local.i>+10>
endfor
ctag0.argtxt
[DIALOG d_mail_send BUTTON]
on=0
ctag0.attached
DIALOG d_mail
on=1
ctag0.query
ctag0.argtxt=<eval <argtxt>-1>
for i 0 <ctag0.argtxt>
try ctag.argtxt<eval <local.i>+10> <argtxt[<eval <local.i>+10>]>
endfor
if strlen(<argtxt[10]>)=0
dialog d_mail_send
Sysmessage @027 Cannot send letter to non-exsistant mail box.
return 1
endif
if strcmpi('<argtxt[10]>', '<name>')=0
tag.argtxt10
dialog d_mail_send
Sysmessage @027 Sending a message to your self would be silly.
return 1
endif
if strlen(<argtxt[11]>)=0
dialog d_mail_send
Sysmessage @027 Your subject line is empty
return 1
endif
if (0<serv.uid.<ctag0.attached>.uid>=0)&&(strlen(<argtxt[12]>)=0)
dialog d_mail_send
Sysmessage @027 You cannot send an empty message.
return 1
endif
if (!<isdec <argtxt[13]>>)
dialog d_mail_send
ctag0.argtxt13=0
Sysmessage @027 You cannot send that amount of gold.
return 1
endif
if (<eval <argtxt[13]>+<def.postage>><0 )&&(!<ISGM>)
dialog d_mail_send
Sysmessage @027 You cannot send that amount of gold.
return 1
endif
if (!<restest <eval <argtxt[13]>+30> i_gold>)&&(!<ISGM>)
dialog d_mail_send
Sysmessage @027 You don't have enough gold to send this message.
return 1
elif (!<restest <argtxt[13]> i_gold>)&&(<ISGM>)
dialog d_mail_send
Sysmessage @027 You cannot send money you don't have... (hint: type ".newgold <argtxt[13]>" first).
return 1
endif
db.connect
if <DB.Connected>
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
if <findname <argtxt[10]>>=0
dialog d_mail_send
Sysmessage @027 The send to doesn't exsist.
return 1
endif
if !<isgm>
consume <eval <argtxt[13]>+<def.postage>> i_gold
endif
local.uid=<db.row.0.uid>
if (<ctag0.attached>!=0)&&(<def.packagedelay>>0)
local.item=<serv.uid.<ctag0.attached>.itemtostring>
endif
local.query=INSERT INTO <def.mailbox> VALUES ('', '<local.uid>', '<name>', '<addslashes <argtxt[11]>>', '<addslashes <argtxt[12]>>', <argtxt[13]>, '<local.item>', '')
if (<ctag0.attached>!=0)&&(<def.packagedelay>>0)
newitem i_mail_delay
act.tag.message=<local.query>
act.cont=<local.uid>
act.timer=<def.packagedelay>
else
DB.EXECUTE <local.query>
serv.uid.<local.uid>.maileffectint
endif
//DB.EXECUTE <local.query>
try serv.uid.<ctag0.attached>.remove
ctag0.attached
endif
db.close
for i 0 <ctag0.argtxt>
try ctag.argtxt<eval <local.i>+10>
endfor
ctag0.argtxt
DIALOG d_mail
on=2
ctag0.argtxt=<eval <argtxt>-1>
for i 0 <ctag0.argtxt>
try ctag.argtxt<eval <local.i>+10> <argtxt[<eval <local.i>+10>]>
endfor
targetf attach
//dialog d_mail_send
[function matchargs]
return <argv<eval <argv0>>>
[comment send_mail_errors]
00=success
01=couldn't connect to mysql
02=couldn't create table
04=Invalid User name
08=Invalid Attachment UID
010=Invaild gold amount
020=No subject
040=Empty Message
080=Invalid Delay Time
[function send_mail]
local.error=0
//errors 01=
db.connect
if !<DB.Connected>
local.error=<eval <local.error>+01
else
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
local.error=<eval <local.error>+02
endif
endif
for i 0 <argv> //find the message and the subject
if <local.type>=1
if strlen(<local.<local.local>>)==1
try local.<local.local> <local.<local.local>><argv<eval <local.i>>>
else
try local.<local.local> <local.<local.local>>, <argv<eval <local.i>>>
endif
endif
local.matches=message, subject, to, from, item, gold, delay
for x 1 7
local.check=<matchargs <local.i>, <local.matches>>
if strcmpi("<local.check>","<argv<eval <local.i>>>")
local.local=s<local.check>
endif
endfor
endfor
local.matches=to, from, item, gold, delay
for x 1 5
try local.<matchargs <local.i>, <local.matches>> <strsub 0 strlen(<local.<matchargs <local.i>, <local.matches>>>) <local.<matchargs <local.i>, <local.matches>>>>
endfor
findname <addslashes <strsub 1 strlen(<local.to>)>>
local.uid=<db.row.0.uid>
if 0<serv.uid.<local.to>.uid>=0 //user doesn' exsist
local.error=<eval <local.error>+04>
endif
if !<isnum <local.item>>
local.error=<eval <local.error>+08>
elif <local.item>=0
elif <serv.uid.<local.item>.uid>=0
local.error=<eval <local.error>+08>
elif <serv.uid.<local.item>.ischar>
local.error=<eval <local.error>+08>
endif
if !<isnum <local.gold>>
local.error=<eval <local.error>+010>
endif
if <eval strlen(<local.subject>)><1
local.error=<eval <local.error>+020>
endif
if (<eval strlen(<local.message>)><1)
if (<hval <local.error>>&04)&&(<hval <local.error>>&08)
local.error=<eval <local.error>+040>
elif (<hval <local.error>>&08)
if !<serv.uid.<local.item>.isitem>
local.error=<eval <local.error>+040>
endif
elif (<hval <local.error>>&04)
if <local.gold><1
local.error=<eval <local.error>+040>
endif
elif (!<serv.uid.<local.item>.isitem>)&&(<local.gold><1)
local.error=<eval <local.error>+040>
endif
endif
if !<isnum <local.delay>>
local.error=<eval <local.error>+080 >
endif
if <local.error>!=0
return <local.error>
endif
[comment]
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
endif
if <findname <local.to>>=0 //the name doesn't exsist, don't send the message.
return 2 //couldn't find recipriant
else
local.uid=<db.row.0.uid>
if (0<serv.uid.<argv1>.uid>!=0)&&(<def.packagedelay>>0)
local.item=<serv.uid.<argv1>.itemtostring>
endif
local.subject=s
local.query=INSERT INTO <def.mailbox> VALUES ('', '<local.uid>', '<local.from>', '<addslashes <local.subject>>', '<addslashes <local.message>', <local.gold>, '<local.item>', '')
if (<ctag0.attached>!=0)&&(<def.packagedelay>>0)
newitem i_mail_delay
else
DB.EXECUTE <local.query>
serv.uid.<local.uid>.mailalert 1
endif
try serv.uid.<ctag0.attached>.remove
ctag0.attached
endif
db.close
return 1 //successfull send
[function attach]
if !<argo.isitem>
dialog d_mail_send
sysmessage @027 You can't attach that a.
return 1
elif <argo.topobj.uid>!=<uid>
dialog d_mail_send
sysmessage @027 That is not yours.
return 1
elif (<argo.type>=t_figurine)
dialog d_mail_send
sysmessage @027 You can't attach thatb.
return 1
elif (0<def.newbietrade>=0)&&(<argo.attr>&04)
dialog d_mail_send
sysmessage @027 That is soul bound, and cannot be traded.
return 1
endif
if strlen(<ctag.argtxt11>)<2
if <argo.amount>=1
ctag0.argtxt11=<argo.name>
else
ctag0.argtxt11=<argo.amount> <argo.name>
endif
endif
ctag0.attached=<argo.uid>
dialog d_mail_send
return 1
[itemdef i_mail_delay]
id=02007
type=t_eq_script
name=Mail Delay
on=@timer
db.connect
DB.EXECUTE <tag.message>
db.close
cont.maileffectint
remove
return 1
[DIALOG d_mail]
100,50
PAGE 0
dorigin 0, 50
db.connect
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
DB.QUERY SELECT * FROM <def.Mailbox> WHERE uid='<uid>'
db.close
for i 0 3
if <eval (<ctag0.page>*3)+<local.i>><<db.ROW.NUMROWS>
for b 0 3
button <eval 70+<local.b>*80> <eval 79+(75*<local.i>)> 45 46 1 0 <eval <local.i>+2>
button <eval 70+<local.b>*80> <eval 119+(75*<local.i>)> 45 46 1 0 <eval <local.i>+2>
endfor
endif
endfor
resizepic 50 0 5054 353 52
resizepic 25 10 5054 28 362
gumppictiled 30 34 16 312 10153
gumppic 30 344 10154
resizepic 20 366 5054 200 52
resizepic 50 10 3600 353 399
checkertrans 63 50 324 343
resizepic 50 10 3600 353 42
checkertrans 63 24 326 16
resizepic 361 0 5054 42 32
dtext 90 22 152 <src.name>'s Mail Box
resizepic 91 383 5054 273 35
button 366 6 4017 4019 1 0 0//close
button 100 389 4008 4009 1 0 1//create Message
dtext 135 389 152 Create Message
if <ctag0.page>>0
button 65 58 2468 2467 1 0 6//previous
if ((1+<ctag0.page>)*3)<<db.ROW.NUMROWS>
button 151 58 2471 2470 1 0 7////next
endif
else
if ((1+<ctag0.page>)*3)<<db.ROW.NUMROWS>
button 65 58 2471 2470 1 0 7////next
endif
endif
//icon
gumppic 0 0 1417
if <ctag0.newmail>=0
gumppic 25 20 4001
else
gumppic 25 20 4000
endif
//clear the ctags
for i 0 <ctag0.argtxt>
try ctag.argtxt<eval <local.i>+10>
endfor
ctag0.argtxt
for i 0 3
if <eval (<ctag0.page>*3)+<local.i>><<db.ROW.NUMROWS>
try ctag0.mail<eval <local.i>> <db.row.<eval (<ctag0.page>*3)+<local.i>>.id>
if strlen(<db.row.<eval (<ctag0.page>*3)+<local.i>>.attachment>)>1
resizepic 70 <eval 79+(75*<local.i>)> 2620 75 75
gumppictiled 75 <eval 84+(75*<local.i>)> 65 65 1124
checkertrans 75 <eval 84+(75*<local.i>)> 65 65
tilepichue 75 <eval 84+(75*<local.i>)> <eval <serv.itemdef.<streat <maildispid <db.row.<eval (<ctag0.page>*3)+<local.i>>.attachment>>>.id>> <eval <streat <mailcolor <db.row.<eval (<ctag0.page>*3)+<local.i>>.attachment>>>>
dtext 70 <eval 74+(75*<local.i>)> 152 <streat <mailname <db.row.<eval (<ctag0.page>*3)+<local.i>>.attachment>>>
endif
dhtmlgump 160 <eval 79+(75*<local.i>)> 227 70 0 0 <def.bfont_white>From: <db.row.<eval (<ctag0.page>*3)+<local.i>>.sender><def.br>Subject: <db.row.<eval (<ctag0.page>*3)+<local.i>>.subject>
endif
endfor
[DIALOG d_mail button]
on=1
DIALOG d_mail_send
on=2
db.connect
DB.execute UPDATE <def.mailbox> SET opened = '1' WHERE id = <eval <ctag0.mail0>>
DB.QUERY SELECT * FROM <def.mailbox> WHERE opened!=1
if <db.ROW.NUMROWS>=0
mailalert 0
endif
db.close
ctag0.mailid=<ctag0.mail0>
dialog d_mail_open
on=3
db.connect
DB.execute UPDATE <def.mailbox> SET opened = 1 WHERE id = <eval <ctag0.mail1>>
DB.QUERY SELECT * FROM <def.mailbox> WHERE opened!=1
if <db.ROW.NUMROWS>=0
mailalert 0
endif
db.close
ctag0.mailid=<ctag0.mail1>
dialog d_mail_open
on=4
db.connect
DB.execute UPDATE <def.mailbox> SET opened = 1 WHERE id = <eval <ctag0.mail2>>
DB.QUERY SELECT * FROM <def.mailbox> WHERE opened!=1
if <db.ROW.NUMROWS>=0
mailalert 0
endif
db.close
ctag0.mailid=<ctag0.mail2>
dialog d_mail_open
on=5
db.connect
DB.execute UPDATE <def.mailbox> SET opened = 1 WHERE id = <eval <ctag0.mail3>>
DB.QUERY SELECT * FROM <def.mailbox> WHERE opened!=1
if <db.ROW.NUMROWS>=0
mailalert 0
endif
db.close
ctag0.mailid=<ctag0.mail3>
dialog d_mail_open
on=6
ctag.page=<eval 0<ctag0.page>-1>
dialog d_mail
on=7
ctag.page=<eval 0<ctag0.page>+1>
dialog d_mail
[function maildispid]
return <argv13>
[function mailcolor]
return <argv10>
[function mailname]
return <argv1>
[function mailtest]
return <streat <mail<args> <ctag0.item>>>
[DIALOG d_mail_conf]
100,50
PAGE 0
dorigin 0, 50
db.connect
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
DB.QUERY SELECT * FROM <def.mailbox> WHERE id=<eval <ctag0.mailid>>
db.close
resizepic 50 0 5054 353 52
resizepic 25 10 5054 28 162
gumppictiled 30 34 16 112 10153
gumppic 30 144 10154
resizepic 20 166 5054 52 52
resizepic 50 10 3600 353 199
checkertrans 63 50 324 343
if (<db.row.0.gold>>0)||(strlen(<db.row.0.attachment>)>1)
dhtmlgump 73 60 314 55 0 0 <def.big><def.bfont> color="#FF0000"<def.R1>WARNING: <def.bfont_white>This message still has something attached to it. Are you sure you wish to return this message to <db.row.0.sender>?
else
dhtmlgump 73 60 314 55 0 0 <def.big><def.bfont> color="#FF0000"<def.R1>WARNING: <def.bfont_white>This will delete the message. Do you wish to continute?
endif
resizepic 50 10 3600 353 42
checkertrans 63 24 326 16
button 150 130 1146 1145 1 0 0 //Cancel
button 230 130 1149 1148 1 0 1 //ok
dtext 90 22 152 <src.name>'s Letter
gumppic 0 0 1417
gumppic 25 20 4001
[DIALOG d_mail_conf button]
on=0
dialog d_mail_open
on=1
db.connect
DB.QUERY "SHOW TABLES like '<def.mailbox>'"
if <db.ROW.NUMROWS>=0
DB.EXECUTE "create table <def.mailbox> (id INT unsigned not null AUTO_INCREMENT primary key, uid varchar(30) not null, sender varchar(30) not null, subject varchar(30) not null, body TEXT not null, gold int unsigned not null, attachment TEXT not null, opened int(2) not null);"
endif
DB.QUERY SELECT * FROM <def.mailbox> WHERE id=<eval <ctag0.mailid>>
if (<db.row.0.gold>>0)||(strlen(<db.row.0.attachment>)>1)
local.from=<name>
local.subject=RTS:<db.row.0.subject>
DB.QUERY SELECT * FROM <def.nameserv> WHERE name='<db.row.<eval <local.d>>.sender>'
local.uid=<db.row.<eval <local.d>>.uid>
DB.QUERY SELECT * FROM <def.mailbox> WHERE id=<eval <ctag0.mailid>>
local.query UPDATE <def.mailbox> SET uid = '<db.row.<eval <local.d>>.uid>', sender='<name>', subject='<local.subject>' WHERE id = <eval <ctag0.mailid>>
if (strlen(<db.row.0.attachment>)>1)&&(<def.packagedelay>>0)
local.query=INSERT INTO <def.mailbox> VALUES ('', '<local.uid>', '<name>', '<local.subject>', '<db.row.0.message>', <db.row.0.gold>, '<db.row.0.attachment>', '')
DB.EXECUTE delete FROM <def.mailbox> WHERE id=<eval <ctag0.mailid>>
newitem i_mail_delay
act.tag.message=<local.query>
act.cont=<local.uid>
act.timer=<def.packagedelay>
else
DB.EXECUTE <local.query>
serv.uid.<local.uid>.maileffectint
endif
local.message You're message has been returned.
else
DB.EXECUTE delete FROM <def.mailbox> WHERE id=<eval <ctag0.mailid>>
local.message Your message has been deleted
endif
db.close
ctag0.attached
DIALOG d_mail
sysmessage <local.message>
[EOF]