Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;==== popup menus ====
- menu menubar,channel {
- -
- Clonescanner:clonescanner
- -
- }
- ;==== custom aliases ====
- alias clonescanner {
- set %mcl.chan $active
- var %mcl.c, %mcl.i, %mcl.p, %mcl.t, %mcl.d, %mcl.total, %mcl.count2, %mclones
- %mcl.i = 1
- if ($dialog(clonescan)) { did -r clonescan 205,207 }
- else { dialog -m clonescan clonescan }
- %mcl.count2 = 0
- :i
- %mcl.t = $address($nick(#,%mcl.i),2)
- if ($ialchan(%mcl.t,#,0) > 1) && (%mcl.t !isin %mcl.d) {
- %mcl.p = 1
- var %mcl.count = 0
- :p
- if ($ialchan(%mcl.t,#,%mcl.p).nick) {
- inc %mcl.count
- %mcl.c = %mcl.c $ifmatch
- inc %mcl.p
- inc %mcl.total
- goto p
- }
- inc %mcl.count2
- did -a clonescan 207 %mcl.t
- did -a clonescan 205 %mcl.c
- var %mcl.c
- %mcl.d = %mcl.d %mcl.t
- }
- inc %mcl.i
- if ($nick(#,%mcl.i)) goto i
- if (%mcl.d) { did -a clonescan 202 %mcl.total | did -z clonescan 205,207 | halt }
- did -a clonescan 202 None!
- did -b clonescan 203,204,205,206,207,102,103,104,105
- }
- on *:JOIN:*:{
- ;==== check IAL ====
- if (($nick == $me) && (!$chan($chan).ial)) { .who $chan }
- if (($nick != $me) && ($me isop $chan)) {
- var %address = $address($nick,2)
- if ($ialchan(%address,$chan,2)) {
- var %i = 1, %mclones, %nick, %t = $ialchan(%address,$chan,0)
- ;==== if it's your clone no need to kick it ====
- if (%t == $address($me,0)) return
- ;==== getting all nicks with that address ====
- while (%i <= %t) {
- %nick = $ialchan(%address,$chan,%i).nick
- if (%nick isop $chan) { echo -a 4 ! Clones detected joining $chan $+ , but using same address as a channelop: %nick ( $+ %address $+ ). Operation aborted! | return }
- %mclones = %mclones %nick
- inc %i
- }
- ;==== doing the preferred action ====
- if (%t > 1) {
- if (e isin %mcl.oj) {
- echo -a $chr(160)
- echo -a Warning: clones detected joining $chan $+ : %mclones $+ , using address %address
- echo -a $chr(160)
- }
- if (s isin %mcl.oj) { msg $chan Warning: clones detected joining $chan $+ : %mclones $+ , with address %address }
- if (d isin %mcl.oj) { clonescanner }
- if (k isin %mcl.oj) {
- %i = 01
- while (%i <= %t) {
- .timer -m 1 1 kick $chan $gettok(%mclones,%i,32)
- inc %i
- }
- }
- if (b isin %mcl.oj) { ban $chan %address }
- if (c isin %mcl.oj) {
- ban $chan %address
- %i = 1
- while (%i <= %t) {
- .timer -m 1 1 kick $chan $gettok(%mclones,%i,32)
- inc %i
- }
- }
- if (w isin %mcl.oj) {
- %i = 1
- while (%i <= %t) {
- var %mcl.warn = $replace(%mcl.warning,@Nick@,$gettok(%mclones,%i,32),@chan@,$chan)
- %mcl.warn
- inc %i
- }
- }
- }
- }
- }
- elseif ($nick != $me) {
- ;==== even if i'm not op, check anyway ====
- var %address = $address($nick,2)
- if ($ialchan(%address,$chan,2)) {
- var %i = 1, %mclones, %nick, %t = $ialchan(%address,$chan,0)
- while (%i <= %t) {
- %nick = $ialchan(%address,$chan,%i).nick
- %mclones = %mclones %nick
- inc %i
- }
- if (%t > 1) {
- if (e isin %mcl.oj) {
- echo -a $chr(160)
- echo -a Warning: clones detected joining $chan $+ : %mclones $+ , with address %address
- echo -a $chr(160)
- }
- if (s isin %mcl.oj) { msg $chan Warning: clones detected joining $chan $+ : %mclones $+ , with address %address }
- if (d isin %mcl.oj) { dialog -m clonescan clonescan }
- }
- }
- }
- }
- ;==== dialog init ====
- on *:DIALOG:cledit:init:0:{
- if (e isin %mcl.oj) { did -c cledit 3 }
- if (s isin %mcl.oj) { did -c cledit 4 }
- if (d isin %mcl.oj) { did -c cledit 5 }
- if (k isin %mcl.oj) { did -c cledit 6 }
- if (b isin %mcl.oj) { did -c cledit 7 }
- if (c isin %mcl.oj) { did -c cledit 8 }
- if (w isin %mcl.oj) { did -c cledit 9 }
- if (n isin %mcl.oj) { did -c cledit 10 }
- }
- ;==== saving settings ====
- on *:dialog:cledit:sclick:101:{
- unset %mcl.oj
- set %mcl.msg $did(cledit,1)
- set %mcl.warning $did(cledit,2)
- if ($did(3).state == 1) { %mcl.oj = %mcl.oj $+ e }
- if ($did(4).state == 1) { %mcl.oj = %mcl.oj $+ s }
- if ($did(5).state == 1) { %mcl.oj = %mcl.oj $+ d }
- if ($did(6).state == 1) { %mcl.oj = %mcl.oj $+ k }
- if ($did(7).state == 1) { %mcl.oj = %mcl.oj $+ b }
- if ($did(8).state == 1) { %mcl.oj = %mcl.oj $+ c }
- if ($did(9).state == 1) { %mcl.oj = %mcl.oj $+ w }
- if ($did(10).state == 1) { %mcl.oj = %mcl.oj $+ n }
- }
- ;==== selecting corresponding nicks with address (and the other way around too) ====
- on *:DIALOG:clonescan:sclick:205:did -c clonescan 207 $did(clonescan,205,1).sel
- on *:DIALOG:clonescan:sclick:207:did -c clonescan 205 $did(clonescan,207,1).sel
- ;==== dialog button "Kick" clones ====
- on *:DIALOG:clonescan:sclick:102:{
- ; got clones selected?
- if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
- if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
- ; getting total number of clones to kick (%t)
- var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
- while (%i <= %t) {
- .timer -m 1 1 kick %mcl.chan $gettok($did(clonescan,205,1).seltext,%i,32)
- inc %i
- }
- }
- ;==== dialog button "kickban" ====
- on *:DIALOG:clonescan:sclick:103:{
- ; got clones selected?
- if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
- if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
- ; getting total number of clones to kick (%t)
- var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
- ; ban address
- ban %mcl.chan $did(clonescan,207).seltext
- ; kick 'em!
- while (%i <= %t) {
- .timer -m 1 1 kick %mcl.chan $gettok($did(clonescan,205,1).seltext,%i,32)
- inc %i
- }
- }
- ;==== dialog button "ban" ====
- on *:DIALOG:clonescan:sclick:104:{
- ; got clones selected?
- if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
- if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
- ; ban address
- ban %mcl.chan $did(clonescan,207).seltext
- }
- ;==== dialog button "warn" ====
- on *:DIALOG:clonescan:sclick:105:{
- ; got clones selected?
- if (!$did(clonescan,207).seltext) { echo -a You didn't select any clones | return }
- if ($me !isop %mcl.chan) { echo -a You need operator status to do this. | return }
- ; getting total number of clones to kick (%t)
- var %i = 1, %t = $gettok($did(clonescan,205,1).seltext,0,32)
- while (%i <= %t) {
- %mcl.warn = $replace(%mcl.warning,@Nick@,$gettok($did(clonescan,205,1).seltext,%i,32),@chan@,%mcl.chan)
- inc %i
- }
- }
- ;==== configuring settings ====
- on *:DIALOG:clonescan:sclick:106:$dialog(cledit,cledit,-4)
- ;==== dialog initialisation ====
- on *:DIALOG:clonescan:init:0:{
- if (%mcl.msg) { }
- else { %mcl.msg = No clones allowed }
- if (%mcl.warning) { }
- else { %mcl.warning = notice @Nick@ Please remove your clones from @chan@ }
- if (%mcl.oj) { }
- else { %mcl.oj = ew }
- }
- ;==== dialog table ====
- dialog Clonescan {
- size -1 -1 500 270
- title Clone Scanning report for $active
- button "&OK",101,200 240 100 25, ok default
- text "Number of clones found :",201,10 10 130 16
- text "",202,140 10 40 16
- box "Clones",203,10 35 380 195
- text "Nicks",204,70 55 60 16
- list 205,20 70 160 150, autovsbar autohsbar
- text "Host",206, 250 55 60 16
- list 207,180 70 200 150, autovsbar autohsbar
- box "Punishment",208,400 35 90 195
- button "&Kick",102,410 55 70 25
- button "Kick&ban",103,410 90 70 25
- button "Ba&n",104,410 125 70 25
- button "&Warn",105,410 160 70 25
- box "",209,400 185 90 45
- button "&Configure...",106, 410 198 70 25
- }
- ;==== Clonescanner punishment config table ====
- dialog cledit {
- size -1 -1 400 315
- title "Configure Punishment..."
- text You're strongly advised NOT to edit these settings unless you know what you're doing.,202,10 10 350 30
- box "Kick and Kickban message", 201, 10 50 380 50
- edit %mcl.msg ,1, 20 70 360 20,autohs
- box "Warn message",203, 10 110 380 50
- edit %mcl.warning ,2, 20 130 360 20,autohs
- box "When a clone joins...",204,10 170 380 100
- check "Echo",3,20 190 70 16
- check "Say in chan",4,20 218 75 16
- check "Show Clonescan dialog",5,20 245 130 16
- box "Punishment",205,200 190 190 80
- radio "Kick",6,220 210 70 16, group
- radio "Ban",7,220 230 70 16
- radio "Kickban",8,220 250 70 16
- radio "Warn",9,290 210 70 16
- radio "Do nothing",10,290 230 80 16
- button "0&K", 101, 150 280 100 25, ok default
- }
- ;==== cleanup ====
- on *:unload:unset %mcl.*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement