1826 lines
74 KiB
Text
Executable file
1826 lines
74 KiB
Text
Executable file
; ,d,
|
||
; ,&&HR.
|
||
; oHRMH&6b
|
||
; ./RM&M&DM9H?
|
||
; _dMRMHHRM9RMHM,
|
||
; ,&M6HM6M/9HM9HHM9.
|
||
; ,HMHHHHHH? ?M9MHHMb
|
||
; .dHMMH6HMMH? ?MRMRMML ._____________ _______. .________. _________
|
||
; .dMHM9HM9M9H/ `MMMM6M| JM#""MMMMP"*MM ``HMPMMM, HM&MMMH'' ]MMMMM[
|
||
; ,&MMMMHMM9MMM' `MMHMMM, ^' MMMM: ` |M|`MMMdMP:MMMF .dMP'?MMMb.
|
||
; ,HMMMMHMMMMMMH' `HMMMMH MMMM: JML ?MMMH :MMM6 ,HM*****MMMH\
|
||
; .dHMMM6HMMMHMHMM' `9MMMMb .~######b. ~d###b~?##:=#####b~-d####~ -d######~.
|
||
; .dMMMMMMMMMMMMMMM' 9MMMM?
|
||
; ._o#MMMMMMH9MMMMMMMM' *MMMM,
|
||
; ._o#HMMMMMMMMMMMMMMMMMMM' ?MMMH.
|
||
; ._o#HMMMMMMMMMMMMMMMMMMMMMMM' `MMMb F I L E S E R V E R
|
||
; _odHMMMMMMMMMMMMMMHH###*""""`""' `HMML ...........................
|
||
; _odHHH###*""""`"""" `HMM,
|
||
; " `HMM.
|
||
; 9MH
|
||
; ?Mb
|
||
; ?M|
|
||
; `M,
|
||
; `&.
|
||
; `\
|
||
; `|
|
||
; Atma FileServer for mIRC 6.02+
|
||
; Programmed by Correl J. Roush
|
||
; correlr@phoenixinquis.net
|
||
; www.phoenixinquis.net
|
||
;
|
||
; ASCII Art generated using Jih-Shin Ho's DOS-based program "DISPLAY"
|
||
|
||
#atma.sa off
|
||
[addon]
|
||
name=Atma FileServer
|
||
id=atma
|
||
category=FileServing
|
||
version=1.39-20041217
|
||
author=Correl J. Roush
|
||
helpfile=Atma.hlp
|
||
|
||
[dirs]
|
||
|
||
[scriptfiles]
|
||
1=atma.sa
|
||
|
||
[miscfiles]
|
||
1=Atma.hlp
|
||
2=Readme.txt
|
||
3=versioninfo.txt
|
||
|
||
[configfiles]
|
||
1=atma.dat
|
||
2=Atma.stp
|
||
3=fscache.dat
|
||
|
||
[atma.sa]
|
||
#atma.sa off
|
||
|
||
; __________________________
|
||
;/``````````````````````````
|
||
; Dialogs
|
||
|
||
dialog atma_config {
|
||
title $Atma
|
||
size -1 -1 283 147
|
||
option dbu
|
||
tab "Server Config", 1, 2 -1 278 138
|
||
box "", 156, 5 87 273 26, tab 1
|
||
check "Enable Ad", 158, 13 97 36 10, tab 1 push
|
||
radio "Normal", 163, 67 97 30 10, group tab 1
|
||
radio "CTCP", 164, 98 97 25 10, tab 1
|
||
text "Show ad every", 159, 143 98 39 8, tab 1
|
||
edit "", 160, 183 97 23 10, tab 1 right
|
||
radio "Seconds", 161, 214 101 34 9, group tab 1
|
||
radio "Minutes", 162, 214 93 33 9, tab 1
|
||
edit $Atma(InfoLine), 24, 8 76 199 10, tab 1 autohs
|
||
box "Server Info", 23, 5 69 205 19, tab 1
|
||
box "Network/Channel Setup", 166, 212 15 66 73, tab 1
|
||
button "Add", 168, 216 77 28 9, tab 1
|
||
button "Delete", 169, 247 77 28 9, tab 1
|
||
list 167, 215 45 60 31, tab 1 size
|
||
box "Configuration", 188, 113 15 97 54, tab 1
|
||
check "Respond to !list", 22, 116 54 49 10, tab 1
|
||
check "Respond to @find / @locator", 190, 116 44 87 10, tab 1
|
||
;check "Channel Enforced", 189, 116 34 55 10, tab 1
|
||
combo 194, 44 56 60 37, tab 1 size drop
|
||
text "Queue using", 195, 8 58 33 8, tab 1
|
||
text "Total", 179, 18 45 18 8, tab 1
|
||
edit $Atma(maxTSends), 182, 39 44 20 10, tab 1 right
|
||
edit $Atma(maxTQueues), 183, 62 44 20 10, tab 1 right
|
||
edit $Atma(maxUsers), 193, 84 44 20 10, tab 1 right
|
||
edit 1, 192, 84 33 20 10, tab 1 read right
|
||
edit $Atma(MaxUQueues), 184, 62 33 20 10, tab 1 right
|
||
edit $Atma(maxUSends), 181, 39 33 20 10, tab 1 right
|
||
text "Users", 180, 18 35 18 8, tab 1
|
||
text "Sends", 186, 40 23 18 8, tab 1
|
||
text "Queues", 185, 63 23 20 8, tab 1
|
||
text "Sessions", 191, 85 23 23 8, tab 1
|
||
box "Fserv Limits", 187, 5 15 106 54, tab 1
|
||
combo 197, 215 23 59 46, tab 1 size drop
|
||
check "Use Global Sends/Queues", 198, 116 24 79 10, disable tab 1
|
||
button "Add", 199, 216 35 28 9, tab 1
|
||
button "Delete", 200, 247 35 28 9, tab 1
|
||
tab "Advanced Config", 2
|
||
check "FileServer Chat", 107, 8 17 50 10, tab 2
|
||
check "Enable Channel Enforcer", 108, 8 27 74 10, tab 2
|
||
text "Limit @find / @locator to", 109, 8 37 71 10, tab 2
|
||
box "/dccallow Enforcer (DALNet Only)", 110, 163 15 115 37, tab 2
|
||
combo 111, 166 23 109 29, tab 2 size drop
|
||
box "Minimum CPS", 112, 163 53 115 34, tab 2
|
||
check "Drop sends that have been going below", 113, 166 62 106 10, tab 2
|
||
edit $Atma(MinCPS), 114, 174 73 24 10, tab 2 right
|
||
text "cps for", 115, 199 75 21 8, tab 2
|
||
edit $Atma(MinCPS.Secs), 116, 221 73 24 10, tab 2 right
|
||
text "seconds.", 117, 246 75 25 8, tab 2
|
||
box "Maximum CPS", 118, 163 88 115 25, tab 2
|
||
check "Limit sends to a max of", 119, 166 99 66 10, tab 2
|
||
edit $Atma(MaxCPS), 120, 232 99 24 10, tab 2 right
|
||
text "kb/s", 121, 257 101 18 8, tab 2
|
||
edit $Atma(@Find.Results), 129, 79 36 23 10, tab 2 right
|
||
text "results", 131, 104 37 19 8, tab 2
|
||
text "Tempban lasts for", 147, 170 38 47 8, tab 2
|
||
edit $Atma(DCCAllowEnforcer.TempBan), 148, 218 37 28 10, tab 2
|
||
text "seconds.", 149, 247 38 26 8, tab 2
|
||
check "Enable FServ find comand", 152, 8 48 74 10, tab 2
|
||
edit $Atma(fs_find.Results), 154, 57 57 23 10, tab 2 right
|
||
text "results", 155, 82 59 19 8, tab 2
|
||
box "QuickSearch Cache", 49, 5 88 156 25, tab 2
|
||
button "Rebuild Now", 128, 100 97 41 11, tab 2
|
||
check "Rebuild on mIRC startup", 127, 10 98 68 10, tab 2
|
||
text "Limit to", 196, 36 59 21 8, tab 2
|
||
tab "Statistics", 3
|
||
box "", 134, 5 15 273 98, tab 3
|
||
text "Leeched Files", 135, 50 46 41 8, tab 3
|
||
text "Leeched Bytes", 136, 50 55 41 8, tab 3
|
||
text "Record Speed", 137, 50 64 41 8, tab 3
|
||
text "Hits", 138, 50 73 41 7, tab 3
|
||
edit "", 146, 92 72 138 9, tab 3 read autohs right
|
||
edit "", 145, 92 63 138 9, tab 3 read autohs right
|
||
edit "", 144, 92 54 138 9, tab 3 read autohs right
|
||
edit "", 143, 92 45 138 9, tab 3 read autohs right
|
||
button "Reset", 139, 199 86 31 9, tab 3
|
||
tab "Triggers", 4
|
||
box "Trigger Configuration", 33, 5 15 273 98, tab 4
|
||
box "Channel Setup", 35, 209 20 66 65, tab 4
|
||
check "All active channels", 39, 213 73 60 10, disable tab 4
|
||
button "Add", 37, 213 63 28 9, disable tab 4
|
||
button "Delete", 38, 244 63 28 9, disable tab 4
|
||
list 36, 212 27 60 35, disable tab 4 size
|
||
button "...", 45, 181 88 20 9, disable tab 4
|
||
button "...", 41, 181 64 20 9, disable tab 4
|
||
edit "", 43, 7 88 169 10, tab 4 read autohs
|
||
button "Edit File", 75, 75 79 28 9, disable tab 4
|
||
button "Unset", 74, 44 79 28 9, disable tab 4
|
||
text "MOTD File", 44, 8 79 33 8, disable tab 4
|
||
edit "", 40, 7 64 169 10, tab 4 read autohs
|
||
text "Root Directory", 42, 9 56 49 8, disable 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 24 72 8, disable tab 4
|
||
combo 32, 8 24 60 43, tab 4 sort drop
|
||
tab "FServ Access", 151
|
||
box "Access Permissions", 98, 5 35 273 78, tab 151
|
||
list 100, 8 45 238 65, tab 151 sort size
|
||
button "Remove", 150, 250 71 23 11, tab 151
|
||
button "Edit", 102, 250 58 23 11, tab 151
|
||
button "Add", 101, 250 45 23 11, tab 151
|
||
box "", 104, 5 15 273 20, tab 151
|
||
radio "Denied Hosts", 133, 202 21 50 10, tab 151
|
||
radio "Allowed Hosts", 132, 143 21 50 10, tab 151
|
||
combo 103, 8 21 86 42, tab 151 size drop
|
||
tab "Ad Style", 165
|
||
box "Style Preview", 54, 5 15 273 20, tab 165
|
||
text "Format Preset:", 58, 8 44 37 8, tab 165
|
||
edit $Atma(FormatString), 57, 7 54 268 10, tab 165 autohs
|
||
check "Always strip color (automatically done on mode +c channels)", 60, 8 64 180 10, tab 165
|
||
edit The _/\tma FileServer includes the following variables for formatstring parsing: $crlf &Atma.Triggers &Atma.Users &Atma.Sends &Atma.Queues &Atma.InfoLine, 62, 6 78 272 26, tab 165 read multi
|
||
link "Click here for help on the formatstring parser", 55, 87 106 106 8, tab 165
|
||
button "Save", 63, 152 43 25 9, tab 165
|
||
button "Delete", 64, 178 43 25 9, tab 165
|
||
button "Preview", 65, 204 43 25 9, tab 165
|
||
combo 59, 50 43 90 52, tab 165 size drop
|
||
box FormatString, 56, 5 36 273 39, tab 165
|
||
icon 106, 9 23 264 8
|
||
text "Programmed by Correl J. Roush, 2002", 6, 3 139 93 8, disable
|
||
link "http://www.phoenixinquis.net/", 27, 201 139 77 8
|
||
button "okcancel", 66, 101 140 38 8, hide ok cancel
|
||
check "Start file server on connect", 25, 22 121 79 10
|
||
check "Enable FileServer", 30, 149 119 110 12, push
|
||
box "", 29, 146 113 116 21
|
||
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:{
|
||
$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(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
|
||
$iif($Atma(QuickSearchRefreshOnStart),did -c atma_config 127)
|
||
Atma.cfgTriggers
|
||
did -c $dname 132
|
||
updateAccess
|
||
$iif($readini($Atma.ini,nickComp,stripcolor),did -c atma_config 60)
|
||
didtok $dname 194 44 Number Of Files,FileSize (MB)
|
||
did $iif($Atma(Active),-b,-e) $dname 194
|
||
did -h $dname 106
|
||
did -g $dname 106 $formatstr_preview
|
||
updateChans
|
||
updateStyle
|
||
}
|
||
|
||
on *:dialog:atma_config:close:0:hsave -ob _/\tmaFS " $+ $scriptdiratma.dat $+ "
|
||
|
||
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,151,165:{
|
||
did $iif($did == 165,-v,-h) $dname 106
|
||
}
|
||
|
||
on *:dialog:atma_config:edit:*:{
|
||
$iif($did == 181,Atma maxUSends $did($dname,$did))
|
||
$iif($did == 184,Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .maxUQueues $did($dname,$did))
|
||
$iif($did == 182,Atma maxTSends $did($dname,$did))
|
||
$iif($did == 183,Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .maxTQueues $did($dname,$did))
|
||
$iif($did == 160,Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .Interval $did($dname,$did))
|
||
$iif($did == 24,Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .InfoLine $did($dname,$did))
|
||
$iif($did == 51,Atma QuickSearchRefresh.Interval $did($dname,$did))
|
||
$iif($did == 57,Atma FormatString $did($dname,$did))
|
||
$iif($did == 193,Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .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:158:{
|
||
Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .EnableAd $did($dname,$did).state
|
||
updateChans $did($dname,197).sel $did($dname,167).sel
|
||
}
|
||
|
||
on *:dialog:atma_config:sclick:162:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .IntervalUnit minutes
|
||
on *:dialog:atma_config:sclick:163:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .TriggerType Normal
|
||
on *:dialog:atma_config:sclick:164:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .TriggerType CTCP
|
||
on *:dialog:atma_config:sclick:161:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .IntervalUnit seconds
|
||
on *:dialog:atma_config:sclick:22:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .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:105:Atma.Activate
|
||
on *:dialog:atma_config:sclick:194:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .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 194
|
||
}
|
||
on *:dialog:atma_config:sclick:167:{
|
||
updateChans $did($dname,197).sel $did($dname,$did).sel
|
||
did $iif($did($dname,$did).seltext == *,-e,-b) $dname 181,182
|
||
}
|
||
on *:dialog:atma_config:sclick:168:{
|
||
var %chan = $$?="Enter a channel to configure"
|
||
$iif(!%chan,return)
|
||
if (!$regex(%chan,^[#&][^ ]*?$)) {
|
||
_errorbox Not a valid channel name
|
||
return
|
||
}
|
||
if ($istok($Atma.Channels($did($dname,197).seltext),%chan,5)) {
|
||
_errorbox Channel has already been added
|
||
return
|
||
}
|
||
Channel.Copy $did($dname,197) $+ . $+ $did($dname,167).seltext $did($dname,197) $+ . $+ %chan
|
||
updateChans $did($dname,197).sel $findtok($Atma.Channels($did($dname,197).seltext),%chan,5)
|
||
var %delay = $iif($Atma.Channels($did($dname,197).seltext,%chan).IntervalUnit == seconds,$Atma.Channels($did($dname,197).seltext,%chan).Interval,$calc($Atma.Channels($did($dname,197).seltext,%chan).Interval * 60))
|
||
.timer_/\tma. $+ %chan 0 %delay Atma.Advertise %chan
|
||
|
||
}
|
||
on *:dialog:atma_config:sclick:169:{
|
||
if ($did($dname,167).seltext == *) {
|
||
_errorbox '*' is a special system identifier for default settings. It may not be deleted.
|
||
return
|
||
}
|
||
.timer_/\tma. $+ $did($dname,167).seltext off
|
||
Atma.Config -rw Channels. $+ $did($dname,197) $+ . $+ $did($dname,167).seltext $+ *
|
||
updateChans $did($dname,197).sel
|
||
}
|
||
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:190:Atma.Config Channels. $+ $did($dname,197).seltext $+ . $+ $did($dname,167).seltext $+ .@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:197:{
|
||
updateChans $did($dname,$did).sel
|
||
}
|
||
on *:dialog:atma_config:sclick:199:{
|
||
; Add network
|
||
var %newnet = $dialog(atma_networks,atma_networks)
|
||
$iif(!%newnet,return)
|
||
if ($istok($Atma.Networks,%newnet,5)) {
|
||
_errorbox The IRC network ' $+ %newnet $+ ' is already configured.
|
||
return
|
||
}
|
||
Channel.setDefault %newnet *
|
||
updateChans $findtok($Atma.Networks,%newnet,5)
|
||
}
|
||
on *:dialog:atma_config:sclick:200:{
|
||
; Delete network
|
||
if ($did($dname,197).seltext == *) {
|
||
_errorbox '*' is a special system identifier for default settings. It may not be deleted.
|
||
return
|
||
}
|
||
$iif(!$?!="Are you sure you want to delete settings for IRC network ' $+ $did($dname,197).seltext $+ ' (this cannot be undone)?",return)
|
||
Atma.Config -rw Channels. $+ $did($dname,197).seltext $+ *
|
||
updateChans
|
||
}
|
||
on *:dialog:atma_config:sclick:139:{
|
||
Atma.Config -r Hits
|
||
Atma.Config -r LeechedFiles
|
||
Atma.Config -r LeechedBytes
|
||
Atma.Config -r RecordSpeed
|
||
updateStats
|
||
}
|
||
on *:dialog:atma_config:sclick:32:Atma.cfgTriggers $did($dname,$did).sel
|
||
on *:dialog:atma_config:sclick:34:Atma.Config Triggers. $+ $trig.encode($did($dname,32).seltext) $did($dname,$did).state
|
||
on *:dialog:atma_config:sclick:37:{
|
||
Atma.Config Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels $addtok($Atma.Config(Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels),$$?="Channel to Add?",44)
|
||
did -r $dname 36
|
||
didtok $dname 36 44 $Atma.Config(Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels)
|
||
}
|
||
on *:dialog:atma_config:sclick:38:{
|
||
Atma.Config Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels $remtok($Atma.Config(Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels),$$did($dname,36).seltext,44)
|
||
did -r $dname 36
|
||
didtok $dname 36 44 $Atma.Config(Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Channels)
|
||
}
|
||
on *:dialog:atma_config:sclick:39:{
|
||
Atma.Config Triggers. $+ $trig.encode($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
|
||
}
|
||
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
|
||
}
|
||
%NewTrigger = $trig.encode(%NewTrigger)
|
||
var %NewFSRoot
|
||
while (!%NewFSRoot) { set %NewFSRoot $sdir($mircdir,Select a directory to serve) }
|
||
var %NewFSMOTD = $sfile($mircdir,Select a text file, Use as MOTD)
|
||
Atma.Config Triggers. $+ %NewTrigger 0
|
||
Atma.Config Triggers. $+ %NewTrigger $+ .Root %NewFSRoot
|
||
Atma.Config Triggers. $+ %NewTrigger $+ .MOTD %NewFSMOTD
|
||
did -a $dname 32 %NewTrigger
|
||
Atma.cfgTriggers $findtok($didtok($dname,32,5),%NewTrigger,1,5)
|
||
}
|
||
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
|
||
}
|
||
%NewTrigger = $trig.encode(%NewTrigger)
|
||
var %counter = 1
|
||
while (%counter <= $hfind(_/\tmaFS,Triggers. $+ $trig.encode($did($dname,32).seltext) $+ *,0,w)) {
|
||
var %newEntry
|
||
.echo -q $regex($hfind(_/\tmaFS,Triggers. $+ $trig.encode($did($dname,32).seltext) $+ *,%counter,w),/^Triggers\.([^\.]*)(\..*)?/i)
|
||
%newEntry = Triggers. $+ %NewTrigger $+ $regml(2)
|
||
Atma.Config %newEntry $Atma.Config($hfind(_/\tmaFS,Triggers. $+ $trig.encode($did($dname,32).seltext) $+ *,%counter,w))
|
||
inc %counter
|
||
}
|
||
Atma.Config -rw Triggers. $+ $trig.encode($did($dname,32).seltext) $+ *
|
||
Atma.cfgTriggers 1
|
||
Atma.cfgTriggers $findtok($didtok($dname,32,5),%NewTrigger,1,5)
|
||
}
|
||
on *:dialog:atma_config:sclick:73:{
|
||
$iif(!$did($dname,32).sel,return)
|
||
$iif(!$?!="This will permanently delete the selected trigger. Do it anyway?",return)
|
||
Atma.Config -rw Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .*
|
||
Atma.Config -rw Triggers. $+ $trig.encode($did($dname,32).seltext)
|
||
Atma.cfgTriggers
|
||
}
|
||
on *:dialog:atma_config:sclick:74:{
|
||
Atma.Config -r Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .MOTD
|
||
did -r $dname 43
|
||
}
|
||
on *:dialog:atma_config:sclick:75:$iif($Atma.Config(Triggers. $+ $trig.encode($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) }
|
||
Atma.Config Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .Root %NewDir
|
||
did -o $dname 40 1 %NewDir
|
||
}
|
||
on *:dialog:atma_config:sclick:45:{
|
||
var %NewMOTD = $sfile($mircdir,Select a text file,Use as MOTD)
|
||
$iif(!%NewMOTD,return)
|
||
Atma.Config Triggers. $+ $trig.encode($did($dname,32).seltext) $+ .MOTD %NewMOTD
|
||
did -o $dname 43 1 %NewMOTD
|
||
}
|
||
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 = $trig.encode($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($Atma.Config(%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($Atma.Config(%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($Atma.Config(%Scope),3-,32)
|
||
}
|
||
on *:dialog:atma_config:sclick:150:{
|
||
$iif(!$did(atma_config,100).sel,return)
|
||
var %Scope = $trig.encode($did(atma_config,103).seltext)
|
||
$iif(%Scope == Global^32Permissions,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:{
|
||
writeini $Atma.ini 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,$trig.encode($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 249 147
|
||
option dbu
|
||
list 1, 2 6 123 126, size vsbar
|
||
box "Queue Info", 3, 131 3 117 129
|
||
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 80 105 10, disable
|
||
button "Clear all queues for this user", 11, 137 92 105 10, disable
|
||
button "Send this queue", 12, 137 104 105 10, disable
|
||
button "Send all queues for this user", 13, 137 116 105 10, disable
|
||
button "Clear All", 14, 138 135 49 10
|
||
button "Send All", 15, 192 135 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 135 42 10
|
||
button "v Move Down v", 20, 59 135 42 10
|
||
button "Add a queue", 21, 137 68 105 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:{
|
||
scid $gettok($did(atma_queues,1).seltext,3,32)
|
||
dcc send -c $gettok($did($dname,1).seltext,2,32) $gettok($did($dname,1).seltext,4-,32)
|
||
write -dl $+ $did($dname,1).sel " $+ $scriptdirqueues.dat $+ "
|
||
updateQueues
|
||
}
|
||
|
||
on *:dialog:atma_queues:sclick:13:{
|
||
scid $gettok($did(atma_queues,1).seltext,3,32)
|
||
var %regex = /^ $+ $gettok($did(atma_queues,1).seltext,2,32) $cid /
|
||
var %lines
|
||
var %counter = 1
|
||
while (%counter <= $lines($scriptdirqueues.dat)) {
|
||
var %send = $read($scriptdirqueues.dat,%counter)
|
||
if ($regex(%send,%regex)) {
|
||
dcc send -c $gettok(%send,1,32) $gettok(%send,3-,32)
|
||
; write -dl $+ %counter " $+ $scriptdirqueues.dat $+ "
|
||
%lines = $addtok(%lines,%counter,44)
|
||
}
|
||
inc %counter
|
||
}
|
||
%lines = $sorttok(%lines,44,nr)
|
||
%counter = 1
|
||
while (%counter <= $numtok(%lines,44)) {
|
||
write -dl $+ $gettok(%lines,%counter,44) " $+ $scriptdirqueues.dat $+ "
|
||
inc %counter
|
||
}
|
||
updateQueues
|
||
}
|
||
|
||
on *:dialog:atma_queues:sclick:14:{
|
||
Atma.ClearQueues
|
||
updateQueues
|
||
}
|
||
|
||
on *:dialog:atma_queues:sclick:15:{
|
||
var %counter = 1
|
||
while (%counter <= $lines($scriptdirqueues.dat)) {
|
||
var %temp = $read($scriptdirqueues.dat,%counter)
|
||
scid $gettok(%temp,2,32)
|
||
dcc send $gettok(%temp,1,32) $gettok(%temp,3-,32)
|
||
inc %counter
|
||
}
|
||
Atma.ClearQueues
|
||
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)
|
||
}
|
||
|
||
on *:dialog:atma_queues:sclick:21:{
|
||
var %nick = $?="Enter a nickname for the queue"
|
||
$iif(!%nick,return)
|
||
var %file = $sfile($mircdir,Select a file to queue for %nick,Add to Queue)
|
||
$iif(!%file,return)
|
||
write " $+ $scriptdirqueues.dat $+ " %nick $cid %file
|
||
Atma.ProcessQueues
|
||
updateQueues
|
||
}
|
||
|
||
dialog atma_networks {
|
||
title Select Network
|
||
size -1 -1 95 89
|
||
option dbu
|
||
button "OK", 2, 4 78 42 9, default ok
|
||
list 3, 3 27 89 50, sort size
|
||
text "Select the IRC network that you would like to configure from the list below.", 4, 3 3 88 22, center
|
||
button "Cancel", 5, 49 78 42 9, cancel
|
||
edit "", 6, 6 64 53 10, hide result
|
||
}
|
||
|
||
on *:dialog:atma_networks:init:0:{
|
||
var %counter = 1
|
||
while (%counter <= $server(0)) {
|
||
$iif(!$didwm($dname,3,$server(%counter).group),did -a $dname 3 $server(%counter).group)
|
||
inc %counter
|
||
}
|
||
if ($server(0)) {
|
||
did -c $dname 3 1
|
||
did -o $dname 6 1 $did($dname,3).seltext
|
||
}
|
||
}
|
||
|
||
on *:dialog:atma_networks:sclick:3:{
|
||
did -o $dname 6 1 $did($dname,$did).seltext
|
||
}
|
||
|
||
; __________________________
|
||
;/``````````````````````````
|
||
; 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
|
||
.Chat with fserv users: Atma.Chat
|
||
.-
|
||
.Preview Ad: {
|
||
var %ad = $replace($parse_formatstr(*,$Atma(FormatString)),&\,$chr(13))
|
||
var %counter = 1
|
||
while (%counter <= $numtok(%ad,13)) {
|
||
echo -a $gettok(%ad,%counter,13)
|
||
inc %counter
|
||
}
|
||
}
|
||
. $iif($chan,Show to $chan) : {
|
||
var %ad = $replace($parse_formatstr($chan,$Atma(FormatString)),&\,$chr(13))
|
||
var %counter = 1
|
||
while (%counter <= $numtok(%ad,13)) {
|
||
msg $chan $gettok(%ad,%counter,13)
|
||
inc %counter
|
||
}
|
||
}
|
||
. $iif($1,Show to $1) : {
|
||
var %ad = $replace($parse_formatstr(*,$Atma(FormatString)),&\,$chr(13))
|
||
var %counter = 1
|
||
while (%counter <= $numtok(%ad,13)) {
|
||
msg $1 $gettok(%ad,%counter,13)
|
||
inc %counter
|
||
}
|
||
}
|
||
.-
|
||
.Reload: reload -rs " $+ $script $+ "
|
||
.Unload: unload -rs " $+ $script $+ "
|
||
}
|
||
|
||
; __________________________
|
||
;/``````````````````````````
|
||
; Remotes
|
||
|
||
on *:load:{
|
||
$iif(!$Atma.Config(Channels.*.*.TriggerType),Channel.setDefault * *)
|
||
$iif(!$ini($Atma.ini,Atma),Atma.createdefaultini)
|
||
$iif($server && $Atma(StartOnConnect),Atma.Activate)
|
||
}
|
||
|
||
on *:unload:{
|
||
atma.deactivate --force
|
||
}
|
||
|
||
on *:start:{
|
||
|
||
if ($version < 6.02) {
|
||
echo 4 -s ATMA REQUIRES mIRC VERSION 6.02 OR HIGHER, UNLOADING...
|
||
unload -rs " $+ $script $+ "
|
||
return
|
||
}
|
||
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.dat
|
||
$iif(!$hget(_/\tmaFS),hmake _/\tmaFS 10)
|
||
$iif($findfile($scriptdir,atma.dat,1),hload -b _/\tmaFS " $+ $ifmatch $+ ")
|
||
$iif(!$Atma.Config(Channels.*.*.TriggerType),Channel.setDefault * *)
|
||
$iif(!$hget(_/\tmaFS.Cache),hmake _/\tmaFS.Cache 1000)
|
||
$iif($findfile($scriptdir,fscache.dat,1),hload -b _/\tmaFS.Cache " $+ $ifmatch $+ ")
|
||
$iif($Atma(QuickSearchRefreshOnStart),Atma.CacheTriggers)
|
||
$iif(!$hget(_/\tmaFS.STP),hmake _/\tmaFS.STP 10)
|
||
$iif($findfile($scriptdir,Atma.stp,1),hload -b _/\tmaFS.STP " $+ $ifmatch $+ ",Atma.createdefaultstp)
|
||
|
||
$iif($exists(" $+ $scriptdirqueues.dat $+ "),.remove " $+ $scriptdirqueues.dat $+ ")
|
||
}
|
||
|
||
on *:connect:{
|
||
var %counter = 1
|
||
while (%counter <= $scon(0)) {
|
||
$iif(($scon(%counter).status == connected) && (%counter != $cid),return)
|
||
inc %counter
|
||
}
|
||
$iif($Atma(StartOnConnect),Atma.Activate)
|
||
}
|
||
|
||
on *:exit:{
|
||
atma.deactivate --force
|
||
return
|
||
}
|
||
|
||
on *:text:*:#:{
|
||
if ($Atma.Channels($Atma.Networks($networkname),$chan).@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 $+ $trig.decode($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(Active)) && ($Atma.Channels($Atma.Networks($networkname),$chan).RespondToList) && ($Atma.Triggers($chan))) {
|
||
var %ad = $replace($parse_formatstr($chan,$Atma(FormatString)),&\,$chr(13))
|
||
var %counter = 1
|
||
while (%counter <= $numtok(%ad,13)) {
|
||
.notice $nick $gettok(%ad,%counter,13)
|
||
inc %counter
|
||
}
|
||
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.Channels($Atma.Networks($networkname),$chan).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),$trig.encode($1-)),1,32) == DENIED) { .notice $nick $gettok($Atma.Access($address($nick,5),$trig.encode($1-)),2-,32) | return }
|
||
|
||
Atma.Config Hits $calc($Atma.Config(Hits) + 1)
|
||
updateStats
|
||
var %FSDir = " $+ $Atma.Config(Triggers. $+ $trig.encode($1-) $+ .Root) $+ "
|
||
var %FSMOTD = " $+ $Atma.Config(Triggers. $+ $trig.encode($1-) $+ .MOTD) $+ "
|
||
|
||
;Fserv session handling -- CONNECTING
|
||
hadd -m _/\tmaFS.Sessions $nick CONNECTING
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .Channel $chan
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .Trigger $1-
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .ConnectTime $ctime
|
||
|
||
fserve $nick $Atma(maxTSends) %FSDir %FSMOTD
|
||
}
|
||
ctcp *:*:?:{
|
||
$iif($1- == VERSION, ctcpreply $nick VERSION $Atma )
|
||
$iif(!$istok($Atma.Triggers,$1-,5),return)
|
||
if (!$Atma(Active)) { .notice $nick The FileServer is not available at this time. Please try again later. | return }
|
||
|
||
;Gotta figure out what chan the user may have triggered from, since ctcp isn't chan specific
|
||
;Of course, if a chan can't be found, then user must not have triggered from any channel, so foo on them
|
||
var %trigchan
|
||
var %counter = 1
|
||
while (%counter <= $numtok($Atma.Channels($Atma.Networks($networkname)),5)) {
|
||
var %chan = $gettok($Atma.Channels($Atma.Networks($networkname)),%counter,5)
|
||
if (%chan == *) {
|
||
var %counter2 = 1
|
||
while (%counter2 <= $numtok($Atma.Channels($Atma.Networks($networkname),*),44)) {
|
||
var %chan = $gettok($Atma.Channels($Atma.Networks($networkname),*),%counter,44)
|
||
if (($Atma.Channels($Atma.Networks($networkname),%chan).TriggerType == CTCP) && ($nick ison %chan) && ($istok($Atma.Triggers(%chan),$1-,5))) set %trigchan %chan
|
||
inc %counter2
|
||
}
|
||
}
|
||
else {
|
||
if (($Atma.Channels($Atma.Networks($networkname),%chan).TriggerType == CTCP) && ($nick ison %chan) && ($istok($Atma.Triggers(%chan),$1-,5))) set %trigchan %chan
|
||
}
|
||
inc %counter
|
||
}
|
||
$iif(!%trigchan,return)
|
||
|
||
var %FSDir = " $+ $Atma.Config(Triggers. $+ $trig.encode($1-) $+ .Root) $+ "
|
||
var %FSMOTD = " $+ $Atma.Config(Triggers. $+ $trig.encode($1-) $+ .MOTD) $+ "
|
||
|
||
;Fserv session handling -- CONNECTING
|
||
hadd -m _/\tmaFS.Sessions $nick CONNECTING
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .CID $cid
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .Channel %trigchan
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .Trigger $1-
|
||
hadd -m _/\tmaFS.Sessions $nick $+ .ConnectTime $ctime
|
||
|
||
fserve $nick $Atma(maxTSends) %FSDir %FSMOTD
|
||
}
|
||
on *:open:!:{
|
||
;Session handling -- CONNECTED
|
||
hadd -m _/\tmaFS.Sessions $nick CONNECTED
|
||
|
||
if ($window(@fserv-chat)) {
|
||
aline -l @fserv-chat $nick $+ / $+ $network
|
||
aline @fserv-chat -- $+ $nick $+ / $+ $network has joined the fserv
|
||
if ($active != @fserv-chat) { window -g3 @fserv-chat }
|
||
}
|
||
var %counter = 1
|
||
while (%counter <= $fserv(0)) {
|
||
if ($fserv(%counter) == $nick) { inc %counter | continue }
|
||
msg = $+ $fserv(%counter) -- $+ $nick $+ / $+ $network has joined the fserv
|
||
inc %counter
|
||
}
|
||
|
||
var %chan = $Atma.Channels($Atma.Networks($networkname),$Atma.Sessions($nick).Channel)
|
||
|
||
msg =$nick - $+ $Atma
|
||
msg =$nick - Programmed by Correl J. Roush (correlr@phoenixinquis.net) 2002
|
||
msg =$nick - ______________________________________________________________
|
||
msg =$nick - $Atma.Channels($Atma.Networks($networkname),%chan).InfoLine
|
||
msg =$nick -
|
||
msg =$nick - You may have up to $Atma(maxUSends) simultaneous file sends, and up to $Atma.Channels($Atma.Networks($networkname),%chan).maxUQueues $iif($Atma.Channels($Atma.Networks($networkname),%chan).QueueUsing == FileSize,MB worth of) queued files.
|
||
msg =$nick - The FServ is limited to a maximum of $Atma(maxTSends) simultaneous file sends and $Atma.Channels($Atma.Networks($networkname),%chan).maxTQueues $iif($Atma.Channels($Atma.Networks($networkname),%chan).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(MinCPS.Enabled),msg =$nick - ***MinCPS is enabled; sends from this server may not drop below $Atma(MinCPS) CPS for more than $Atma(MinCPS.secs) seconds or they will be terminated.)
|
||
$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 *:close:!:{
|
||
;FServ session handling -- CLOSED
|
||
$iif($hget(_/\tmaFS.Sessions),hdel -w _/\tmaFS.Sessions $nick $+ *)
|
||
var %counter = 1
|
||
while (%counter <= $fserv(0)) {
|
||
if ($nick != $fserv(%counter)) {
|
||
msg = $+ $fserv(%counter) -- $+ $nick $+ / $+ $network has left the fserv
|
||
}
|
||
inc %counter
|
||
}
|
||
if ($window(@fserv-chat)) {
|
||
dline -l @fserv-chat $fline(@fserv-chat,$nick $+ / $+ $network,1,1)
|
||
aline @fserv-chat -- $+ $nick $+ / $+ $network has left the fserv
|
||
if ($active != @fserv-chat) { window -g3 @fserv-chat }
|
||
}
|
||
}
|
||
on *:nick:{
|
||
$iif(!$Atma.Queue($nick),return)
|
||
var %counter = 1
|
||
while (%counter <= $lines($scriptdirqueues.dat)) {
|
||
write -l $+ %counter " $+ $scriptdirqueues.dat $+ " $replace($read($scriptdirqueues.dat, %counter),$nick,$newnick)
|
||
inc %counter
|
||
notice $newnick Your fserv queues have been successfully switched to point to your new nickname. [AtmaFserv]
|
||
}
|
||
if ($fserv($nick)) {
|
||
close -f $nick
|
||
notice $newnick Your fserv connection was closed due to a change in nickname. Please reconnect to ensure that files are queued under your new nickname. [AtmaFserv]
|
||
}
|
||
}
|
||
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),3-,32)) ( $+ $bytes($file($gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),3-,32)).size).suf $+ ) through IRC server $servername($scid($gettok($read(" $+ $scriptdirqueues.dat $+ ",%counter),2-,32)))
|
||
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 $+ $trig.decode($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 $+ / $+ $network $+ ) $1-)
|
||
inc %counter
|
||
}
|
||
if ($window(@fserv-chat)) {
|
||
aline @fserv-chat ( $+ $nick $+ / $+ $network $+ ) $1-
|
||
if ($active != @fserv-chat) { window -g1 @fserv-chat }
|
||
}
|
||
halt
|
||
}
|
||
msg =$nick - " $+ $1 $+ " is not a recognized command. Type help for a list of available commands.
|
||
halt
|
||
}
|
||
on *:input:@fserv-chat:{
|
||
if ($left($1,1) == /) { $eval($1-,2) | halt }
|
||
var %counter = 1
|
||
aline @fserv-chat ( $+ $me $+ ) $1-
|
||
while (%counter <= $fserv(0)) {
|
||
msg = $+ $fserv(%counter) ( $+ $me $+ ) $1-
|
||
inc %counter
|
||
}
|
||
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
|
||
}
|
||
Atma.Config LeechedFiles $calc($Atma.Config(LeechedFiles) + 1)
|
||
Atma.Config LeechedBytes $calc($Atma.Config(LeechedBytes) + $send($nick,%sendwindow).sent)
|
||
$iif($iif($gettok($Atma.Config(RecordSpeed),2,32),$ifmatch,0) < $send($nick,%sendwindow).cps,Atma.Config RecordSpeed $nick $send($nick,%sendwindow).cps)
|
||
updateStats
|
||
.timer 1 1 Atma.ProcessQueues
|
||
.timer_/\tma.CheckMinCPS.Terminate off
|
||
}
|
||
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 sends and waiting queues have been cleared [ $+ $Atma Channel Enforcer]
|
||
Atma.ClearQueues $nick
|
||
close -s $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 $readini($script,addon,version) }
|
||
|
||
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.Config {
|
||
$iif(!$hget(_/\tmaFS),hmake _/\tmaFS 10)
|
||
if (!$isid) {
|
||
if ($regex($1,/^-r(w)?/i)) {
|
||
$iif(!$2,return)
|
||
var %item = $replace($2-,$chr(32),$chr(46))
|
||
hdel $iif($regml(1),- $+ $ifmatch) _/\tmaFS %item
|
||
}
|
||
else {
|
||
hadd _/\tmaFS $1-
|
||
}
|
||
}
|
||
else {
|
||
return $eval($ $+ hget(_/\tmaFS,$1-) $+ $iif($prop,. $+ $prop),2)
|
||
}
|
||
hsave -ob _/\tmaFS " $+ $scriptdiratma.dat $+ "
|
||
}
|
||
|
||
alias Atma.Help { run " $+ $scriptdirAtma.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 IntervalUnit 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
|
||
var %counter = 1
|
||
var %connection = 1
|
||
|
||
while ( %connection <= $scon(0) ) {
|
||
scon %connection
|
||
var %counter = 1
|
||
while (%counter <= $numtok($Atma.Channels($Atma.Networks($networkname)),5)) {
|
||
var %chan = $gettok($Atma.Channels($Atma.Networks($networkname)),%counter,5)
|
||
var %delay = $iif($Atma.Channels($Atma.Networks($networkname),%chan).IntervalUnit == seconds,$Atma.Channels($Atma.Networks($networkname),%chan).Interval,$calc($Atma.Channels($Atma.Networks($networkname),%chan).Interval * 60))
|
||
.timer_/\tma. $+ $server $+ . $+ %chan 0 %delay Atma.Advertise %chan
|
||
Atma.Advertise %chan
|
||
inc %counter
|
||
}
|
||
inc %connection
|
||
}
|
||
if ($Atma(MinCPS.Enabled)) {
|
||
.timer_/\tma.MinCPS 0 5 Atma.CheckMinCPS
|
||
}
|
||
.timer_/\tma.AuditAccess 0 5 Atma.Access.Audit
|
||
}
|
||
|
||
alias Atma.Deactivate {
|
||
$iif($1 != --force,$iif(!$input(This will halt the fserv and clear all waiting queues. Shut down anyway?,264,$Atma),return))
|
||
writeini $Atma.ini Atma Active 0
|
||
var %connection = 1
|
||
while ( %connection <= $scon(0) ) {
|
||
.timer_/\tma* off
|
||
inc %connection
|
||
}
|
||
$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)
|
||
%Atma.Triggers = $trig.decode(%Atma.Triggers)
|
||
$iif($prop != Formatted,return %Atma.Triggers)
|
||
var %Atma.Triggers.Formatted = $gettok(%Atma.Triggers,1,5)
|
||
$iif(%Atma.Triggers.Formatted && ($Atma.Config(Channels. $+ $Atma.Networks($networkname) $+ . $+ $iif($1,$Atma.Channels($Atma.Networks($networkname),$1),*) $+ .TriggerType) == CTCP),%Atma.Triggers.Formatted = /ctcp $me %Atma.Triggers.Formatted)
|
||
%counter = 2
|
||
while (%counter <= $numtok(%Atma.Triggers,5)) {
|
||
if ($Atma.Config(Channels. $+ $Atma.Networks($networkname) $+ . $+ $iif($1,$Atma.Channels($Atma.Networks($networkname),$1),*) $+ .TriggerType) == CTCP) {
|
||
%Atma.Triggers.Formatted = %Atma.Triggers.Formatted & /ctcp $me $gettok(%Atma.Triggers,%counter,5)
|
||
}
|
||
else {
|
||
%Atma.Triggers.Formatted = %Atma.Triggers.Formatted & $gettok(%Atma.Triggers,%counter,5)
|
||
}
|
||
inc %counter
|
||
}
|
||
|
||
return %Atma.Triggers.Formatted
|
||
}
|
||
|
||
alias Atma.Channels {
|
||
var %Atma.Channels
|
||
var %network = $iif($1,$1,$Atma.Networks($networkname))
|
||
|
||
var %counter = 1
|
||
while (%counter <= $hget(_/\tmaFS,0).item) {
|
||
var %regex = /^Channels\. $+ $regex.encode(%network) $+ \.([^\.]*)$/i
|
||
if ($regex($hget(_/\tmaFS,%counter).item,%regex)) {
|
||
%Atma.Channels = $addtok(%Atma.Channels,$regml(1),5)
|
||
}
|
||
inc %counter
|
||
}
|
||
if (!$2) {
|
||
return $sorttok(%Atma.Channels,5,r)
|
||
}
|
||
if (($2 == *) && !$prop) {
|
||
var %chans
|
||
var %counter = 1
|
||
while (%counter <= $chan(0)) {
|
||
if (!$istok(%Atma.Channels,$chan(%counter),5)) set %chans $addtok(%chans,$chan(%counter),44)
|
||
inc %counter
|
||
}
|
||
return %chans
|
||
}
|
||
var %chan = $iif($istok(%Atma.Channels,$2,5),$2,*)
|
||
$iif(!$prop,return %chan)
|
||
return $Atma.Config(Channels. $+ %network $+ . $+ %chan $+ . $+ $prop)
|
||
}
|
||
|
||
alias Atma.Networks {
|
||
var %Atma.Networks
|
||
var %counter = 1
|
||
while (%counter <= $hget(_/\tmaFS,0).item) {
|
||
var %regex = /^Channels\.([^\.]*)\.\*$/i
|
||
if ($regex($hget(_/\tmaFS,%counter).item,%regex)) {
|
||
%Atma.Networks = $addtok(%Atma.Networks,$regml(1),5)
|
||
}
|
||
inc %counter
|
||
}
|
||
if (!$1) {
|
||
return $sorttok(%Atma.Networks,5,r)
|
||
}
|
||
if (($1 == *) && !$prop) {
|
||
var %nets
|
||
var %counter = 1
|
||
while (%counter <= $scon(0)) {
|
||
var %network $iif($scon(%counter).$network,$ifmatch,{unknown})
|
||
if (!$istok(%Atma.Networks,%network,5)) set %nets $addtok(%nets,%network,44)
|
||
inc %counter
|
||
}
|
||
return $reptok(%nets,{unknown},*,5)
|
||
}
|
||
var %net = $iif($istok(%Atma.Networks,$1,5),$1,*)
|
||
$iif(!$prop,return %net)
|
||
}
|
||
|
||
alias Atma.Sessions {
|
||
$iif(!$1,return)
|
||
$iif(!$prop,return $hget(_/\tmaFS.Sessions,$1))
|
||
return $hget(_/\tmaFS.Sessions,$1 $+ . $+ $prop)
|
||
}
|
||
|
||
alias -l Channel.setDefault {
|
||
$iif(!$2,return)
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 1
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .MaxUQueues 20
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .MaxTQueues 99
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .MaxUsers 10
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .QueueUsing FileCount
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .@Find 1
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .RespondToList 1
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .InfoLine $Atma
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .EnableAd 1
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .TriggerType Normal
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .Interval 30
|
||
Atma.Config Channels. $+ $1 $+ . $+ $2 $+ .IntervalUnit minutes
|
||
}
|
||
alias -l Channel.Copy {
|
||
$iif(!$2,return)
|
||
var %counter = 1
|
||
while (%counter <= $hfind(_/\tmaFS,/^ $+ $regex.encode(Channels. $+ $1)/i,0,r)) {
|
||
var %source = $hfind(_/\tmaFS,/^ $+ $regex.encode(Channels. $+ $1)/i,%counter,r)
|
||
.echo -q $regex(%source,/^Channels\..*?\..*?\.(.*)/i)
|
||
var %dest = Channels. $+ $2 $+ $iif($regml(1),. $+ $regml(1))
|
||
Atma.Config %dest $Atma.Config(%source)
|
||
inc %counter
|
||
}
|
||
}
|
||
|
||
alias Atma.Advertise {
|
||
if (!$1) {
|
||
Atma.AdvertiseAll
|
||
return
|
||
}
|
||
if ($1 == *) {
|
||
Atma.AdvertiseMulti
|
||
return
|
||
}
|
||
if (($me ison $1) && ($Atma.Channels($Atma.Networks($networkname),$1).EnableAd)) {
|
||
if ($Atma.Triggers($1)) {
|
||
var %ad = $replace($parse_formatstr($1,$Atma(FormatString)),&\,$chr(13))
|
||
var %counter = 1
|
||
while (%counter <= $numtok(%ad,13)) {
|
||
msg $1 $gettok(%ad,%counter,13)
|
||
inc %counter
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
alias -l Atma.AdvertiseMulti {
|
||
var %chans
|
||
var %con = 1
|
||
var %counter = 1
|
||
while (%counter <= $numtok($Atma.Channels($Atma.Networks($networkname),*),44)) {
|
||
%chan = $gettok($Atma.Channels($Atma.Networks($networkname),*),%counter,44)
|
||
Atma.Advertise %chan
|
||
inc %counter
|
||
}
|
||
}
|
||
|
||
alias -l Atma.AdvertiseAll {
|
||
var %counter = 1
|
||
while (%counter <= $scon(0)) {
|
||
scon %counter
|
||
var %counter2 = 1
|
||
while (%counter2 <= $chan(0)) {
|
||
atma.advertise $chan(%counter2)
|
||
inc %counter2
|
||
}
|
||
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 42
|
||
did %action atma_config 44
|
||
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 = $trig.encode($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
|
||
|
||
}
|
||
else {
|
||
did -c atma_config 103 1
|
||
}
|
||
}
|
||
|
||
alias -l updateChans {
|
||
did -r atma_config 197
|
||
didtok atma_config 197 5 $Atma.Networks
|
||
did -c atma_config 197 $iif($1,$1,1)
|
||
|
||
did -r atma_config 167
|
||
didtok atma_config 167 5 $Atma.Channels($did(atma_config,197).seltext)
|
||
did -c atma_config 167 $iif($2,$2,1)
|
||
|
||
var %net = $did(atma_config,197).seltext
|
||
var %chan = $did(atma_config,167).seltext
|
||
|
||
did -o atma_config 181 1 $Atma(MaxUSends)
|
||
did -o atma_config 182 1 $Atma(MaxTSends)
|
||
did -o atma_config 184 1 $Atma.Channels(%net,%chan).MaxUQueues
|
||
did -o atma_config 183 1 $Atma.Channels(%net,%chan).MaxTQueues
|
||
did -o atma_config 193 1 $Atma.Channels(%net,%chan).MaxUsers
|
||
|
||
did -c atma_config 194 $iif($Atma.Channels(%net,%chan).QueueUsing == FileCount,1,2)
|
||
|
||
did $iif($Atma.Channels(%net,%chan).@Find,-c,-u) atma_config 190
|
||
did $iif($Atma.Channels(%net,%chan).RespondToList,-c,-u) atma_config 22
|
||
|
||
did $iif($Atma.Channels(%net,%chan).EnableAd,-c,-u) atma_config 158
|
||
|
||
did $iif($Atma.Channels(%net,%chan).TriggerType == Normal,-c,-u) atma_config 163
|
||
did $iif($Atma.Channels(%net,%chan).TriggerType == CTCP,-c,-u) atma_config 164
|
||
|
||
did -o atma_config 160 1 $Atma.Channels(%net,%chan).Interval
|
||
|
||
did $iif($Atma.Channels(%net,%chan).IntervalUnit == Minutes,-c,-u) atma_config 162
|
||
did $iif($Atma.Channels(%net,%chan).IntervalUnit == Seconds,-c,-u) atma_config 161
|
||
|
||
did -o atma_config 24 1 $Atma.Channels(%net,%chan).InfoLine
|
||
}
|
||
|
||
alias -l updateStats {
|
||
$iif(!$dialog(atma_config),return)
|
||
did -o atma_config 143 1 $iif($Atma.Config(LeechedFiles),$ifmatch,0)
|
||
did -o atma_config 144 1 $iif($Atma.Config(LeechedBytes),$bytes($ifmatch).suf ( $+ $ifmatch bytes),0 bytes)
|
||
did -o atma_config 145 1 $iif($Atma.Config(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($Atma.Config(Hits),$ifmatch,0)
|
||
}
|
||
|
||
alias -l updateAccess {
|
||
var %Scope = $trig.encode($did(atma_config,103).seltext)
|
||
did -r atma_config 100
|
||
$iif(%Scope == Global^32Permissions,set %Scope Access.,set %Scope Triggers. $+ %Scope $+ .Access.)
|
||
var %counter = 1
|
||
while (%counter <= $hfind(_/\tmaFS,%Scope $+ *,0,w)) {
|
||
if ($gettok($Atma.Config($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($Atma.Config($hfind(_/\tmaFS,%Scope $+ *,%counter,w)),2,32),$asctime($ifmatch),Never Expires) $+ ) $gettok($Atma.Config($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
|
||
$iif(!$lines(" $+ $scriptdirqueues.dat $+ "),return)
|
||
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) ( $+ $servername($gettok($did(atma_queues,1).seltext,3,32)) $+ )
|
||
did -o atma_queues 7 1 $nopath($gettok($did(atma_queues,1).seltext,4-,32))
|
||
did -o atma_queues 9 1 $bytes($file($gettok($did(atma_queues,1).seltext,4-,32)).size,3).suf
|
||
did -e atma_queues 10,11,12,13
|
||
}
|
||
|
||
alias Atma.SendFile {
|
||
;Atma.Sendfile $nick $file
|
||
|
||
var %chan = $Atma.Channels($Atma.Networks($networkname),$Atma.Sessions($1).Channel)
|
||
$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 -cl $+ $iif($Atma(MaxCPS.Enabled),$calc($Atma(MaxCPS)*1000),0) $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 $iif($2,$2,.*) /i
|
||
if ($prop == size) {
|
||
if ($2) {
|
||
return $bytes($file($gettok($hget(_/\tmaFS.Queues,$hfind(_/\tmaFS.Queues,%regex,$2,r).data),2-,32)).size,m)
|
||
}
|
||
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 {
|
||
if ($2) {
|
||
return $hget(_/\tmaFS.Queues,$hfind(_/\tmaFS.Queues,%regex,$2,r).data)
|
||
}
|
||
else {
|
||
return $hfind(_/\tmaFS.Queues,%regex,0,r).data
|
||
}
|
||
}
|
||
|
||
}
|
||
else {
|
||
Atma.AddQueue $1 $cid $2-
|
||
}
|
||
}
|
||
|
||
alias -l Atma.AddQueue {
|
||
$iif(!$3-,return)
|
||
var %chan = $Atma.Channels($Atma.Networks($networkname),$Atma.Sessions($1).Channel)
|
||
var %regex = /^ $+ $1 $2 $regex.encode($3-) $+ $ $+ /i
|
||
if ($hfind(_/\tmaFS.Queues,%regex,0,r).data) {
|
||
msg =$nick You have already queued the file $nopath($3-)
|
||
}
|
||
else {
|
||
if ($Atma.Queue($1).Count >= $Atma.Channels($Atma.Networks($networkname),%chan).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.Channels($Atma.Networks($networkname),%chan).maxUQueues) {
|
||
msg =$nick You have reached your maximum queue limit. Wait for some of your sends to finish, then try again.
|
||
return
|
||
}
|
||
write " $+ $scriptdirqueues.dat $+ " $1 $2 $3-
|
||
msg =$nick Your file ( $+ $nopath($3-) $+ ) has been queued into slot $lines(" $+ $scriptdirqueues.dat $+ ")
|
||
}
|
||
}
|
||
|
||
alias Atma.ProcessQueues {
|
||
$iif(!$lines(" $+ $scriptdirqueues.dat $+ "),return)
|
||
|
||
var %queue = 1
|
||
while ($Atma.Sends < $Atma(maxTSends)) {
|
||
if (%queue > $lines(" $+ $scriptdirqueues.dat $+ ")) { return }
|
||
var %qtext = $read(" $+ $scriptdirqueues.dat $+ ",%queue)
|
||
if ($Atma.Sends($gettok(%qtext,1,32)) >= $Atma(maxUSends)) { inc %queue | continue }
|
||
scid $gettok(%qtext,2,32)
|
||
.dcc maxcps $iif
|
||
.dcc maxcps $iif($Atma(MaxCPS.Enabled),$calc($Atma(MaxCPS)*1000),0)
|
||
dcc send -cl $+ $iif($Atma(MaxCPS.Enabled),$calc($Atma(MaxCPS)*1000),0) $gettok(%qtext,1,32) $gettok(%qtext,3-,32)
|
||
write -dl $+ %queue " $+ $scriptdirqueues.dat $+ "
|
||
inc %queue
|
||
}
|
||
}
|
||
|
||
alias Atma.ClearQueues {
|
||
while ($read(" $+ $scriptdirqueues.dat $+ ",w,$1 *)) {
|
||
var %line = $readn
|
||
write -dl $+ %line " $+ $scriptdirqueues.dat $+ "
|
||
}
|
||
}
|
||
|
||
alias -l RelativePath {
|
||
;var %regex = /^ $+ $replace($1,\,\\) $+ (.*?)$/
|
||
var %regex = /^ $+ $regex.encode($1) $+ (.*?)$/
|
||
var %relativepath
|
||
.echo -q $regex(relpath,$2,%regex)
|
||
debug.print $lower(\ $+ $regml(relpath,1))
|
||
return \ $+ $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)
|
||
$iif(!$Atma.Triggers,return)
|
||
var %Atma.Triggers = $trig.encode($Atma.Triggers)
|
||
hmake _/\tmaFS.Cache 1000
|
||
echo -s AtmaFS: Caching FServ files...
|
||
var %starttime = $ticks
|
||
var %counter = 1
|
||
var %filecount = 0
|
||
while (%counter <= $numtok(%Atma.Triggers,5)) {
|
||
var %files = $findfile($Atma.Config(Triggers. $+ $gettok(%Atma.Triggers,%counter,5) $+ .Root),*.*,0,hadd _/\tmaFS.Cache $gettok(%Atma.Triggers,%counter,5) $+ $chr(5) $+ $RelativePath($Atma.Config(Triggers. $+ $gettok(%Atma.Triggers,%counter,5) $+ .Root),$1-) $file($1-).size)
|
||
var %fcount
|
||
echo -s $gettok($Atma.Triggers,%counter,5) -- Cached %files files
|
||
inc %filecount %files
|
||
inc %counter
|
||
}
|
||
hsave -ob _/\tmaFS.Cache " $+ $scriptdirfscache.dat $+ "
|
||
echo -s Finished caching %filecount FServ files ( $+ $calc(($ticks - %starttime) / 1000) seconds , $calc(%filecount / (($ticks - %starttime) / 1000)) files per second $+ ).
|
||
;window -c @Atma
|
||
}
|
||
|
||
alias Atma.QuickSearch {
|
||
$iif(!$1,return 0)
|
||
var %search = * $+ $1 $+ *
|
||
return $iif($2 && ($prop == size),$hget(_/\tmaFS.Cache,$hfind(_/\tmaFS.Cache,%search,$iif($2,$2,0),w)),$replace($hfind(_/\tmaFS.Cache,%search,$iif($2,$2,0),w),$chr(5),$chr(32)))
|
||
}
|
||
alias -l formatstr_preview {
|
||
;modded considerably from ZeeG's $xd.p previewing alias in xServ
|
||
|
||
var %preview = " $+ $scriptdiratma-preview.bmp $+ "
|
||
var %prvstr = $parse_formatstr(#pinet,$did(atma_config,57))
|
||
window -phf @atma_preview 0 0 528 16
|
||
$iif(%prvstr,drawtext -bpc @atma_preview $colour(normal) $colour(background) verdana -7 1 1 528 16 %prvstr)
|
||
drawsave @atma_preview %preview
|
||
window -c @atma_preview
|
||
return %preview
|
||
}
|
||
|
||
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($trig.encode($Atma.Triggers),$2,5),return)
|
||
|
||
var %Trig.AllowList = 0
|
||
var %Trig.Allowed = 0
|
||
var %regex = /^Triggers. $+ $replace($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($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),1,32) == DENY)) {
|
||
return DENIED You are banned from using this trigger. Reason:( $gettok($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),3-,32) ) (Ban Expires: $iif($gettok($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),2,32),$asctime($ifmatch) / Current time = $asctime($ctime),Never) )
|
||
}
|
||
if ($gettok($Atma.Config($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($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),1,32) == DENY)) {
|
||
return DENIED You are banned from using this FileServer. Reason:( $gettok($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),3-,32) ) (Ban Expires: $iif($gettok($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),2,32),$asctime($ifmatch) / Current time = $asctime($ctime),Never) )
|
||
}
|
||
if ($gettok($Atma.Config($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-
|
||
}
|
||
|
||
alias -l Atma.Access.Remove {
|
||
var %Scope = $iif($2 != Global,Triggers. $+ $2 $+ .Access.,Access.)
|
||
Atma.Config -r %Scope $+ $1
|
||
}
|
||
|
||
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($Atma.Config($hfind(_/\tmaFS,%regex,%counter,r)),2,32)
|
||
if (%expires && (%expires < $ctime)) {
|
||
debug.print PERMISSION $hfind(_/\tmaFS,%regex,%counter,r) EXPIRED, PURGED
|
||
Atma.Config -r $hfind(_/\tmaFS,%regex,%counter,r)
|
||
}
|
||
}
|
||
inc %counter
|
||
}
|
||
}
|
||
|
||
alias Atma.Chat {
|
||
if ($window(@fserv-chat)) { return }
|
||
window -el15 @fserv-chat
|
||
aline -l @fserv-chat @ $+ $me
|
||
var %counter = 1
|
||
while (%counter <= $fserv(0)) {
|
||
aline -l @fserv-chat $fserv(%counter) $+ / $+ $scid($fserv(%counter).cid).network
|
||
inc %counter
|
||
}
|
||
}
|
||
|
||
alias -l trig.encode {
|
||
return $replace($1-, $&
|
||
$chr(32),^32, $&
|
||
$chr(46),^46)
|
||
}
|
||
alias -l trig.decode {
|
||
return $replace($1-, $&
|
||
^32,$chr(32), $&
|
||
^46,$chr(46))
|
||
}
|
||
alias -l regex.encode {
|
||
return $replace($1-, $&
|
||
\,\\, $&
|
||
.,\., $&
|
||
*,\*, $&
|
||
+,\+, $&
|
||
[,\[, $&
|
||
],\], $&
|
||
$chr(40), \ $+ $chr(40), $&
|
||
$chr(41), \ $+ $chr(41))
|
||
}
|
||
alias -l _errorbox .echo -q $input($$1-,260,$Atma)
|
||
alias -l debug.print $iif($window(@Atma),aline @Atma $$1-)
|
||
alias -l servername { scon $1 return $!server }
|
||
alias networkname { return $iif($network,$network,atma.unknown.network) }
|