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.

Banmask proc for dalnet

Support & discussion of released scripts, and announcements of new releases.
Post Reply
s
simo
Revered One
Posts: 1126
Joined: Sun Mar 22, 2015 2:41 pm

Banmask proc for dalnet

Post by simo »

Proper banmask setting in 1 proc for all your ban settings in your scripts
And you can use this when u need to set a ban on someone in a proc

Example:

Code: Select all


##########################
## Proc for the banmask ##
##########################


proc BanMsk {uhost} {
     if {[string match -nocase "*@*irccloud*" $uhost]} {  
                     return "*!*[string map {sid id uid id} [string trimleft [lindex [split $uhost @] 0] "~"]]@*"
                  }  else { return "*!*@[lindex [split $uhost "@"] 1]" }
}


#####################################
## Proc for checking access levels ##
#####################################

proc AccessChker {nick chan} {  if {[matchattr [nick2hand $nick] o|o $chan]} { return 1 }; foreach type {op halfop} { if {[is$type $nick $chan]} { return 1 } }; return 0 }

proc NOAccessChker {nick chan} {  if {[matchattr [nick2hand $nick] of|of $chan]} { return 1 }; foreach type {op halfop} { if {[is$type $nick $chan]} { return 1 } }; return 0 }



#####################
## Proc for kickban #
#####################

bind pub -|- !kb Pub:Kban


proc  Pub:Kban {nick uhost hand chan text} {
  if {![AccessChker $nick $chan]} { return 0 }
 
      set text [split [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]]

     set target [lindex [split $text] 0]
     set reason [join [lrange [split $text] 1 end]]
 
    if {![llength $text]} { putserv "Notice $nick :Syntax is !KB \<nick\> \<reason\>" ; return 0 }

     if {[NOAccessChker $target $chan]} { return 0 }

     if {$reason eq ""} { set  reason "Requested." }
     if {[AccessChker $target $chan]} { return 0 }

     set lastChar [string index $reason end]
    if {$lastChar ni {\. ! ?}} { append reason "." }

     if {![onchan $target $chan]} {  
                          putserv "Notice $nick :$target is not on channel $chan"                              
    } else {
                      if {![ischanban [BanMsk $chost] $chan]} { putserv "mode $chan +b [BanMsk $chost]" } 
                        putserv "kick $chan $target :$reason"   
 }
}
 
 

##################
## Proc for kick #
##################

 
bind pub -|- !k Pub:Kicker

proc  Pub:Kicker {nick uhost hand chan text} {
  if {![AccessChker $nick $chan]} { return 0 }
 
      set text [split [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]]

     set target [lindex [split $text] 0]
     set reason [join [lrange [split $text] 1 end]]
 
    if {![llength $text]} { putserv "Notice $nick :Syntax is !K \<nick\> \<reason\>" ; return 0 }

     if {[NOAccessChker $target $chan]} { return 0 }
     
     if {$reason eq ""} { set  reason "Requested." }
     if {[AccessChker $target $chan]} { return 0 }

     set lastChar [string index $reason end]
    if {$lastChar ni {\. ! ?}} { append reason "." }

     if {![onchan $target $chan]} {  
                putserv "Notice $nick :$target is not on channel $chan"                              
    } else { putserv "kick $chan $target :$reason" }
}
 

 
 
Post Reply