|
; Addon de SpamFilter scripté par Averell (version 1.1 le 21/11/10)
; Sous licence GPL
;
; Taper /load -rs spamfilter.mrc pour le charger
;
; Le service est obtenu en tapant /dialspf
alias dialspf dialog -m spf spf
dialog spf {
title "Gestion du spamfilter"
size -1 -1 460 164
option dbu
button "Fermer", 1, 414 8 37 12, ok
button "Ajouter", 2, 414 36 37 12
button "Supprimer", 3, 414 52 37 12
list 4, 5 8 400 72, size
box "Cible", 5, 5 83 399 18
check "msg public", 6, 23 89 42 10
check "msg privé", 7, 68 89 36 10
check "notice privé", 8, 110 89 41 10
check "notice public", 9, 154 89 45 10
check "msg part", 10, 200 89 44 10
check "msg quit", 11, 248 89 40 10
check "nick", 12, 295 89 33 10
check "dcc", 13, 340 89 33 10
box "Action", 31, 5 104 420 18
radio "Bloquer", 14, 23 110 41 10,group
radio "Shunner", 15, 68 110 41 10
radio "Tempshun", 16, 113 110 41 10
radio "Killer", 17, 158 110 41 10
radio "K-liner", 18, 203 110 41 10
radio "G-liner", 19, 248 110 41 10
radio "Z-liner", 20, 293 110 41 10
radio "GZ-liner", 21, 338 110 41 10
radio "dccblock", 22, 383 110 41 10
text "Durée (s)", 29, 5 128 25 9,autohs
edit "", 30, 35 128 50 11
text "Raison", 23, 167 143 25 9
edit "", 24, 204 143 198 11,autohs
text "Regexp", 25, 99 128 25 9
edit "", 26, 133 128 270 11,autohs
text "Responsable", 27, 5 143 36 9
edit "", 28, 46 143 106 11,disable
}
on 1:dialog:spf:init:0: .enable #spam1 | stats f
on 1:dialog:spf:sclick:4: selspam $did(4).seltext
on 1:dialog:spf:sclick:6: editspam
on 1:dialog:spf:sclick:7: editspam
on 1:dialog:spf:sclick:8: editspam
on 1:dialog:spf:sclick:9: editspam
on 1:dialog:spf:sclick:10: editspam
on 1:dialog:spf:sclick:11: editspam
on 1:dialog:spf:sclick:12: editspam
on 1:dialog:spf:sclick:13: editspam
on 1:dialog:spf:sclick:14: editspam
on 1:dialog:spf:sclick:15: editspam
on 1:dialog:spf:sclick:16: editspam
on 1:dialog:spf:sclick:17: editspam
on 1:dialog:spf:sclick:18: editspam
on 1:dialog:spf:sclick:19: editspam
on 1:dialog:spf:sclick:20: editspam
on 1:dialog:spf:sclick:21: editspam
on 1:dialog:spf:sclick:22: editspam
on 1:dialog:spf:edit:30: editspam
on 1:dialog:spf:edit:24: editspam
on 1:dialog:spf:edit:26: editspam
on 1:dialog:spf:sclick:2: ajoutespam
on 1:dialog:spf:sclick:3: supprimespam $did(spf,4).seltext
alias checkspam {
var %radio, %boxes, %sauver
%radio = $calc($did(spf,14).state + $did(spf,15).state + $did(spf,16).state + $did(spf,17).state + $did(spf,18).state + $did(spf,19).state + $did(spf,20).state + $did(spf,21).state + $did(spf,22).state )
%boxes = $calc($did(spf,6).state + $did(spf,7).state + $did(spf,8).state + $did(spf,9).state + $did(spf,10).state + $did(spf,11).state + $did(spf,12).state + $did(spf,13).state)
did $iif($did(spf,4).sel == 0 || $gettok($did(spf,4).seltext,1,32) === f,-b,-e) spf 3
%sauver = $iif(%radio == 0 || %boxes == 0 || $did(spf,24) == $null || $did(spf,26) == $null || $did(spf,30) == $null || $did(spf,4).sel != 0,$true,$false)
if (!$did(spf,2).enabled && !%sauver) { did -ra spf 30 - }
did $iif(%sauver,-b,-e) spf 2
}
alias selspam {
; selspam ligne complete
var %fouf,%cible,%action,%duree,%raison,%qui,%regexp
%fouf = $1
%cible = $2
%action = $3
%duree = $6
%raison = $replace($7,_,$chr(32))
%qui = $8
%regexp = $9-
did -ra spf 26 %regexp
did -ra spf 24 %raison
did -ra spf 28 %qui
did -ra spf 30 %duree
did $iif(%action == block,-c,-u) spf 14
did $iif(%action == shun,-c,-u) spf 15
did $iif(%action == tempshun,-c,-u) spf 16
did $iif(%action == kill,-c,-u) spf 17
did $iif(%action == kline,-c,-u) spf 18
did $iif(%action == gline,-c,-u) spf 19
did $iif(%action == zline,-c,-u) spf 20
did $iif(%action == gzline,-c,-u) spf 21
did $iif(%action == dccblock,-c,-u) spf 22
did $iif($regex(%cible ,/c/),-c,-u) spf 6
did $iif($regex(%cible ,/p/),-c,-u) spf 7
did $iif($regex(%cible ,/n/),-c,-u) spf 8
did $iif($regex(%cible ,/N/),-c,-u) spf 9
did $iif($regex(%cible ,/P/),-c,-u) spf 10
did $iif($regex(%cible ,/q/),-c,-u) spf 11
did $iif($regex(%cible ,/u/),-c,-u) spf 12
did $iif($regex(%cible ,/d/),-c,-u) spf 13
checkspam
}
alias editspam {
did -u spf 4
did -r spf 28
checkspam
}
alias ajoutespam {
var %fouf,%cible,%action,%duree,%raison,%qui,%regexp
if ($did(spf,14).state == 1) { %action = block }
elseif ($did(spf,15).state == 1) { %action = shun }
elseif ($did(spf,16).state == 1) { %action = tempshun }
elseif ($did(spf,17).state == 1) { %action = kill }
elseif ($did(spf,18).state == 1) { %action = kline }
elseif ($did(spf,19).state == 1) { %action = gline }
elseif ($did(spf,20).state == 1) { %action = zline }
elseif ($did(spf,21).state == 1) { %action = gzline }
elseif ($did(spf,22).state == 1) { %action = dccblock }
%cible = %cible $+ $iif($did(spf,6).state == 1,c)
%cible = %cible $+ $iif($did(spf,7).state == 1,p)
%cible = %cible $+ $iif($did(spf,8).state == 1,n)
%cible = %cible $+ $iif($did(spf,9).state == 1,N)
%cible = %cible $+ $iif($did(spf,10).state == 1,P)
%cible = %cible $+ $iif($did(spf,11).state == 1,q)
%cible = %cible $+ $iif($did(spf,12).state == 1,u)
%cible = %cible $+ $iif($did(spf,13).state == 1,d)
spamfilter add %cible %action $did(spf,30) $replace($did(spf,24),$chr(32),_) $did(spf,26)
echo 3 -s *** spamfilter add %cible %action $did(spf,30) $replace($did(spf,24),$chr(32),_) $did(spf,26)
did -r spf 4
.enable #spam1 | stats f
}
alias supprimespam {
if ($?!="Etes-vous sûr de vouloir faire ça?" == $false) return
spamfilter del $2 $3 $4 $7 $9-
echo 3 -s *** spamfilter del $2 $3 $4 $7 $9-
did -r spf 4
.enable #spam1 | stats f
}
#spam1 off
raw 229:*: did -a spf 4 $2- | halt
raw 219:*: .disable #spam1 | did -ra spf 30 - | checkspam
#spam1 end
| |