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.

Removing Internal bans???

Old posts that have not been replied to for several years.
Locked
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Removing Internal bans???

Post by Gothic-Angel »

Ok I wanna write a tcl to remove all bans in the internal banlist every 30 mins.

Im not sure where I'd start so if someone wants to tip me off on where to start. I looked around on sunninet for help there, but he doesn't cover the banning process which is what I need to undo.
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

You will want to use bind time so that the bot acts every 30 minutes.
When the bot acts, it needs to loop through the internal ban list and kill the bans 1 by 1.


To bind the time to a procedure you need to read about

bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Description: allows you to schedule procedure calls at certain
times. mask matches 5 space separated integers of the form:
"minute hour day month year". minute, hour, day, month have a
zero padding so they are exactly two characters long; year is
extended to four characters in the same way.
Module: core
Example (to execute a code every 30 minutes):

Code: Select all

bind time - "30 * *" intbans:bind 
proc intbans:bind {min hour day month year} { 
  <your_code_to_loop_through_the_internal_bans_goes_here>
}


-------------------

To get a list of all internal bans you need to use "banlist"
banlist [channel]
Returns: a list of global bans, or, if a channel is specified, a
list of channel-specific bans. Each entry is a sublist containing:
hostmask, comment, expiration timestamp, time added, last time
active, and creator. The three timestamps are in unixtime format.
Module: channels
-------------------

As for removing internal bans, there are 2 types of internal bans.

1- Global internal bans that apply to any channel the bot is monitoring
To remove them you need to use "killban"
killban <ban>
Description: removes a ban from the global ban list
Returns: 1 on success; 0 otherwise
Module: channels
2- Channel specific bans that apply only to a specific channel.
To remove them you need to use "killchanban"
killchanban <channel> <ban>
Description: removes a ban from the ban list for a channel
Returns: 1 on success; 0 otherwise
Module: channels
-------------------

z_one
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Just a note:

Code: Select all

bind time - "30 * *" intbans:bind
This will not trigger every 30 mins. More like every 30 mins past the hour, thus only once per hour.

You can crate two bind to the same proc, to do this. IE

Code: Select all

bind time - "30 * *" intbans:bind
bind time - "00 * *" intbans:bind
User avatar
z_one
Master
Posts: 269
Joined: Mon Jan 14, 2002 8:00 pm
Location: Canada

Post by z_one »

Yep!
My mistake... thanks ppslim :)
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

I looked at the clearbans tcl, I noticed it used the timing format like ppslim said. Im gonna try some things out.


Is there a way to kill all the bans at once? or am I going to have to run through killchanban 1 and loop that say 35 times?

Well I guess I could have it clear until there is no longer a ban 1?


That would require checking to see if something is true or false.

Im new to this so im trying to learn here and the best way its hands on.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

just use foreach on the banlist

read about foreach here: http://www.suninet.nl/tclguide/index.php?chap=10&pg=2[/quote]
Elen sila lúmenn' omentielvo
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

ah I see, so the proc would look something like this?

Code: Select all

proc kill:bans {min hour day month year} {
    foreach chan [channels] {
killchanban $chan 1
}
This would only kill ban 1, not clear them all right?
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

but afaik eggdrop renumbers the bans when you kill ban 1.
so what was previously ban 2 is ban1 when the 'old' ban1 is removed.

i could be wrong but ppslim will correct any wrongness from anyone
photon?
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

if you read about the banlist command in the tcl-commands.doc it does not return any number on the bans, it returns hostmask, time set,time left etc...
so what you are looking for is something like:

Code: Select all

proc kill:bans {min hour day month year} { 
  foreach x [banlist #somechan] { 
    killchanban #somechan [lindex $x 0] 
  }
}
Elen sila lúmenn' omentielvo
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

Wow so my first guess when I edited the post was more on the right track than I thought.
G
Gothic-Angel
Op
Posts: 109
Joined: Mon Sep 23, 2002 9:46 pm

Post by Gothic-Angel »

Well good new's is I got it working heheh. YAY


Thanks for all the help!!
Locked