atma/release/0.992-2002.10.03/atma-fserv.mrc

1215 lines
50 KiB
Text
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; Phoenix FileServer for mIRC 6.0+
; Atma version 0.99.20020820
; Programmed by Correl J. Roush
; correlr@phoenixinquis.net
; www.phoenixinquis.net
; __________________________
;/``````````````````````````
; Dialogs
dialog atma_config {
title $Atma
size -1 -1 224 129
option dbu
tab "Basic Config", 1, 1 1 219 116
box "Fserv Limits", 7, 4 17 104 56, tab 1
text "Users", 8, 7 39 18 8, tab 1
edit $Atma(maxUSends), 13, 28 37 20 10, tab 1 right
box "Ad Setup", 17, 111 17 108 56, tab 1
text "Show ad every", 18, 119 28 39 8, tab 1
edit $Atma(Interval), 19, 159 27 23 10, tab 1 right
radio "Minutes", 20, 183 23 33 10, tab 1
radio "Seconds", 21, 183 32 34 10, tab 1
check "Respond to !list", 22, 116 61 50 10, tab 1
box "Server Info", 23, 4 73 215 20, tab 1
edit $Atma(InfoLine), 24, 7 80 209 10, tab 1 autohs
check "Start file server on connect", 25, 10 98 79 10, tab 1
text "Sends", 10, 29 27 18 8, tab 1
text "Queues", 12, 52 27 20 8, tab 1
edit $Atma(MaxUQueues), 14, 51 37 20 10, tab 1 right
edit $Atma(maxTQueues), 16, 51 48 20 10, tab 1 right
edit $Atma(maxTSends), 15, 28 48 20 10, tab 1 right
text "Total", 9, 7 49 18 8, tab 1
box "", 29, 142 91 77 21, tab 1
check "Enable FileServer", 30, 145 97 71 12, tab 1 push
text "Sessions", 69, 75 27 23 8, tab 1
edit 1, 70, 74 37 20 10, tab 1 read right
edit $Atma(maxUsers), 68, 74 48 20 10, tab 1 right
check "Enable Channel Ads", 76, 115 45 59 10, tab 1 push
text "Queue using", 87, 7 62 33 8, tab 1
combo 88, 43 60 60 37, tab 1 size drop
button "Restart", 105, 180 45 30 11, disable tab 1
tab "Adv. Configuration", 2
check "FileServer Chat", 107, 7 19 50 10, tab 2
check "Channel Enforcer", 108, 7 29 55 10, tab 2
check "Respond to @find / @locator", 109, 7 39 87 10, tab 2
box "/dccallow Enforcer (where applicable)", 110, 104 17 115 37, tab 2
combo 111, 107 25 109 36, tab 2 size drop
box "Minimum CPS", 112, 104 55 115 34, tab 2
check "Drop sends that have been going below", 113, 107 64 106 10, tab 2
edit $Atma(MinCPS), 114, 115 75 24 10, tab 2 right
text "cps for", 115, 140 77 21 8, tab 2
edit $Atma(MinCPS.Secs), 116, 162 75 24 10, tab 2 right
text "seconds.", 117, 187 77 25 8, tab 2
box "Maximum CPS", 118, 104 90 115 25, tab 2
check "Limit sends to a max of", 119, 107 101 66 10, tab 2
edit $Atma(MaxCPS), 120, 173 101 24 10, tab 2 right
text "kb/s", 121, 198 103 18 8, tab 2
edit $Atma(@Find.Results), 129, 44 48 23 10, tab 2 right
text "Limited to", 130, 17 49 25 8, tab 2
text "results", 131, 68 49 19 8, tab 2
box "Stats", 134, 4 59 98 56, tab 2
text "Leeched Files", 135, 7 67 41 8, tab 2
text "Leeched Bytes", 136, 7 76 41 8, tab 2
text "Record Speed", 137, 7 85 41 8, tab 2
text "Hits", 138, 7 94 41 7, tab 2
button "Reset", 139, 69 104 31 9, tab 2
edit "", 143, 49 65 50 9, tab 2 read autohs right
edit "", 144, 49 74 50 9, tab 2 read autohs right
edit "", 145, 49 84 50 9, tab 2 read autohs right
edit "", 146, 49 94 50 9, tab 2 read autohs right
text "Tempban lasts for", 147, 111 40 47 8, tab 2
edit $Atma(DCCAllowEnforcer.TempBan), 148, 159 39 28 10, tab 2
text "seconds.", 149, 188 40 26 8, tab 2
tab "Triggers", 3
combo 32, 7 25 60 42, tab 3 sort drop
box "Trigger Configuration", 33, 4 17 215 73, tab 3
check "This trigger is enabled", 34, 72 26 72 8, disable tab 3
box "Channel Setup", 35, 150 22 66 65, tab 3
list 36, 153 29 60 35, disable tab 3 size
button "Add", 37, 154 65 28 9, disable tab 3
check "All active channels", 39, 154 75 60 10, disable tab 3
button "Delete", 38, 185 65 28 9, disable tab 3
edit "", 40, 6 55 117 10, tab 3 read autohs
button "...", 41, 127 55 20 9, disable tab 3
text "Root Directory", 42, 8 47 49 8, tab 3
edit "", 43, 6 76 117 10, tab 3 read autohs
text "MOTD File", 44, 7 67 33 8, tab 3
button "...", 45, 127 76 20 9, disable tab 3
box "Trigger Style", 46, 4 90 66 27, tab 3
radio "Normal", 47, 7 97 30 10, tab 3
radio "CTCP", 48, 42 97 27 10, tab 3
box "QuickSearch Cache", 49, 71 90 148 27, tab 3
button "Add", 71, 7 37 28 9, tab 3
button "Rename", 72, 38 37 28 9, disable tab 3
button "Delete", 73, 69 37 28 9, disable tab 3
button "Unset", 74, 43 67 28 9, disable tab 3
button "Edit File", 75, 74 67 28 9, disable tab 3
check "Rebuild on mIRC startup", 127, 75 98 73 10, tab 3
button "Rebuild Now", 128, 175 97 41 11, tab 3
tab "FServ Access", 4
box "Access Permissions", 98, 4 36 215 79, tab 4
list 100, 7 47 182 65, tab 4 sort size
button "Add", 101, 193 47 23 11, tab 4
button "Edit", 102, 193 60 23 11, tab 4
combo 103, 6 23 60 42, tab 4 size drop
box "", 104, 4 17 215 19, tab 4
radio "Allowed Hosts", 132, 74 23 50 10, tab 4
radio "Denied Hosts", 133, 133 23 50 10, tab 4
button "Remove", 150, 193 73 23 11, tab 4
tab "Ad Style", 77
box "Style Preview", 54, 4 17 215 20, tab 77
box FormatString, 56, 4 38 215 39, tab 77
text "Format Preset:", 58, 7 46 37 8, tab 77
combo 59, 49 45 90 52, tab 77 size drop
button "Save", 63, 140 45 25 9, tab 77
button "Delete", 64, 166 45 25 9, tab 77
button "Preview", 65, 192 45 25 9, tab 77
edit $Atma(FormatString), 57, 6 56 210 10, tab 77 autohs
check "Always strip color (automatically done on mode +c channels)", 60, 7 66 180 10, tab 77
link "Click here for help on the formatstring parser", 55, 56 108 106 8, tab 77
edit The _/\tma FileServer includes the following variables for formatstring parsing: $crlf &Atma.Triggers &Atma.Users &Atma.Sends &Atma.Queues &Atma.InfoLine, 62, 5 80 212 26, tab 77 read multi
text "Programmed by Correl J. Roush, 2002", 6, 1 122 93 8, disable
link "http://www.phoenixinquis.net/", 27, 142 122 77 8
button "okcancel", 66, 99 121 38 8, hide ok cancel
icon 106, 8 25 208 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)
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:{
did $iif($did == 77,-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 == 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: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 21 123 94, size vsbar
combo 2, 3 7 122 50, size drop
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:{
$iif($did($dname,$did).sel < 1,return)
did -o $dname 5 1 $gettok($did($dname,$did).seltext,1,32)
did -o $dname 18 1 $gettok($did($dname,$did).seltext,2,32)
did -o $dname 7 1 $nopath($gettok($did($dname,$did).seltext,3-,32))
did -o $dname 9 1 $bytes($file($gettok($did($dname,$did).seltext,3-,32)).size,3).suf
did -e $dname 10,11,12,13
}
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
}
; __________________________
;/``````````````````````````
; 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)
.msg $nick _/\tmaFServ QuickSearch Results
.msg $nick Found ( $+ %search.results $+ ) matches for %search
$iif(%search.results,.msg $nick Displaying matche(s) 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 (($Atma(Active)) && ($1 == !list) && ($Atma(RespondToList))) { .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($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 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 == 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 == find) {
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
var %counter = 1
while (%counter <= %search.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 0.992.20021002 }
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 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
}
$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,2
if ($lines($scriptdirqueues.dat)) {
var %counter = 1
while (%counter <= $lines($scriptdirqueues.dat)) {
%dropdown = $addtok(%dropdown,$gettok($read($scriptdirqueues.dat,%counter),1,32),5)
did -a atma_queues 1 %counter $gettok($read($scriptdirqueues.dat,%counter),1,32) $gettok($read($scriptdirqueues.dat,%counter),2-,32)
inc %counter
}
}
didtok atma_queues 2 5 All Users $+ $chr(5) $+ %dropdown
did -c atma_queues 2 1
}
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 $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 {
echo -s clearing user queues ( $1 )
while ($read($scriptdirqueues.dat,w,$1 *)) {
echo -s Clearing queue $read($scriptdirqueues.dat,$readn)
write -dl$readn $scriptdirqueues.dat
}
echo -s done
}
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 416 16
$iif(%prvstr,drawtext -bpc @atma_preview $colour(normal) $colour(background) Verdana -7 1 1 416 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-)