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 

auto banner

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


Joined: 04 Jan 2010
Posts: 6

PostPosted: Wed Oct 27, 2010 4:26 am    Post subject: auto banner Reply with quote

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 Smile
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Wed Oct 27, 2010 10:33 am    Post subject: Reply with quote

In what manner would you like them banned in? I assume you are looking for: *!*@*.domain.tld.
Back to top
View user's profile Send private message
danter
Voice


Joined: 04 Jan 2010
Posts: 6

PostPosted: Wed Oct 27, 2010 2:39 pm    Post subject: Reply with quote

I presume *!*@*.domain.name would be nice Smile
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Fri Oct 29, 2010 10:18 pm    Post subject: Reply with quote

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. Smile 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
View user's profile Send private message
danter
Voice


Joined: 04 Jan 2010
Posts: 6

PostPosted: Sat Oct 30, 2010 4:47 am    Post subject: Reply with quote

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

(sorry about stupid questions...)
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Sat Oct 30, 2010 10:50 am    Post subject: Reply with quote

Not stupid at all. Smile

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
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