| View previous topic :: View next topic |
| Author |
Message |
danter Voice
Joined: 04 Jan 2010 Posts: 6
|
Posted: Wed Oct 27, 2010 4:26 am Post subject: auto banner |
|
|
Hey,
I need script what will ban user from channel (only ban no kick) when he joins...
But i need to set host exceptions myself into some other file or somewhere...
Maybe someone can help me  |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Wed Oct 27, 2010 10:33 am Post subject: |
|
|
| In what manner would you like them banned in? I assume you are looking for: *!*@*.domain.tld. |
|
| Back to top |
|
 |
danter Voice
Joined: 04 Jan 2010 Posts: 6
|
Posted: Wed Oct 27, 2010 2:39 pm Post subject: |
|
|
I presume *!*@*.domain.name would be nice  |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Fri Oct 29, 2010 10:18 pm Post subject: |
|
|
Okay, this is not tested, but let's see how it works for you...
| Code: |
bind join * * join:ban
proc join:ban {nick host hand chan} {
set host [getchanhost $nick $chan]
set fs "exceptions.txt"
if {![file exists $fs]} {
close [open $fs w]
}
set fs [open $fs]
set data [split [read -nonewline $fs] \n]
close $fs
if {[lsearch $data "$host"] == -1} {
putserv "MODE $chan +b *!*@*.[join [lrange [split $host .] end-1 end] .]
}
return
} |
Now, if this works, this will search the file "exceptions.txt" in your eggdrop/ for the host set by [getchanhost $nick $chan]. Getchanhost returns the format "user@full.domain.tld", so it will compare based on that. Note this is a simple example and not exactly ideal for all hosts, as the ip field can mess this up, as can the ident/user if the person changes it. What I would recommend, is that you create a custom flag for people, and then see if that flag exists when the person joins. If not, they get banned. Simpler, and will be as effective as the hosts you have added to your users. How we could do that is with something as simple as:
| Code: | bind join * * join:ban
proc join:ban {nick host hand chan} {
If {![matchattr $hand |A $chan]} {
set host [getchanhost $nick $chan]
putserv "MODE $chan +b *!*@*.[join [lrange [split $host .] end-1 end] .]"
}
return
} |
In this case, the flag "A" would be "authorized". But you can use whatever flag you want really. |
|
| Back to top |
|
 |
danter Voice
Joined: 04 Jan 2010 Posts: 6
|
Posted: Sat Oct 30, 2010 4:47 am Post subject: |
|
|
And how should i write exceptions.txt??
On the same line or different line and with ";" or not
(sorry about stupid questions...) |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Sat Oct 30, 2010 10:50 am Post subject: |
|
|
Not stupid at all.
Put in the file like this:
user@host.tld
someone@ip.blah.org
dude@blah.blah.blah
and so on, on different lines.
Edit: I also just realized I made a mistake above. Change this line: | Code: | | set host [getchanhost $nick $chan] |
to
| Code: | | set host [string trim [getchanhost $nick $chan] ~] |
That will trim off any possible "~" before comparing. |
|
| Back to top |
|
 |
|