Ban , Except and Invite removal Dialog

By Scakk on Nov 11, 2007

This simple little dialog will unban all , remove all from the except list and remove all from the invite list. It will also remove them one at a time as you need. Also once a ban , except or invite is removed the dialog will refresh the list accordingly. If you click another channel with the dialog open and click the " R " button it will then have the information for that channel in it. Also the list menu is the wy to go from the ban list , except list and invite list as needed.

Image

alias channick2 { dialog $iif($dialog(channick2),-v,-ma) channick2 channick2 }
menu channel {
  [Unbanning]: { channick2 }
}

alias chanbans { 
  ;This gets the full ban list.
  channick2
  did -v channick2 1-3
  did -h channick2 4-9
  var %x = 1
  while (%x <= $ibl($active,0)) { 
    did -o channick2 1 %x $ibl($active,%x) 
    inc %x
  }
}
alias chanexcepts { 
  ;This gets the full except list.  
  channick2
  did -v channick2 4-6
  did -h channick2 1-3,7-9
  var %x = 1
  while (%x <= $iel($active,0)) { 
    did -o channick2 4 %x $iel($active,%x) 
    inc %x
  }
}
alias chaninvites { 
  ;This gets the full invite list.
  channick2
  did -v channick2 7-9
  did -h channick2 1-6  
  var %x = 1
  while (%x <= $iil($active,0)) { 
    did -o channick2 7 %x $iil($active,%x) 
    inc %x
  }
}

dialog channick2 {
  title "Bans / Excepts / Invites"
  size -1 -1 200 165
  menu "&List", 100
  item "&Bans", 101, 100
  item "&Excepts", 102, 100  
  item "&Invites", 103, 100 
  list 1, 10 10 180 120, hsbar vsbar
  button "Delete", 2, 10 120 80 25
  button "Delete All", 3, 110 120 80 25
  text "Bans", 10, 10 147 180 15, center
  list 4, 10 10 180 120, hsbar vsbar
  button "Delete", 5, 10 120 80 25
  button "Delete All", 6, 110 120 80 25
  text "Excepts", 11, 10 147 180 15, center
  list 7, 10 10 180 120, hsbar vsbar
  button "Delete", 8, 10 120 80 25
  button "Delete All", 9, 110 120 80 25
  text "Invites", 12, 10 147 180 15, center
  button "R", 13, 90 120 20 25
  button "R", 14, 90 120 20 25
  button "R", 15, 90 120 20 25
}
on *:dialog:channick2:init:*: {
  did -b channick2 2,5,8
  did -h channick2 4,5-9,11,12
  did -v channick2 1-3,10
  did -a channick2 10 Bans ( $active )
  var %x = 1
  while (%x <= $ibl($active,0)) { 
    did -i channick2 1 %x $ibl($active,%x) 
    inc %x
  }
  var %x = 1
  while (%x <= $iel($active,0)) { 
    did -i channick2 4 %x $iel($active,%x) 
    inc %x
  }
  var %x = 1
  while (%x <= $iil($active,0)) { 
    did -i channick2 7 %x $iil($active,%x) 
    inc %x
  }
}
on *:dialog:channick2:menu:*: {
  if ($did == 101) { 
    did -v channick2 1-3,10
    did -h channick2 4-9,11,12
    did -b channick2 2
    did -r channick2 1
    did -a channick2 10 Bans ( $active )
    var %x = 1
    while (%x <= $ibl($active,0)) { 
      did -i channick2 1 %x $ibl($active,%x) 
      inc %x
    }
  }
  if ($did == 102) { 
    did -v channick2 4-6,11
    did -h channick2 1-3,7-9,10,12
    did -b channick2 5
    did -r channick2 4
    did -a channick2 11 Excepts ( $active )
    var %x = 1
    while (%x <= $iel($active,0)) { 
      did -i channick2 4 %x $iel($active,%x) 
      inc %x
    }
  }
  if ($did == 103) { 
    did -v channick2 7-9,12
    did -h channick2 1-6,10,11  
    did -b channick2 8
    did -r channick2 7
    did -a channick2 12 Invites ( $active )
    var %x = 1
    while (%x <= $iil($active,0)) { 
      did -i channick2 7 %x $iil($active,%x) 
      inc %x
    } 
  }
}
on *:dialog:channick2:sclick:*: {
  if ($did == 1)  {
    if ($did(1).seltext == $null) { halt }
    else {
      did -e channick2 2,3
      did -z channick2 1 200 500
    }
  }
  if ($did == 2) { 
    mode $active -b $did(1).seltext 
    .timer 1 1 dialog -x channick2
    .timer 1 1 chanbans
  }
  if ($did == 3) { 
    var %y = $input(Continue with deletion of all bans?,cy,All ban deletion.) {
      if (%y == $true) { 
        massb -b 
        .timer 1 1 dialog -x channick2
        .timer 1 1 chanbans
      }
    }
  }
  if ($did == 4)  {
    if ($did(1).seltext == $null) { halt }
    else {
      did -e channick2 5,6
      did -z channick2 4 200 500
    }
  }
  if ($did == 5) { 
    mode $active -e $did(4).seltext 
    .timer 1 1 dialog -x channick2
    .timer 1 1 chanexcepts
  }
  if ($did == 6) { 
    var %y = $input(Continue with deletion of all excepts?,cy,All except deletion.) {
      if (%y == $true) { 
        masse -e 
        .timer 1 1 dialog -x channick2
        .timer 1 1 chanexcepts
      }
    }
  }
  if ($did == 7)  {
    if ($did(1).seltext == $null) { halt }
    else {
      did -e channick2 8,9
      did -z channick2 7 200 500
    }
  }
  if ($did == 8) { 
    mode $active -I $did(7).seltext 
    .timer 1 1 dialog -x channick2
    .timer 1 1 chaninvites
  }
  if ($did == 9) { 
    var %y = $input(Continue with deletion of all invitess?,cy,All invites deletion.) {
      if (%y == $true) { 
        massi -I 
        .timer 1 1 dialog -x channick2
        .timer 1 1 chaninvites
      }
    }
  }
  if ($did == 13) {
    dialog -x channick2 
    channick2
  }
}
alias massb {
  var %cnt = 1, %massmodes
  while (%cnt <= $ibl($active,0)) {
    %massmodes = %massmodes $ibl($active,%cnt)
    if ($numtok(%massmodes,32) >= $modespl) {
      mode $active $str($$1,$modespl) %massmodes
      %massmodes = ""
    }
    inc %cnt
  }
  if (%massmodes) mode $active $str($$1,$modespl) %massmodes
} 
alias masse {
  var %cnt = 1, %massmodes
  while (%cnt <= $iel($active,0)) {
    %massmodes = %massmodes $iel($active,%cnt)
    if ($numtok(%massmodes,32) >= $modespl) {
      mode $active $str($$1,$modespl) %massmodes
      %massmodes = ""
    }
    inc %cnt
  }
  if (%massmodes) mode $active $str($$1,$modespl) %massmodes
} 
alias massi {
  var %cnt = 1, %massmodes
  while (%cnt <= $iil($active,0)) {
    %massmodes = %massmodes $iil($active,%cnt)
    if ($numtok(%massmodes,32) >= $modespl) {
      mode $active $str($$1,$modespl) %massmodes
      %massmodes = ""
    }
    inc %cnt
  }
  if (%massmodes) mode $active $str($$1,$modespl) %massmodes
} 

Comments

Sign in to comment.
guest598594   -  Nov 13, 2007
    if ($did(1).seltext == $null) { halt }
    else {

u can just do

if ($did(1).seltext != $null) {
 Respond  
Scakk   -  Nov 13, 2007

mountaindew - Changed \" Deleted \" to \" Delete \" , made it so you have to actually click text for the delete button to appear instead of blank space , also the \" Delete All \" button is avaiable even without clicking text.

 Respond  
guest598594   -  Nov 13, 2007

if i dont click a nick, just click the white area in the textbox, it opens up the buttons, u can solve that w/ if ($did == w/e && $did($dname,$did).seltext)

also, why do u have to click a nick to delete all? u shuold have it that if $ibl($active,1) then open up that button and when u do so, then disable it

also, whys the button called \"deleted\"? shouldnt it be \"delete\"?

 Respond  
brinxy   -  Nov 13, 2007

er.. scratch that last comment. Not thinking today.

 Respond  
brinxy   -  Nov 13, 2007

I see what you are doing here. But I still think it\'s kinda silly to have three sets of the same dialog items when you could accomplish it through one. Whatever floats your boat though. May I also suggest giving a user the option to mass add users to the i[e|b|i]l list.

 Respond  
Scakk   -  Nov 13, 2007

mountaindew - Changed it as you mentioned. I thought did when I posted it but it seems I forgot.

brinxy - Each button is for a certain list. I found it easier to have them ( ban - except - invite ) in seperate list that way you will not remove the wrong one. The buttons themselves only do the function they needed to for that list. I will add the

 if ($nick !isop $chan) 

soon.

 Respond  
brinxy   -  Nov 12, 2007

Just curious to know why you have for separate sets of the same buttons & lists? Why not just modify the list to fit except/ban/invite. Or you could use tabs. Very ridiculous to use a constant /did -h and /did -v. Using one set of lists, etc. would make this really simplified. I think what you were trying to do was change the way the inputs are displayed depending on the button? Not sure on that, but if you are, why not use a variable to determine the mode? Or even be creative and use $did. Also, you shouldn\'t let this script be available if you aren\'t an op with the ability to use this snippet. One last thing, if (%y == $true) should be equivalent to if (%y).

 Respond  
guest598594   -  Nov 12, 2007
menu channel {
  [Unbaning]: { dialog $iif($dialog(channick2),-v,-ma) channick2 channick2 }
}

since u already made an alias, u should just do

menu channel {
  [Unbanning]:channick2
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.