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.

gline not working

Help for those learning Tcl or writing their own scripts.
Post Reply
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

gline not working

Post by Yusif »

hi all, looking for help please with this code
it should gline user when i type !yes but it didn't

Code: Select all

proc ipc:yes {nick host hand chan arg} {
    global ipc
    if {![info exists ipc($host:waitCall)]} {
        return
    }
    putserv "PRIVMSG $ipc(channel) :Answered for \002YES\002 for [lindex $ipc($host:waitCall) 0]. GLine action applied."
   
    foreach tmr [utimers] {
if {[string match -nocase "*ipc:time_elapsed $host*" [join [lindex $tmr 1]]]} {
	killutimer [lindex $tmr 2]
		}
	}
    putserv "gline *@[lindex $ipc($host:waitCall) 1] $ipc(gline_time) $ipc(gline_reason)"
    unset ipc($host:waitCall)
}
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Post the entire code not just parts of it
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

try this :

Code: Select all


bind pub n !gline PubAdd:G-Line

proc PubAdd:G-Line {nick host hand chan text} {

  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  set items [split $text]

 if {[llength $items] < 1 } { putserv "notice $nick :Syntax\: !gline  \<duration\> \<ident@host\> \<reason\>" ; return }

  set target [lindex [split $text] 0]

  set duration [lindex [split $text] 1]
 if {![regexp {^[0-9]{1,3}} $duration] || $duration eq ""} {  set duration "1h" }
  set reason [join [lrange [split $text] 2 end]]
 if {$reason eq ""} { set reason "Please respect the network rules, thank you." }

 if {![onchan $target $chan]} {
 if {[string match *@* $target]} { putserv "GLINE $target $duration $reason" 
 } else {  putserv "GLINE *@$target $duration $reason"  }
 } else {
  putserv "GLINE $target $duration $reason" 
  }
}

Last edited by simo on Fri Oct 13, 2023 6:06 am, edited 1 time in total.
Y
Yusif
Voice
Posts: 34
Joined: Fri Aug 18, 2023 11:08 am

Post by Yusif »

thank you simo, i will try that and update result here .
thanks again
s
simo
Revered One
Posts: 1078
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i have edited it a bit so the *@ is added if not used in $target as thats what gline

takes user@some.host.here.com
User avatar
aslpls
Halfop
Posts: 43
Joined: Mon May 02, 2016 9:41 am

Post by aslpls »

simo wrote:try this :

Code: Select all


bind pub n !gline PubAdd:G-Line

proc PubAdd:G-Line {nick host hand chan text} {

  set text [regsub -all -- {\s{2,}} [string trim [stripcodes * $text]] { }]
  set items [split $text]

 if {[llength $items] < 1 } { putserv "notice $nick :Syntax\: !gline  \<duration\> \<ident@host\> \<reason\>" ; return }

  set target [lindex [split $text] 0]

  set duration [lindex [split $text] 1]
 if {![regexp {^[0-9]{1,3}} $duration] || $duration eq ""} {  set duration "1h" }
  set reason [join [lrange [split $text] 2 end]]
 if {$reason eq ""} { set reason "Please respect the network rules, thank you." }

 if {![onchan $target $chan]} {
 if {[string match *@* $target]} { putserv "GLINE $target $duration $reason" 
 } else {  putserv "GLINE *@$target $duration $reason"  }
 } else {
  putserv "GLINE $target $duration $reason" 
  }
}


simo,

can you add the command into this.

!gline nick duration reason


(when doing that command it should glined the <ident@host>)

i think this is much easier.


my suggestion only.
Post Reply