This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

unban all bans in userlist.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
Nor7on
Op
Posts: 185
Joined: Sat Mar 03, 2007 8:05 am
Location: Spain - Barcelona
Contact:

unban all bans in userlist.

Post by Nor7on »

hi guys.

Can someone make a script for unban all bans in userlist of my eggdrop?

Because:

Code: Select all

.bans #chan *
<Modo> ! [1] *!*@201.250.147.32 (perm)
<Modo>         Op1: You are probably infected! Get your computer clean on #dmsetup
<Modo>         Created 2 days ago, last used 2 days ago

.................bla bla bla

<Modo> ! [2604] *!*@201.240.25.6 (perm)
<Modo>         Op4: You are probably infected! Get your computer clean on #dmsetup
<Modo>         Created 4 days ago

.................bla bla bla

<Modo> ! [4613] *!*@190.50.111.90 (perm)
<Modo>         Op2: You are probably infected! Get your computer clean on #dmsetup
<Modo>         Created 4 days ago
<Modo> ! [4614] *!*@190.173.213.81 (perm)
<Modo>         Op7: You are probably infected! Get your computer clean on #dmsetup
<Modo>         Created 4 days ago
so i have 4614 bans in userlist, and i want that with one public command remove all this bans. maybe !erasebans.

I don't want use: .-ban #chan *!*@... for every ban, u know.

Thanks.
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

Code: Select all

bind dcc n clearbans ex_clearbans

proc ex_clearbans {hand idx arg} {
  putcmdlog "#$hand# clearbans $arg"
  set chan [lindex [split $arg] 0]
  if {$chan == ""} {
    putidx $idx "Usage: clearbans <channel|-global|-all> \[creator\]" ; return 0
  }
  set remove [lindex [split $arg] 1]
  if {$chan == "-all"} {
    set gcount 0 ; set ccount 0
    foreach ban [banlist] {
      if {$remove != ""} {
        if {[string tolower [lindex $ban 5]] == [string tolower $remove]} {
          killban [lindex $ban 0] ; incr gcount
        }
      } else {
        killban [lindex $ban 0] ; incr gcount
      }
    }
    foreach banchan [channels] {
      foreach ban [banlist $banchan] {
        if {$remove != ""} {
          if {[string tolower [lindex $ban 5]] == [string tolower $remove]} {
            killchanban $banchan [lindex $ban 0] ; incr ccount
          }
        } else {
           killchanban $banchan [lindex $ban 0] ; incr ccount
        }
      }
    }
    if {$remove != ""} {
      putidx $idx "Removed $gcount global and $ccount channel [nb_plural ban bans $ccount] set by $remove."
    } else {
      putidx $idx "Removed $gcount global and $ccount channel [nb_plural ban bans $ccount]."
    }
  } elseif {$chan == "-global"} {
    set count 0
    foreach ban [banlist] {
      if {$remove != ""} {
        if {[string tolower [lindex $ban 5]] == [string tolower $remove]} {
          killban [lindex $ban 0] ; incr count
        }
      } else {
        killban [lindex $ban 0] ; incr count
      }
    }
    if {$remove != ""} {
      putidx $idx "Removed $count global [nb_plural ban bans $count] set by $remove."
    } else {
      putidx $idx "Removed $count global [nb_plural ban bans $count]."
    }
  } elseif {[string trim [string index $chan 0] "#+&!"] == ""} {
    if {![validchan $chan]} {
      putidx $idx "$chan is not a valid channel."
    } else {
      set count 0
      foreach ban [banlist $chan] {
        if {$remove != ""} {
          if {[string tolower [lindex $ban 5]] == [string tolower $remove]} {
            killchanban $chan [lindex $ban 0] ; incr count
          }
        } else {
          killchanban $chan [lindex $ban 0] ; incr count
        }
      }
      if {$remove != ""} {
        putidx $idx "Removed $count $chan [nb_plural ban bans $count] set by $remove."
      } else {
        putidx $idx "Removed $count $chan [nb_plural ban bans $count]."
      }
    }
  }
  return 0
}


proc nb_plural {word plural llength} {
  if {$llength != 1} {
    return $plural
  }
  return $word
}

Code: Select all

.clearbans #channel [creator]
## remove all bans on #channel or only those set by [creator]

.clearbans -global [creator]
## remove all global bans or only those set by [creator]

.clearbans -all [creator]
## remove all bans or only those set by [creator]

From extra.tcl and netbots.tcl (components of netbots scripts by slennox)
DarkRaptor @ irc.undernet.org
Post Reply