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.

auto banner

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
danter
Voice
Posts: 6
Joined: Mon Jan 04, 2010 3:39 pm

auto banner

Post by danter »

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 :)
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

In what manner would you like them banned in? I assume you are looking for: *!*@*.domain.tld.
d
danter
Voice
Posts: 6
Joined: Mon Jan 04, 2010 3:39 pm

Post by danter »

I presume *!*@*.domain.name would be nice :)
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

Okay, this is not tested, but let's see how it works for you...

Code: Select all

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: Select all

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.
d
danter
Voice
Posts: 6
Joined: Mon Jan 04, 2010 3:39 pm

Post by danter »

And how should i write exceptions.txt??
On the same line or different line and with ";" or not :D

(sorry about stupid questions...)
L
Luminous
Op
Posts: 146
Joined: Fri Feb 12, 2010 1:00 pm

Post by Luminous »

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: Select all

set host [getchanhost $nick $chan] 
to

Code: Select all

set host [string trim [getchanhost $nick $chan] ~]
That will trim off any possible "~" before comparing.
Post Reply