egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

unban all bans in userlist.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Fri Oct 30, 2009 1:39 pm    Post subject: unban all bans in userlist. Reply with quote

hi guys.

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

Because:

Code:
.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.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
DarkRaptor
Voice


Joined: 15 Apr 2006
Posts: 36
Location: Trois-Rivières, Qc

PostPosted: Mon Nov 23, 2009 12:43 am    Post subject: Reply with quote

Code:

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:

.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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber