atma/release/1.0-2002.10.17/atma-fserv.mrc

1256 lines
52 KiB
Text
Raw Normal View History

2021-06-24 14:05:10 +00:00
; Phoenix FileServer for mIRC 6.0+
; Atma version 1.0.20021017
; Programmed by Correl J. Roush
; correlr@phoenixinquis.net
; www.phoenixinquis.net
; __________________________
;/``````````````````````````
; Dialogs
dialog atma_config {
title $Atma
size -1 -1 247 129
option dbu
tab "Basic Config", 1, 2 1 244 116
box "Fserv Limits", 7, 5 17 116 56, tab 1
text "Users", 8, 15 38 18 8, tab 1
edit $Atma(maxUSends), 13, 36 36 20 10, tab 1 right
box "Ad Setup", 17, 124 17 119 56, tab 1
text "Show ad every", 18, 132 28 39 8, tab 1
edit $Atma(Interval), 19, 172 27 23 10, tab 1 right
radio "Minutes", 20, 196 23 33 10, tab 1
radio "Seconds", 21, 196 32 34 10, tab 1
check "Respond to !list", 22, 129 61 50 10, tab 1
box "Server Info", 23, 5 73 239 20, tab 1
edit $Atma(InfoLine), 24, 8 80 232 10, tab 1 autohs
check "Start file server on connect", 25, 11 100 79 10, tab 1
text "Sends", 10, 37 26 18 8, tab 1
text "Queues", 12, 60 26 20 8, tab 1
edit $Atma(MaxUQueues), 14, 59 36 20 10, tab 1 right
edit $Atma(maxTQueues), 16, 59 47 20 10, tab 1 right
edit $Atma(maxTSends), 15, 36 47 20 10, tab 1 right
text "Total", 9, 15 48 18 8, tab 1
box "", 29, 152 93 77 21, tab 1
check "Enable FileServer", 30, 155 99 71 12, tab 1 push
text "Sessions", 69, 83 26 23 8, tab 1
edit 1, 70, 82 36 20 10, tab 1 read right
edit $Atma(maxUsers), 68, 82 47 20 10, tab 1 right
check "Enable Channel Ads", 76, 128 45 59 10, tab 1 push
text "Queue using", 87, 15 61 33 8, tab 1
combo 88, 51 59 60 37, tab 1 size drop
button "Restart", 105, 193 45 30 11, disable tab 1
tab "Adv. Configuration", 2
check "FileServer Chat", 107, 8 19 50 10, tab 2
check "Channel Enforcer", 108, 8 29 55 10, tab 2
check "Respond to @find / @locator", 109, 8 39 87 10, tab 2
box "/dccallow Enforcer (DALNet Only)", 110, 128 17 115 37, tab 2
combo 111, 131 25 109 33, tab 2 size drop
box "Minimum CPS", 112, 128 55 115 34, tab 2
check "Drop sends that have been going below", 113, 131 64 106 10, tab 2
edit $Atma(MinCPS), 114, 139 75 24 10, tab 2 right
text "cps for", 115, 164 77 21 8, tab 2
edit $Atma(MinCPS.Secs), 116, 186 75 24 10, tab 2 right
text "seconds.", 117, 211 77 25 8, tab 2
box "Maximum CPS", 118, 128 90 115 25, tab 2
check "Limit sends to a max of", 119, 131 101 66 10, tab 2
edit $Atma(MaxCPS), 120, 197 101 24 10, tab 2 right
text "kb/s", 121, 222 103 18 8, tab 2
edit $Atma(@Find.Results), 129, 45 48 23 10, tab 2 right
text "Limited to", 130, 18 49 25 8, tab 2
text "results", 131, 69 49 19 8, tab 2
text "Tempban lasts for", 147, 135 40 47 8, tab 2
edit $Atma(DCCAllowEnforcer.TempBan), 148, 183 39 28 10, tab 2
text "seconds.", 149, 212 40 26 8, tab 2
check "Enable FServ find comand", 152, 8 58 81 10, tab 2
text "Limited to", 153, 18 68 25 8, tab 2
edit $Atma(fs_find.Results), 154, 45 67 23 10, tab 2 right
text "results", 155, 69 68 19 8, tab 2
tab "Statistics", 3
box "", 134, 5 17 238 98, tab 3
text "Leeched Files", 135, 34 39 41 8, tab 3
text "Leeched Bytes", 136, 34 48 41 8, tab 3
text "Record Speed", 137, 34 57 41 8, tab 3
text "Hits", 138, 34 66 41 7, tab 3
edit "", 146, 76 65 138 9, tab 3 read autohs right
edit "", 145, 76 56 138 9, tab 3 read autohs right
edit "", 144, 76 47 138 9, tab 3 read autohs right
edit "", 143, 76 38 138 9, tab 3 read autohs right
button "Reset", 139, 183 79 31 9, tab 3
tab "Triggers", 4
button "Rebuild Now", 128, 176 99 41 11, tab 4
box "QuickSearch Cache", 49, 73 90 171 25, tab 4
check "Rebuild on mIRC startup", 127, 81 100 73 10, tab 4
box "Trigger Style", 46, 5 90 66 25, tab 4
radio "CTCP", 48, 42 100 27 10, tab 4
radio "Normal", 47, 8 99 30 10, tab 4
box "Trigger Configuration", 33, 5 17 238 73, tab 4
box "Channel Setup", 35, 173 22 66 65, tab 4
check "All active channels", 39, 177 75 60 10, disable tab 4
button "Add", 37, 177 65 28 9, disable tab 4
button "Delete", 38, 208 65 28 9, disable tab 4
list 36, 176 29 60 35, disable tab 4 size
button "...", 45, 149 76 20 9, disable tab 4
button "...", 41, 149 55 20 9, disable tab 4
edit "", 43, 7 76 137 10, tab 4 read autohs
button "Edit File", 75, 75 67 28 9, disable tab 4
button "Unset", 74, 44 67 28 9, disable tab 4
text "MOTD File", 44, 8 67 33 8, tab 4
edit "", 40, 7 55 137 10, tab 4 read autohs
text "Root Directory", 42, 9 47 49 8, tab 4
button "Add", 71, 8 37 28 9, tab 4
button "Rename", 72, 39 37 28 9, disable tab 4
button "Delete", 73, 70 37 28 9, disable tab 4
check "This trigger is enabled", 34, 73 26 72 8, disable tab 4
combo 32, 8 25 60 42, tab 4 sort drop
tab "FServ Access", 77
list 100, 8 47 200 65, tab 77 sort size
box "Access Permissions", 98, 5 37 238 78, tab 77
button "Remove", 150, 214 73 23 11, tab 77
button "Edit", 102, 214 60 23 11, tab 77
button "Add", 101, 214 47 23 11, tab 77
box "", 104, 5 17 238 20, tab 77
radio "Denied Hosts", 133, 175 23 50 10, tab 77
radio "Allowed Hosts", 132, 116 23 50 10, tab 77
combo 103, 8 23 86 42, tab 77 size drop
tab "Ad Style", 151
box "Style Preview", 54, 5 17 238 20, tab 151
box FormatString, 56, 5 38 238 39, tab 151
text "Format Preset:", 58, 8 46 37 8, tab 151
combo 59, 50 45 90 52, tab 151 size drop
button "Save", 63, 152 45 25 9, tab 151
button "Delete", 64, 178 45 25 9, tab 151
button "Preview", 65, 204 45 25 9, tab 151
edit $Atma(FormatString), 57, 7 56 232 10, tab 151 autohs
check "Always strip color (automatically done on mode +c channels)", 60, 8 66 180 10, tab 151
edit The _/\tma FileServer includes the following variables for formatstring parsing: $crlf &Atma.Triggers &Atma.Users &Atma.Sends &Atma.Queues &Atma.InfoLine, 62, 6 80 235 26, tab 151 read multi
link "Click here for help on the formatstring parser", 55, 70 108 106 8, tab 151
text "Programmed by Correl J. Roush, 2002", 6, 1 122 93 8, disable
link "http://www.phoenixinquis.net/", 27, 169 122 77 8
button "okcancel", 66, 99 121 38 8, hide ok cancel
icon 106, 9 25 230 8
menu "&File", 122
item "E&xit", 123, 122, ok cancel
menu "&Help", 124
item "&Atma Help", 125, 124
item "&mIRC Fserv Help", 126, 124
}
on *:dialog:atma_config:init:0:{
did -c atma_config $iif($Atma(Interval.unit) == minutes,20,21)
$iif($Atma(RespondToList),did -c atma_config 22)
$iif($Atma(StartOnConnect),did -c atma_config 25)
$iif($Atma(Active),did -c atma_config 30)
$iif($Atma(FServChat),did -c atma_config 107)
$iif($Atma(ChannelEnforcer),did -c atma_config 108)
$iif($Atma(@Find),did -c atma_config 109)
$iif($Atma(fs_find),did -c atma_config 152)
didtok $dname 111 44 Notify and cancel send,Tempban/cancel all sends/clear queues
if ($Atma(DCCAllowEnforcer) == Notify) { did -c $dname 111 1 }
if ($Atma(DCCAllowEnforcer) == Ban) { did -c $dname 111 2 }
if ($Atma(MinCPS.Enabled)) {
did -c $dname 113
did -e $dname 114,116
}
if ($Atma(MaxCPS.Enabled)) {
did -c $dname 119
did -e $dname 120
}
updateStats
did -c atma_config $iif($Atma(TriggerType) == Normal,47,48)
$iif($Atma(QuickSearchRefreshOnStart),did -c atma_config 127)
Atma.cfgTriggers
did -c $dname 132
updateAccess
$iif($nickComp(stripcolor),did -c atma_config 60)
didtok $dname 88 44 Number Of Files,FileSize (MB)
did -c $dname 88 $iif($Atma(QueueUsing) == FileCount,1,2)
did $iif($Atma(Active),-b,-e) $dname 88
$iif($Atma(EnableAd),did -c $dname 76)
did $iif($Atma(EnableAd),-e,-b) $dname 105
did -h $dname 106
did -g $dname 106 $formatstr_preview
updateStyle
}
on *:dialog:atma_config:menu:125:Atma.Help
on *:dialog:atma_config:menu:126:help /fserve
on *:dialog:atma_config:sclick:1,2,3,4,77,151:{
did $iif($did == 151,-v,-h) $dname 106
}
on *:dialog:atma_config:edit:*:{
$iif($did == 13,Atma maxUSends $did($dname,$did))
$iif($did == 14,Atma maxUQueues $did($dname,$did))
$iif($did == 15,Atma maxTSends $did($dname,$did))
$iif($did == 16,Atma maxTQueues $did($dname,$did))
$iif($did == 19,Atma Interval $did($dname,$did))
$iif($did == 24,Atma InfoLine $did($dname,$did))
$iif($did == 51,Atma QuickSearchRefresh.Interval $did($dname,$did))
$iif($did == 57,Atma FormatString $did($dname,$did))
$iif($did == 68,Atma maxUsers $did($dname,$did))
$iif($did == 129,Atma @Find.Results $did($dname,$did))
$iif($did == 153,Atma fs_find.Results $did($dname,$did))
$iif($did == 114,Atma MinCPS $did($dname,$did))
$iif($did == 116,Atma MinCPS.Secs $did($dname,$did))
$iif($did == 120,Atma MaxCPS $did($dname,$did))
$iif($did == 148,Atma DCCAllowEnforcer.TempBan $did($dname,$did))
}
on *:dialog:atma_config:sclick:20:Atma Interval.Unit minutes
on *:dialog:atma_config:sclick:21:Atma Interval.Unit seconds
on *:dialog:atma_config:sclick:22:Atma RespondToList $did($dname,$did).state
on *:dialog:atma_config:sclick:25:Atma StartOnConnect $did($dname,$did).state
on *:dialog:atma_config:sclick:26:Atma ClearQueuesOnStart $did($dname,$did).state
on *:dialog:atma_config:sclick:76:{
Atma EnableAd $did($dname,$did).state
$iif($Atma(EnableAd) && $Atma(Active),Atma.Activate,.timer_/\tma off)
did $iif($Atma(EnableAd),-e,-b) $dname 105
}
on *:dialog:atma_config:sclick:105:Atma.Activate
on *:dialog:atma_config:sclick:88:Atma QueueUsing $iif($did($dname,$did).sel == 1,FileCount,FileSize)
on *:dialog:atma_config:sclick:27:run http://www.phoenixinquis.net/
on *:dialog:atma_config:sclick:30:{
$iif($did($dname,$did).state,Atma.Activate,Atma.Deactivate)
did $iif($Atma(Active),-c,-u) $dname 30
did $iif($Atma(Active),-b,-e) $dname 88
}
on *:dialog:atma_config:sclick:107:Atma FServChat $did($dname,$did).state
on *:dialog:atma_config:sclick:108:Atma ChannelEnforcer $did($dname,$did).state
on *:dialog:atma_config:sclick:109:Atma @Find $did($dname,$did).state
on *:dialog:atma_config:sclick:152:Atma fs_find $did($dname,$did).state
on *:dialog:atma_config:sclick:113:{
Atma MinCPS.Enabled $did($dname,$did).state
.timer_/\tma.MinCPS $iif($Atma(MinCPS.Enabled),0 5 Atma.CheckMinCPS,off)
}
on *:dialog:atma_config:sclick:119:{
Atma MaxCPS.Enabled $did($dname,$did).state
.dcc maxcps $iif($Atma(MaxCPS.Enabled),$calc($Atma(MaxCPS)*1000),0)
}
on *:dialog:atma_config:sclick:111:{
$iif($did($dname,$did).sel == 1,Atma DCCAllowEnforcer Notify, Atma DCCAllowEnforcer Ban)
}
on *:dialog:atma_config:sclick:139:{
hdel _/\tmaFS Hits
hdel _/\tmaFS LeechedFiles
hdel _/\tmaFS LeechedBytes
hdel _/\tmaFS RecordSpeed
updateStats
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:32:Atma.cfgTriggers $did($dname,$did).sel
on *:dialog:atma_config:sclick:34:hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $did($dname,$did).state | hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
on *:dialog:atma_config:sclick:37:{
hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .Channels $addtok($hget(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ .Channels),$$?="Channel to Add?",44)
did -r $dname 36
didtok $dname 36 44 $hget(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ .Channels)
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:38:{
hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .Channels $remtok($hget(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ .Channels),$$did($dname,36).seltext,44)
did -r $dname 36
didtok $dname 36 44 $hget(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ .Channels)
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:39:{
hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .AllChans $did($dname,$did).state
var %action = $iif($did($dname,$did).state,-b,-e)
did %action $dname 36
did %action $dname 37
did %action $dname 38
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:71:{
var %NewTrigger = $?="What will the new trigger be?"
$iif(!%NewTrigger,return)
if ($istok($Atma.Triggers,%NewTrigger,5)) {
_errorbox There already exists a trigger by this name. $crlf $+ Failed to create new trigger.
return
}
var %NewFSRoot
while (!%NewFSRoot) { set %NewFSRoot $sdir($mircdir,Select a directory to serve) }
var %NewFSMOTD = $sfile($mircdir,Select a text file, Use as MOTD)
hadd -m _/\tmaFS Triggers. $+ %NewTrigger 0
hadd -m _/\tmaFS Triggers. $+ %NewTrigger $+ .Root %NewFSRoot
hadd -m _/\tmaFS Triggers. $+ %NewTrigger $+ .MOTD %NewFSMOTD
did -a $dname 32 %NewTrigger
Atma.cfgTriggers $findtok($didtok($dname,32,5),%NewTrigger,1,5)
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:72:{
var %NewTrigger = $?="What shall this trigger be renamed to?"
$iif(!%NewTrigger,return)
if ($istok($Atma.Triggers,%NewTrigger,5)) {
_errorbox There already exists a trigger by this name. $crlf $+ Failed to rename trigger.
return
}
var %counter = 1
while (%counter <= $hfind(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ *,0,w)) {
var %newEntry
.echo -q $regex($hfind(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ *,%counter,w),/^Triggers\.([^\.]*)(\..*)?/i)
%newEntry = Triggers. $+ %NewTrigger $+ $regml(2)
hadd -m _/\tmaFS %newEntry $hget(_/\tmaFS,$hfind(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ *,%counter,w))
inc %counter
}
hdel -w _/\tmaFS Triggers. $+ $regml(1) $+ *
Atma.cfgTriggers 1
Atma.cfgTriggers $findtok($didtok($dname,32,5),%NewTrigger,1,5)
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:73:{
$iif(!$did($dname,32).sel,return)
$iif(!$?!="This will permanently delete the selected trigger. Do it anyway?",return)
hdel -w _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ *
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
Atma.cfgTriggers
}
on *:dialog:atma_config:sclick:74:{
hdel _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .MOTD
did -r $dname 43
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:75:$iif($hget(_/\tmaFS,Triggers. $+ $did($dname,32).seltext $+ .MOTD),run notepad.exe $ifmatch)
on *:dialog:atma_config:sclick:41:{
var %NewDir
while (!%NewDir) { %NewDir = $sdir($mircdir,Select a directory to serve) }
hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .Root %NewDir
did -o $dname 40 1 %NewDir
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:45:{
var %NewMOTD = $sfile($mircdir,Select a text file,Use as MOTD)
$iif(!%NewMOTD,return)
hadd -m _/\tmaFS Triggers. $+ $did($dname,32).seltext $+ .MOTD %NewMOTD
did -o $dname 43 1 %NewMOTD
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:dialog:atma_config:sclick:47:Atma TriggerType Normal
on *:dialog:atma_config:sclick:48:Atma TriggerType CTCP
on *:dialog:atma_config:sclick:50:{
Atma QuickSearchRefresh $did($dname,$did).state
did $iif($did($dname,$did).state,-e,-b) $dname 51
}
on *:dialog:atma_config:sclick:127:Atma QuickSearchRefreshOnStart $did($dname,$did).state
on *:dialog:atma_config:sclick:128:Atma.CacheTriggers
on *:dialog:atma_config:sclick:103,132,133:updateAccess
on *:dialog:atma_config:sclick:101:{
dialog -m atma_access atma_access
did -c atma_access $iif($did($dname,132).state,22,23)
}
on *:dialog:atma_config:sclick:102:{
$iif(!$did(atma_config,100).sel,return)
var %Scope = $did(atma_config,103).seltext
set %Scope $iif(%Scope == Global Permissions,Access.,Trigger. $+ %Scope $+ .Access.) $+ $gettok($did(atma_config,100).seltext,1,32)
dialog -m atma_access atma_access
did -c atma_access $iif($did($dname,132).state,22,23)
did -o atma_access 1 1 $gettok($did(atma_config,100).seltext,1,32)
$iif($gettok($hget(_/\tmaFS,%Scope),2,32),did -c atma_access 4)
did $iif($did(atma_access,4).state,-e,-b) atma_access 8,10,12,13
if ($gettok($hget(_/\tmaFS,%Scope),2,32)) {
var %time = $ctime
did -o atma_access 8 1 $int($calc(($ifmatch - %time) / 86400))
did -o atma_access 10 1 $int($calc((($ifmatch - %time) % 86400) / 3600))
did -o atma_access 12 1 $int($calc(((($ifmatch - %time) % 86400) % 3600) / 60))
did -o atma_access 13 1 $int($calc(((($ifmatch - %time) % 86400) % 3600) % 60))
}
did -o atma_access 20 1 $gettok($hget(_/\tmaFS,%Scope),3-,32)
}
on *:dialog:atma_config:sclick:150:{
$iif(!$did(atma_config,100).sel,return)
var %Scope = $did(atma_config,103).seltext
$iif(%Scope == Global Permissions,set %Scope Global)
Atma.Access.Remove $gettok($did(atma_config,100).seltext,1,32) %Scope
updateAccess
}
on *:dialog:atma_config:sclick:55:^formatstr.help
on *:dialog:atma_config:sclick:59:{
did -o $dname 57 1 $hget(_/\tmaFS.STP,$did($dname,$did).seltext)
Atma FormatString $did($dname,57)
did -g $dname 106 $formatstr_preview
}
on *:dialog:atma_config:sclick:60:{
nickComp stripcolor $did($dname,$did).state
did -g $dname 106 $formatstr_preview
}
on *:dialog:atma_config:sclick:63:{
var %style = $?="Save style as (no spaces)"
$iif(!%style,return)
if ($chr(32) isin %style) { _errorbox Spaces are not allowed in style names | return }
if ($hget(_/\tmaFS.STP,%style)) {
$iif(!$?!="Overwrite existing style of this name?",return)
}
hadd _/\tmaFS.STP %style $did($dname,57)
hsave -ob _/\tmaFS.STP " $+ $scriptdirAtma.stp $+ "
updateStyle
}
on *:dialog:atma_config:sclick:64:{
if ($hget(_/\tmaFS.STP,0).item <= 1) { _errorbox You must leave at least one style | return }
$iif(!$?!="Really delete the selected style (this cannot be undone)?",return)
hdel _/\tmaFS.STP $did($dname,59).seltext
hsave -ob _/\tmaFS.STP " $+ $scriptdirAtma.stp $+ "
updateStyle
}
on *:dialog:atma_config:sclick:65:did -g $dname 106 $formatstr_preview
dialog atma_access {
title Atma Fserv Access
size -1 -1 143 112
option dbu
edit "", 1, 32 2 106 10
text "Hostmask", 2, 4 3 25 8
box "Expiration", 3, 1 33 141 38
check "User access expires in....", 4, 4 41 131 10
edit "0", 8, 7 53 17 10, disable right
text "days", 9, 25 55 14 8
edit "0", 10, 42 53 17 10, disable right
edit "0", 12, 72 53 17 10, disable right
edit "0", 13, 104 53 17 10, disable right
text "hrs", 14, 60 55 9 8
text "min", 15, 89 54 14 8
text "sec", 16, 122 54 13 8
box "Comment", 17, 1 73 141 23
button "OK", 18, 30 99 37 12, default ok
button "Cancel", 19, 71 99 37 12, cancel
edit "", 20, 4 82 134 11, autohs
box "", 21, 1 15 141 17
radio "Access", 22, 23 21 30 9
radio "Deny", 23, 90 21 30 9
}
on *:dialog:atma_access:sclick:4:did $iif($did($dname,$did).state,-e,-b) $dname 8,10,12,13
on *:dialog:atma_access:sclick:18:{
if ((*!*@* !iswm $did($dname,1)) || ($regex($did($dname,1),/\s/))) {
_errorbox You did not enter a valid hostmask. Please enter a valid hostmask in the form *!*@* and try again.
halt
}
Atma.Access.Add $did($dname,1) $iif($did(atma_config,103).seltext != Global Permissions,$ifmatch,Global) $iif($did($dname,22).state,Allow,Deny) $iif($did($dname,4).state,$calc($ctime + (($did($dname,8) * 86400) + ($did($dname,10) * 3600) + ($did($dname,12) * 60) + $did($dname,13))),0) $did($dname,20)
updateAccess
}
dialog atma_queues {
title "_/\tma Queue Management"
size -1 -1 250 131
option dbu
list 1, 2 6 123 111, size vsbar
box "Queue Info", 3, 131 3 117 114
text "Queue Slot #", 4, 135 14 37 8
edit "", 5, 174 13 27 10, read
text "FileName", 6, 135 41 25 8
edit "", 7, 138 50 106 10, read autohs
text "Size", 8, 181 41 16 8
edit "", 9, 198 39 46 10, read
button "Clear this queue", 10, 137 67 105 10, disable
button "Clear all queues for this user", 11, 137 79 105 10, disable
button "Send this queue", 12, 137 91 105 10, disable
button "Send all queues for this user", 13, 137 103 105 10, disable
button "Clear All", 14, 138 119 49 10
button "Send All", 15, 192 119 49 10
button "OK/Cancel", 16, 218 3 30 9, hide ok cancel
text "User", 17, 136 26 18 8
edit "", 18, 157 25 87 10, read
button "^ Move Up ^", 19, 13 119 42 10
button "v Move Down v", 20, 59 119 42 10
}
on *:dialog:atma_queues:init:0:{
updateQueues
}
on *:dialog:atma_queues:sclick:1:{
updateQueues $did($dname,$did).sel
}
on *:dialog:atma_queues:sclick:10:{
write -dl $+ $did($dname,1).sel " $+ $scriptdirqueues.dat $+ "
updateQueues
}
on *:dialog:atma_queues:sclick:11:{
Atma.ClearQueues $gettok($did($dname,1).seltext,2,32)
updateQueues
}
on *:dialog:atma_queues:sclick:12:{
dcc send -c $gettok($did($dname,1).seltext,2,32) $gettok($did($dname,1).seltext,3-,32)
write -dl $+ $did($dname,1).sel " $+ $scriptdirqueues.dat $+ "
updateQueues
}
on *:dialog:atma_queues:sclick:19:{
$iif($did($dname,1).sel <= 1,return)
var %temp = $read($scriptdirqueues.dat,$calc($did($dname,1).sel - 1))
write -l $+ $calc($did($dname,1).sel - 1) " $+ $scriptdirqueues.dat $+ " $read($scriptdirqueues.dat,$did($dname,1).sel)
write -l $+ $did($dname,1).sel " $+ $scriptdirqueues.dat $+ " %temp
updateQueues $calc($did($dname,1).sel - 1)
}
on *:dialog:atma_queues:sclick:20:{
$iif(($did($dname,1).sel < 1) || ($did($dname,1).sel >= $lines($scriptdirqueues.dat)),return)
var %temp = $read($scriptdirqueues.dat,$calc($did($dname,1).sel + 1))
write -l $+ $calc($did($dname,1).sel + 1) " $+ $scriptdirqueues.dat $+ " $read($scriptdirqueues.dat,$did($dname,1).sel)
write -l $+ $did($dname,1).sel " $+ $scriptdirqueues.dat $+ " %temp
updateQueues $calc($did($dname,1).sel + 1)
}
; __________________________
;/``````````````````````````
; Menus
menu menubar,status,query,nicklist,channel,@Atma {
Atma FileServer
.Configure: Atma
.Manage Queues: dialog -m atma_queues atma_queues
.Rebuild QuickSearch Cache: Atma.CacheTriggers
.-
.Preview Ad: echo -a $parse_formatstr(,$Atma(FormatString))
. $iif($chan,Show to $chan) : Atma.Advertise $chan
.-
.Reload: reload -rs $script
.Unload: unload -rs $script
}
; __________________________
;/``````````````````````````
; Remotes
on *:load:{
Atma.createdefaultini
}
on *:start:{
if (!$ini($Atma.ini,Atma)) {
echo 4 -s *<2A><><EFBFBD><EFBFBD> Atma Fileserver INI entries not found, inserting defaults...
Atma.createdefaultini
}
debug.print Loading atma-fserv.dat
hmake _/\tmaFS 10
$iif($findfile($scriptdir,atma-fserv.dat,1),hload -b _/\tmaFS " $+ $ifmatch $+ ")
hmake _/\tmaFS.Cache 1000
$iif($findfile($scriptdir,fscache.dat,1),hload -b _/\tmaFS.Cache " $+ $ifmatch $+ ")
$iif($Atma(QuickSearchRefreshOnStart),Atma.CacheTriggers)
hmake _/\tmaFS.STP 10
$iif($findfile($scriptdir,Atma.stp,1),hload -b _/\tmaFS.STP " $+ $ifmatch $+ ",Atma.createdefaultstp)
}
on *:connect:{
$iif($Atma(StartOnConnect),Atma.Activate)
.timersys_/\tma.AuditAccess 0 5 Atma.Access.Audit
}
on *:text:*:#:{
if ($Atma(@Find) && (($1 == @find) || ($1 == @locator)) && $2-) {
var %search = $replace($2-,$chr(32),*)
var %search.results $Atma.QuickSearch(%search)
$iif(!%search.results,return)
.msg $nick _/\tmaFServ QuickSearch Results
.msg $nick Found ( $+ %search.results $+ ) matches for %search
$iif(%search.results,.msg $nick Displaying match(es) 1 to $iif(%search.results <= $Atma(@Find.Results),$ifmatch,$Atma(@Find.Results)))
var %counter = 1
while (%counter <= $iif(%search.results <= $Atma(@Find.Results),$ifmatch,$Atma(@Find.Results))) {
var %search.result = $Atma.QuickSearch(%search,%counter)
.msg $nick  $+ $gettok(%search.result,1,32)  -- $gettok(%search.result,2-,32) ( $+ $bytes($Atma.QuickSearch(%search,%counter).size).suf $+ )
inc %counter
}
.msg $nick Search Complete.
return
}
if (($1 == !list) && ($Atma(RespondToList)) && ($Atma.Triggers($chan))) { .notice $nick $parse_formatstr($chan,$Atma(FormatString)) | return }
if ($istok($Atma.Triggers,$1-,5) && !$istok($Atma.Triggers($chan),$1-,5)) { .notice $nick The trigger ' $+ $1- $+ ' is not being served to $chan $+ . | return }
if ((!$istok($Atma.Triggers($chan),$1-,5)) || ($Atma(TriggerType) != Normal)) { return }
if (!$Atma(Active)) { .notice $nick The FileServer is not available at this time. Please try again later. | return }
if ($fserv(0) >= $Atma(maxUsers)) { .notice $nick The FileServer is currently full. Please try again later. | return }
if ($gettok($Atma.Access($address($nick,5),$1-),1,32) == DENIED) { .notice $nick $gettok($Atma.Access($address($nick,5),$1-),2-,32) | return }
hadd _/\tmaFS Hits $calc($hget(_/\tmaFS,Hits) + 1)
updateStats
var %FSDir = " $+ $hget(_/\tmaFS,Triggers. $+ $1- $+ .Root) $+ "
var %FSMOTD = " $+ $hget(_/\tmaFS,Triggers. $+ $1- $+ .MOTD) $+ "
fserve $nick $Atma(maxTSends) %FSDir %FSMOTD
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
ctcp *:*:?:{
if ((!$istok($Atma.Triggers($chan),$1-,5)) || ($Atma(TriggerType) != CTCP)) { return }
if (!$Atma(Active)) { .notice $nick The FileServer is not available at this time. Please try again later. | return }
var %FSDir = " $+ $hget(_/\tmaFS,Triggers. $+ $1- $+ .Root) $+ "
var %FSMOTD = " $+ $hget(_/\tmaFS,Triggers. $+ $1- $+ .MOTD) $+ "
fserve $nick $Atma(maxTSends) %FSDir %FSMOTD
}
on *:open:!:{
msg =$nick -  $+ $Atma
msg =$nick - Programmed by Correl J. Roush (correlr@phoenixinquis.net) 2002
msg =$nick - ______________________________________________________________
msg =$nick - $Atma(InfoLine)
msg =$nick -
msg =$nick - You may have up to $Atma(maxUSends) simultaneous file sends, and up to $Atma(maxUQueues) $iif($Atma(QueueUsing) == FileSize,MB worth of) queued files.
msg =$nick - The FServ is limited to a maximum of $Atma(maxTSends) simultaneous file sends and $Atma(maxTQueues) $iif($Atma(QueueUsing) == FileSize,MB worth of) queued files.
msg =$nick -
$iif($Atma(FServChat),msg =$nick - ***FServ Chat is enabled; you may chat with other users on the fserv)
$iif($Atma(ChannelEnforcer),msg =$nick - ***Channel Enforcer is enabled; parting the fserv's channels will result in your queues being cleared.)
$iif($Atma(MaxCPS.Enabled),msg =$nick - ***MaxCPS is enabled; sends from this server will not exceed $Atma(MaxCPS) kb/s.)
$iif($Atma(DCCAllowEnforcer) == ban,msg =$nick - ***DCCAllowEnforcer is enabled; failure to /dccallow + $+ $me $+  will result in your sends/queues being cleared and a $duration($Atma(DCCAllowEnforcer.TempBan)) temporary ban from the fserv.)
halt
}
on *:serv:*:{
$iif($1- == cd.., tokenize 32 cd ..)
$iif($istok(cd dir ls read exit bye c s,$1,32),return)
if ($1 == help) {
msg =$nick - Help - $Atma
if (!$2) {
msg =$nick - The following commands are supported:
msg =$nick - CD LS GET READ HELP EXIT BYE
msg =$nick - SENDS QUEUES CLEARQUEUES FIND WHOSONLINE
msg =$nick -
msg =$nick - Type help followed by a command to get more info on that command.
}
elseif ($2 == CD) {
msg =$nick - CD <directory> - Change to the specified directory
msg =$nick -
msg =$nick - Used to move through the path structure of the fileserver.
msg =$nick -
msg =$nick - Examples:
msg =$nick - CD TextFiles (Changes directory to the TextFiles folder)
msg =$nick - CD .. (Moves back one directory)
}
elseif (($2 == DIR) || ($2 == LS)) {
msg =$nick - LS [-b|k] [-#] or DIR [-b|k] [-#] [/w] - List the contents of the current directory
msg =$nick -
msg =$nick - Lists the name and size of each file in the current directory.
msg =$nick - The /w switch forces a wide listing. (DIR only, LS is always a wide listing)
msg =$nick - The [-b|k] selects bytes or k's.
msg =$nick - The [-#] specifies the number of files on each line in a horizontal listing.
}
elseif ($2 == GET) {
msg =$nick - GET <filename> - asks the fileserver to DCC Send the specified file.
}
elseif ($2 == READ) {
msg =$nick - READ [-numlines] <filename.txt> - reads the specified text file.
msg =$nick -
msg =$nick - The user will be sent a default of 20 lines and then prompted whether to continue listing.
msg =$nick - The -numlines option changes the default number of lines to a value between 5 and 50.
}
elseif ($2 == HELP) {
msg =$nick - HELP [command] - displays FServ command help
msg =$nick -
msg =$nick - [command] is optional, use it to display help on a specific command.
msg =$nick - if [command] is not given, HELP will display a listing of all supported commands.
}
elseif (($2 == EXIT) || ($2 == BYE)) {
msg =$nick - EXIT or BYE - closes the FServ session.
}
elseif ($2 == SENDS) {
msg =$nick - SENDS - Lists the server's active DCC Sends
}
elseif ($2 == QUEUES) {
msg =$nick - QUEUES - Lists the server's send queue
}
elseif ($2 == CLEARQUEUES) {
msg =$nick - CLEARQUEUES - Clears all the files you have queued in the fileserver
}
elseif ($2 == FIND) {
msg =$nick - FIND <matchtext> - Search for files on the fileserver
}
elseif ($2 == WHOSONLINE) {
msg =$nick - WHOSONLINE - Lists other people currently on the fserv.
msg =$nick -
msg =$nick - This command only shows a list of users when FileServer chat is enabled.
}
else {
msg =$nick - No help available for the command $2
}
msg =$nick - End of Help
halt
}
if ($1 == get) {
if (!$2) {
msg =$nick No filename specified.
halt
}
if (!$exists(" $+ $cd $+ \ $+ $2- $+ ")) {
msg =$nick File does not exist. Check your spelling.
halt
}
Atma.SendFile $nick " $+ $cd $+ \ $+ $2- $+ "
halt
}
if ($1- == sends) {
var %counter = 1
msg =$nick There are $send(0) sends in progress
while (%counter <= $send(0)) {
msg =$nick  $+ %counter $+ . - $send(%counter) is recieving $send(%counter).file ( $+ $send(%counter).pc $+ % of $bytes($send(%counter).size).suf $+ , Approx. $duration($round($calc(($send(%counter).size - $send(%counter).sent) / $send(%counter).cps))) remaining)
inc %counter
}
halt
}
if ($1- == queues) {
var %counter = 1
msg =$nick There are $iif($lines(" $+ $scriptdirqueues.dat $+ "),$ifmatch,0) send(s) waiting in the queue
while (%counter <= $iif($lines(" $+ $scriptdirqueues.dat $+ "),$ifmatch,0)) {
msg =$nick  $+ %counter $+ . - $gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),1,32) queued $nopath($gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),2-,32)) ( $+ $bytes($file($gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),2-,32)).size).suf $+ )
inc %counter
}
halt
}
if ($1 == clearqueues) {
Atma.ClearQueues $nick
msg =$nick All your queues have been cleared.
halt
}
if ($1 == find) {
if (!$Atma(fs_find)) { msg =$nick find command is currently disabled. | halt }
if (!$2) { msg =$nick No search criteria was specified | halt }
var %search = $replace($2-,$chr(32),*)
var %search.results $Atma.QuickSearch(%search)
.msg =$nick QuickSearch Results
.msg =$nick Found ( $+ %search.results $+ ) matches for %search
$iif(!%search.results,halt)
$iif(%search.results,.msg =$nick Displaying match(es) 1 to $iif(%search.results <= $Atma(fs_find.Results),$ifmatch,$Atma(fs_find.Results)))
var %counter = 1
while ((%counter <= %search.results) && (%counter <= $Atma(fs_find.Results))) {
var %search.result = $Atma.QuickSearch(%search,%counter)
.msg =$nick  $+ $gettok(%search.result,1,32)  -- $gettok(%search.result,2-,32) ( $+ $bytes($Atma.QuickSearch(%search,%counter).size).suf $+ )
inc %counter
}
.msg =$nick Search Complete.
halt
}
if ($1- == whosonline) {
if ($Atma(FServChat)) {
var %counter = 1
msg =$nick - There are $fserv(0) user(s) currently on the fserv
while (%counter <= $fserv(0)) {
msg =$nick - $fserv(%counter)
inc %counter
}
msg =$nick End of list.
}
else {
msg =$nick FServ Chat is not enabled.
}
halt
}
if ($Atma(FServChat)) {
var %counter = 1
while (%counter <= $fserv(0)) {
$iif($fserv(%counter) != $nick,msg = $+ $fserv(%counter) ( $+ $nick $+ ) $1-)
inc %counter
}
halt
}
msg =$nick - " $+ $1 $+ " is not a recognized command. Type help for a list of available commands.
halt
}
on *:filesent:*:{
var %sendwindow
%counter = 1
while (%counter <= $send($nick,0)) {
$iif($send($nick,%counter).path $+ $send($nick,%counter).file == $filename,set %sendwindow %counter)
inc %counter
}
hadd _/\tmaFS LeechedFiles $calc($hget(_/\tmaFS,LeechedFiles) + 1)
hadd _/\tmaFS LeechedBytes $calc($hget(_/\tmaFS,LeechedBytes) + $send($nick,%sendwindow).sent)
$iif($iif($gettok($hget(_/\tmaFS,RecordSpeed),2,32),$ifmatch,0) < $send($nick,%sendwindow).cps,hadd _/\tmaFS RecordSpeed $nick $send($nick,%sendwindow).cps)
updateStats
.timer 1 1 Atma.ProcessQueues
.timer_/\tma.CheckMinCPS.Terminate off
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
on *:sendfail:*:{
.timer 1 1 Atma.ProcessQueues
.timer_/\tma.CheckMinCPS.Terminate off
}
on *:part:*:{
if (($comchan($nick,0) <= 1) && $Atma(ChannelEnforcer) && $Atma.Queue($nick).Count) {
.notice $nick [FSERV NOTICE] You no longer share a common channel with the fserv; All waiting queues have been cleared [ $+ $Atma Channel Enforcer]
Atma.ClearQueues $nick
}
}
on *:snotice:*The user * is not accepting DCC sends of filetype*:{
var %filename = $send($3,$send($3,0)).file
close -s $send($3,0) $3
$iif($fserv($3),msg = $+ $3,.notice $3) Your send of %filename was BLOCKED by the IRC server. In order to recieve files of this type, you must first type /dccallow + $+ $me $+ , then you will be able to download the file.
if ($Atma(DCCAllowEnforcer) == Ban) {
close -sf $3
Atma.ClearQueues $3
Atma.Access.Add $address($3,9) Global Deny $calc($ctime + $Atma(DCCAllowEnforcer.TempBan)) DCCAllow Enforcement TempBan
.notice $3 Because you did not comply with this fserv's DCCALLOW rule, your sends and queues have been cleared, and you have been globally banned from this fserv for a duration of $duration($Atma(DCCAllowEnforcer.TempBan))
}
}
raw 401:*:{
; Ahnold may be back, but his queues won't be waiting for him ;d
close -s $2
Atma.ClearQueues $2
}
; __________________________
;/``````````````````````````
; Aliases
alias Atma.ver { return 1.1.20021115 }
alias -l Atma.ini {
return $iif($_Sylver.ini,$_Sylver.ini,Sylver.ini)
}
alias Atma {
if (!$isid) {
if (!$1) {
dialog -m atma_config atma_config
}
else {
$iif($2,writeini $Atma.ini Atma $1 $2-,remini $Atma.ini Atma $1)
}
}
else {
$iif(!$1,return _/\tma FileServer Build $Atma.ver)
return $readini($Atma.ini,Atma,$1)
}
}
alias Atma.Help { run " $+ $scriptdirAtma-Fserv.hlp $+ " }
alias Atma.createdefaultini {
remini $Atma.ini Atma
writeini $Atma.ini Atma InfoLine $Atma
writeini $Atma.ini Atma maxUSends 1
writeini $Atma.ini Atma maxUQueues 20
writeini $Atma.ini Atma maxTSends 3
writeini $Atma.ini Atma maxTQueues 99
writeini $Atma.ini Atma maxUsers 10
writeini $Atma.ini Atma QueueUsing FileCount
writeini $Atma.ini Atma Interval 30
writeini $Atma.ini Atma Interval.unit minutes
writeini $Atma.ini Atma RespondToList 1
writeini $Atma.ini Atma EnableAd 1
writeini $Atma.ini Atma StartOnConnect 1
writeini $Atma.ini Atma FServChat 1
writeini $Atma.ini Atma ChannelEnforcer 1
writeini $Atma.ini Atma @Find 1
writeini $Atma.ini Atma @Find.Results 5
writeini $Atma.ini Atma fs_find 1
writeini $Atma.ini Atma fs_find.Results 10
writeini $Atma.ini Atma DCCAllowEnforcer Notify
writeini $Atma.ini Atma DCCAllowEnforcer.TempBan 300
writeini $Atma.ini Atma MinCPS.Enabled 0
writeini $Atma.ini Atma MinCPS 6
writeini $Atma.ini Atma MinCPS.secs 5
writeini $Atma.ini Atma MaxCPS.Enabled 0
writeini $Atma.ini Atma MaxCPS 20
writeini $Atma.ini Atma TriggerType Normal
writeini $Atma.ini Atma QuickSearchRefreshOnStart 0
writeini $Atma.ini Atma FormatString &b_/\&b&c04tma&c&bFServ&b(Triggers&b[&b &c05&Atma.Triggers&c &b]&b Hits&b[&b &c05&Atma.Hits&c &b]&b Users&b[&b &c05&Atma.Users&c &b]&b Sends&b[&b &c05&Atma.Sends&c &b]&b Queues&b[&b &c05&Atma.Queues&c &b]&b Leeched&b[&b &c05&Atma.LeechedBytes&c in &c05&Atma.LeechedFiles&c files &b]&b Record Speed&b[&b &c05&Atma.RecordSpeed&c &b]&b InfoLine&b[&b &c05&Atma.InfoLine&c &b]&b)
}
alias -l Atma.createdefaultstp {
$iif($hget(_/\tmaFS.STP),hfree _/\tmaFS.STP)
hmake _/\tmaFS.STP 10
hadd _/\tmaFS.STP Atma_Short &b_/\&b&c04tma&c&bFServ&b(Triggers&b[&b &c05&Atma.Triggers&c &b]&b Users&b[&b &c05&Atma.Users&c &b]&b Sends&b[&b &c05&Atma.Sends&c &b]&b Queues&b[&b &c05&Atma.Queues&c &b]&b InfoLine&b[&b &c05&Atma.InfoLine&c &b]&b)
hadd _/\tmaFS.STP Atma_Long &b_/\&b&c04tma&c&bFServ&b(Triggers&b[&b &c05&Atma.Triggers&c &b]&b Hits&b[&b &c05&Atma.Hits&c &b]&b Users&b[&b &c05&Atma.Users&c &b]&b Sends&b[&b &c05&Atma.Sends&c &b]&b Queues&b[&b &c05&Atma.Queues&c &b]&b Leeched&b[&b &c05&Atma.LeechedBytes&c in &c05&Atma.LeechedFiles&c files &b]&b Record Speed&b[&b &c05&Atma.RecordSpeed&c &b]&b InfoLine&b[&b &c05&Atma.InfoLine&c &b]&b)
hsave -ob _/\tmaFS.STP " $+ $scriptdirAtma.stp $+ "
}
alias Atma.Activate {
writeini $Atma.ini Atma Active 1
$iif($exists(" $+ $scriptdirqueues.dat $+ "),remove " $+ $scriptdirqueues.dat $+ ")
if ($Atma(EnableAd)) {
.timer_/\tma 0 $iif($Atma(Interval.unit) == seconds,$Atma(Interval),$calc($Atma(Interval) * 60)) Atma.Advertise
Atma.Advertise
}
if ($Atma(MinCPS.Enabled)) {
.timer_/\tma.MinCPS 0 5 Atma.CheckMinCPS
}
}
alias Atma.Deactivate {
$iif(!$input(This will halt the fserv and clear all waiting queues. Shut down anyway?,264,$Atma),return)
writeini $Atma.ini Atma Active 0
.timer_/\tma* off
$iif($exists(" $+ $scriptdirqueues.dat $+ "),remove " $+ $scriptdirqueues.dat $+ ")
}
alias Atma.Sends {
return $iif($1,$send($1,0),$send(0))
}
alias Atma.Users.Count {
return $fserv(0)
}
alias Atma.Triggers {
var %Atma.Triggers
var %counter = 1
while (%counter <= $hget(_/\tmaFS,0).item) {
if ($regex($hget(_/\tmaFS,%counter).item,/^Triggers\.([^\.]*)$/i)) {
if ($1) {
if ($hget(_/\tmaFS,Triggers. $+ $regml(1) $+ .AllChans) || $istok($hget(_/\tmaFS,Triggers. $+ $regml(1) $+ .Channels),$1,44)) {
$iif($hget(_/\tmaFS,Triggers. $+ $regml(1)),%Atma.Triggers = $addtok(%Atma.Triggers,$regml(1),5))
}
}
else { %Atma.Triggers = $addtok(%Atma.Triggers,$regml(1),5) }
}
inc %counter
}
; Sort 'em alphabetically...
%Atma.Triggers = $sorttok(%Atma.Triggers,5)
$iif($prop != Formatted,return %Atma.Triggers)
var %Atma.Triggers.Formatted = $gettok(%Atma.Triggers,1,5)
$iif(%Atma.Triggers.Formatted && ($Atma(TriggerType) == CTCP),%Atma.Triggers.Formatted = /ctcp $me %Atma.Triggers.Formatted)
%counter = 2
while (%counter <= $numtok(%Atma.Triggers,5)) {
if ($Atma(TriggerType) == Normal) {
%Atma.Triggers.Formatted = %Atma.Triggers.Formatted & $gettok(%Atma.Triggers,%counter,5)
}
else {
%Atma.Triggers.Formatted = %Atma.Triggers.Formatted & /ctcp $me $gettok(%Atma.Triggers,%counter,5)
}
inc %counter
}
return %Atma.Triggers.Formatted
}
alias Atma.Advertise {
if ($1) {
$iif($Atma.Triggers($1),msg $1 $parse_formatstr($1,$Atma(FormatString)))
return
}
var %counter = 1
while (%counter <= $chan(0)) {
if ($Atma.Triggers($chan(%counter))) {
msg $chan(%counter) $parse_formatstr($chan(%counter),$Atma(FormatString))
}
inc %counter
}
}
alias -l Atma.cfgTriggers {
var %action = $iif($Atma.Triggers,-e,-b)
did -r atma_config 32,103
did -r atma_config 40
did -r atma_config 43
did -r atma_config 36
$iif($Atma.Triggers,didtok atma_config 32 5 $Atma.Triggers)
didtok atma_config 103 5 Global Permissions
$iif($Atma.Triggers,didtok atma_config 103 5 $didtok(atma_config,32,5))
did %action atma_config 34
did %action atma_config 36
did %action atma_config 37
did %action atma_config 38
did %action atma_config 39
did %action atma_config 41
did %action atma_config 45
did %action atma_config 72
did %action atma_config 73
did %action atma_config 74
did %action atma_config 75
if ($Atma.Triggers) {
did -c atma_config 32 $iif($1,$1,1)
did -c atma_config 103 $iif($1,$calc($1 + 1),1)
var %Trigger = $did(atma_config,32).seltext
did $iif($hget(_/\tmaFS,Triggers. $+ %Trigger),-c,-u) atma_config 34
did -o atma_config 40 1 $hget(_/\tmaFS,Triggers. $+ %Trigger $+ .Root)
did -o atma_config 43 1 $hget(_/\tmaFS,Triggers. $+ %Trigger $+ .MOTD)
didtok atma_config 36 44 $hget(_/\tmaFS,Triggers. $+ %Trigger $+ .Channels)
did $iif($hget(_/\tmaFS,Triggers. $+ %Trigger $+ .AllChans),-c,-u) atma_config 39
var %action = $iif($hget(_/\tmaFS,Triggers. $+ %Trigger $+ .AllChans),-b,-e)
did %action atma_config 36
did %action atma_config 37
did %action atma_config 38
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
else {
did -c atma_config 103 1
}
}
alias -l updateStats {
$iif(!$dialog(atma_config),return)
did -o atma_config 143 1 $iif($hget(_/\tmaFS,LeechedFiles),$ifmatch,0)
did -o atma_config 144 1 $iif($hget(_/\tmaFS,LeechedBytes),$bytes($ifmatch).suf ( $+ $ifmatch bytes),0 bytes)
did -o atma_config 145 1 $iif($hget(_/\tmaFS,RecordSpeed),$round($calc($gettok($ifmatch,2,32) / 1024),2) $+ kb/s by $gettok($ifmatch,1,32),0kb/s)
did -o atma_config 146 1 $iif($hget(_/\tmaFS,Hits),$ifmatch,0)
}
alias -l updateAccess {
var %Scope = $did(atma_config,103).seltext
did -r atma_config 100
$iif(%Scope == Global Permissions,set %Scope Access.,set %Scope Triggers. $+ %Scope $+ .Access.)
var %counter = 1
while (%counter <= $hfind(_/\tmaFS,%Scope $+ *,0,w)) {
if ($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%Scope $+ *,%counter,w)),1,32) == $iif($did(atma_config,132).state,Allow,Deny)) {
.echo -q $regex($hfind(_/\tmaFS,%Scope $+ *,%counter,w),/Access.(.*)$/)
did -a atma_config 100 $regml(1) ( $+ $iif($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%Scope $+ *,%counter,w)),2,32),$asctime($ifmatch),Never Expires) $+ ) $gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%Scope $+ *,%counter,w)),3-,32)
}
inc %counter
}
}
alias -l updateStyle {
did -r atma_config 59
var %counter = 1
while (%counter <= $hget(_/\tmaFS.STP,0).item) {
did -a atma_config 59 $hget(_/\tmaFS.STP,%counter).item
inc %counter
}
did -c atma_config 59 $findtok($didtok(atma_config,59,5),$hfind(_/\tmaFS.STP,$did(atma_config,57),1).data,1,5)
}
alias -l updateQueues {
var %dropdown
did -r atma_queues 1
if ($lines(" $+ $scriptdirqueues.dat $+ ")) {
var %counter = 1
while (%counter <= $lines(" $+ $scriptdirqueues.dat $+ ")) {
did -a atma_queues 1 %counter $gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),1,32) $gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),2-,32)
inc %counter
}
}
did -c atma_queues 1 $iif($1,$1,1)
if ($did(atma_queues,1).sel < 1) {
did -b atma_queues 10,11,12,13
did -r atma_queues 5,18,7,9
return
}
did -o atma_queues 5 1 $gettok($did(atma_queues,1).seltext,1,32)
did -o atma_queues 18 1 $gettok($did(atma_queues,1).seltext,2,32)
did -o atma_queues 7 1 $nopath($gettok($did(atma_queues,1).seltext,3-,32))
did -o atma_queues 9 1 $bytes($file($gettok($did(atma_queues,1).seltext,3-,32)).size,3).suf
did -e atma_queues 10,11,12,13
}
alias Atma.SendFile {
;Atma.Sendfile $nick $file
$iif(!$1 || !$2-,return)
if ($Atma.Sends >= $Atma(maxTSends)) {
Atma.Queue $1 $2-
return
}
if ($Atma.Sends($1) >= $Atma(maxUSends)) {
Atma.Queue $1 $2-
return
}
.dcc maxcps $iif($Atma(MaxCPS.Enabled),$calc($Atma(MaxCPS)*1000),0)
dcc send -c $1 $2-
}
alias Atma.Queue {
$iif($hget(_/\tmaFS.Queues),hfree _/\tmaFS.Queues)
hmake _/\tmaFS.Queues 10
var %counter = 1
while (%counter <= $iif($lines(" $+ $scriptdirqueues.dat $+ "),$ifmatch,0)) {
hadd _/\tmaFS.Queues %counter $read(" $+ $scriptdirqueues.dat $+ ",%counter)
inc %counter
}
if ($isid) {
var %regex = /^ $+ $1 /i
if ($Atma(QueueUsing) == FileCount) {
if ($2) {
return $hget(_/\tmaFS.Queues,$hfind(_/\tmaFS.Queues,%regex,$2,r).data)
}
else {
return $hfind(_/\tmaFS.Queues,%regex,0,r).data
}
}
else {
if ($2) {
return $hget(_/\tmaFS.Queues,$hfind(_/\tmaFS.Queues,%regex,$2,r).data)
}
else {
var %QueuesMB = 0
var %counter = 1
while (%counter <= $hfind(_/\tmaFS.Queues,%regex,0,r).data) {
inc %QueuesMB $bytes($file($gettok($hget(_/\tmaFS.Queues,$hfind(_/\tmaFS.Queues,%regex,%counter,r).data),2-,32)).size,m)
inc %counter
}
return %QueuesMB
}
}
}
else {
Atma.AddQueue $1 $2-
}
}
alias -l Atma.AddQueue {
$iif(!$1 || !$2-,return)
var %regex = /^ $+ $1 $replace($2-,\,\\) $+ $ $+ /i
if ($hfind(_/\tmaFS.Queues,%regex,0,r).data) {
msg =$nick You have already queued the file $nopath($2-)
}
else {
if ($Atma.Queue($1).Count > $Atma(maxTQueues)) {
msg =$nick The FServ queue limit has been reached. Wait for some sends to finish, then try again.
return
}
if ($Atma.Queue($1).Count > $Atma(maxUQueues)) {
msg =$nick You have exceeded your maximum queue limit. Wait for some of your sends to finish, then try again.
return
}
write " $+ $scriptdirqueues.dat $+ " $1 $2-
msg =$nick Your file ( $+ $nopath($2-) $+ ) has been queued into slot $lines(" $+ $scriptdirqueues.dat $+ ")
}
}
alias Atma.ProcessQueues {
$iif($Atma.Sends >= $Atma(maxTSends),return)
$iif(!$lines(" $+ $scriptdirqueues.dat $+ "),return)
$iif($Atma.Sends($gettok($read(" $+ $scriptdirqueues.dat $+ ",1),1,32)) >= $Atma(maxUSends),return)
dcc send -c $read(" $+ $scriptdirqueues.dat $+ ",1)
write -dl1 " $+ $scriptdirqueues.dat $+ "
}
alias -l Atma.ClearQueues {
while ($read(" $+ $scriptdirqueues.dat $+ ",w,$1 *)) {
var %line = $readn
write -dl $+ %line " $+ $scriptdirqueues.dat $+ "
}
}
alias -l RelativePath {
var %regex = /^ $+ $replace($1,\,\\) $+ (.*?)$/
var %relativepath
.echo -q $regex(relpath,$2,%regex)
debug.print $lower(\ $+ $regml(relpath,1))
return $lower(\ $+ $replace($regml(relpath,1),$chr(32),$chr(5)))
}
alias -l Atma.CacheTriggers {
window -doC @Atma 1 1 300 200
$iif($hget(_/\tmaFS.Cache),hfree _/\tmaFS.Cache)
hmake _/\tmaFS.Cache 1000
$iif(!$Atma.Triggers,return)
echo -s AtmaFS: Caching FServ files...
var %counter = 1
while (%counter <= $numtok($Atma.Triggers,5)) {
echo -s $gettok($Atma.Triggers,%counter,5) -- Cached $findfile($hget(_/\tmaFS,Triggers. $+ $gettok($Atma.Triggers,%counter,5) $+ .Root),*.*,0,hadd _/\tmaFS.Cache $gettok($Atma.Triggers,%counter,5) $+ $chr(5) $+ $RelativePath($hget(_/\tmaFS,Triggers. $+ $gettok($Atma.Triggers,%counter,5) $+ .Root),$1-) $file($1-).size) files
inc %counter
}
hsave -ob _/\tmaFS.Cache " $+ $scriptdirfscache.dat $+ "
echo -s Finished caching FServ files.
window -c @Atma
}
alias Atma.QuickSearch {
$iif(!$1,return 0)
var %regex = /^.*? $+ $lower($replace($1,\,\\,.,\.,?,.,*,.*?,[,\[,],\])) $+ [^\\]*?$/
return $iif($2 && ($prop == size),$hget(_/\tmaFS.Cache,$hfind(_/\tmaFS.Cache,%regex,$iif($2,$2,0),r)),$replace($hfind(_/\tmaFS.Cache,%regex,$iif($2,$2,0),r),$chr(5),$chr(32)))
}
alias -l formatstr_preview {
;modded considerably from ZeeG's $xd.p previewing alias in xServ
var %prv = Atma.bmp
var %prvstr = $parse_formatstr(,$did(atma_config,57))
window -phf @atma_preview 0 0 460 16
$iif(%prvstr,drawtext -bpc @atma_preview $colour(normal) $colour(background) Verdana -7 1 1 460 16 %prvstr)
drawsave @atma_preview %prv
window -c @atma_preview
return %prv
}
alias -l Atma.CheckMinCPS {
$iif(!$send(0),return)
$iif($timer(_/\tma.CheckMinCPS.Terminate),return)
var %counter = 1
while (%counter <= $send(0)) {
if ($send(%counter).cps < $Atma(MinCPS)) {
.timer_/\tma.CheckMinCPS.Terminate 1 $Atma(MinCPS.Secs) Atma.CheckMinCPS.Terminate %counter
return
}
inc %counter
}
}
alias -l Atma.CheckMinCPS.Terminate {
if ($send($1).cps < $Atma(MinCPS)) {
.notice $send($1) Your send of $send($1).file has been canceled because the bytes per second dropped below the server minimum of $Atma(MinCPS) for a duration of $Atma(MinCPS.Secs) seconds.
close -s $+ $1
}
}
alias Atma.Access {
$iif(!$1,return)
$iif(!$istok($Atma.Triggers,$2,5),return)
var %Trig.AllowList = 0
var %Trig.Allowed = 0
var %regex = /^Triggers. $+ $2 $+ .Access.(.*?)$/
var %counter = 1
while (%counter <= $hfind(_/\tmaFS,%regex,0,r)) {
.echo -q $regex($hfind(_/\tmaFS,%regex,%counter,r),%regex)
var %matchhost = $regml(1)
if ((%matchhost iswm $1) && ($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),1,32) == DENY)) {
return DENIED You are banned from using this trigger. Reason:( $gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),3-,32) ) (Ban Expires: $iif($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),2,32),$asctime($ifmatch) / Current time = $asctime($ctime),Never) )
}
if ($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),1,32) == ALLOW) {
%Trig.AllowList = 1
$iif(%matchhost iswm $1, %Trig.Allowed = 1)
}
inc %counter
}
var %Global.AllowList = 0
var %Global.Allowed = 0
var %regex = /^Access.(.*?)$/
var %counter = 1
while (%counter <= $hfind(_/\tmaFS,%regex,0,r)) {
.echo -q $regex($hfind(_/\tmaFS,%regex,%counter,r),%regex)
var %matchhost = $regml(1)
if ((%matchhost iswm $1) && ($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),1,32) == DENY)) {
return DENIED You are banned from using this FileServer. Reason:( $gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),3-,32) ) (Ban Expires: $iif($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),2,32),$asctime($ifmatch) / Current time = $asctime($ctime),Never) )
}
if ($gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),1,32) == ALLOW) {
%Global.AllowList = 1
$iif(%matchhost iswm $1, %Global.Allowed = 1)
}
inc %counter
}
if (%Trig.AllowList || %Global.AllowList) {
$iif(%Trig.AllowList && %Trig.Allowed,return ALLOWED)
$iif(%Global.AllowList && %Global.Allowed,return ALLOWED)
return DENIED You do not have permission to access this exclusive $iif(%Global.AllowList,FileServer.,trigger.)
}
else {
return ALLOWED
}
}
alias Atma.Access.Add {
var %Scope = $iif($2 != Global,Triggers. $+ $2 $+ .Access.,Access.)
hadd _/\tmaFS %Scope $+ $1 $3-
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
alias -l Atma.Access.Remove {
var %Scope = $iif($2 != Global,Triggers. $+ $2 $+ .Access.,Access.)
hdel _/\tmaFS %Scope $+ $1
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
alias -l Atma.Access.Audit {
var %regex = /^(Triggers\..*?\.)?Access.(.*?)$/
var %counter = 1
while (%counter <= $hfind(_/\tmaFS,%regex,0,r)) {
.echo -q $regex($hfind(_/\tmaFS,%regex,%counter,r),%regex)
if (*!*@* iswm $regml($regml(0))) {
var %expires = $gettok($hget(_/\tmaFS,$hfind(_/\tmaFS,%regex,%counter,r)),2,32)
if (%expires && (%expires < $ctime)) {
debug.print PERMISSION $hfind(_/\tmaFS,%regex,%counter,r) EXPIRED, PURGED
hdel _/\tmaFS $hfind(_/\tmaFS,%regex,%counter,r)
}
}
inc %counter
}
hsave -ob _/\tmaFS " $+ $scriptdiratma-fserv.dat $+ "
}
alias -l _errorbox .echo -q $input($$1-,260,$Atma)
alias -l debug.print $iif($window(@Atma),aline @Atma $$1-)