| View previous topic :: View next topic |
| Author |
Message |
CyberWar Voice
Joined: 04 Feb 2008 Posts: 36
|
Posted: Thu Mar 13, 2008 2:04 pm Post subject: |
|
|
i want a channel command like this: .gline nick reason
metroid: we trust to our team  |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Thu Mar 13, 2008 2:07 pm Post subject: |
|
|
| CyberWar wrote: | i want a channel command like this: .gline nick reason
metroid: we trust to our team  |
If you trust your team, why not just oper them? |
|
| Back to top |
|
 |
CyberWar Voice
Joined: 04 Feb 2008 Posts: 36
|
Posted: Thu Mar 13, 2008 2:12 pm Post subject: |
|
|
the normal user are our help team. we have 100% trust to all. and we have another things to make it finish.
I am also a chat operator from a big telecommunications company and he have in the abuse team also opers and normal users |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 2:55 pm Post subject: |
|
|
the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 13, 2008 3:00 pm Post subject: |
|
|
| DragnLord wrote: | the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work |
DragnLord, sorry to say this, but neither of your scripts work. See my previous posts for details on how they're broken. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 3:12 pm Post subject: |
|
|
| nml375 wrote: | | DragnLord wrote: | the second script is used as "!gline nick time reason"
it can easily be modified to have a default time in case one is not given
as for "which one is good?"; neither is good, however, both work |
DragnLord, sorry to say this, but neither of your scripts work. See my previous posts for details on how they're broken. | both scripts worked on my ircds when tested, thank you very much
Unrealircd accepts nicknames OR hostname/ip as the target |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 3:13 pm Post subject: |
|
|
| the second script works even if only nick is provided (on Unrealircd) |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 3:15 pm Post subject: |
|
|
the second script works even if only nick is provided (on Unrealircd)
the ircd then uses it's configured default time for the g:line with the requestor's handle as reason if none is given
although joining reason fixes the reason not being whole if there are spaces
(edit: I only tested script with single word reasons, that's why scripts should not be written before coffee....lol) |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Mar 13, 2008 3:23 pm Post subject: |
|
|
| Code: | set gline_time "1440"
bind pub G !gline pub:gline
proc pub:gline {n u h c t} {
putserv "gline $t $gline_time :Requested by $n ($h)"
} |
Fails, tcl error. gline_time is a global variable. Below is correct.
| Code: | | putserv "gline $t $::gline_time :Requested by $n ($h)" |
| Code: | bind pub G !gline pub:gline
proc pub:gline {n u h c t} {
set nick "[lindex $t 0]"
set time "[lindex $t 1]"
set reason "[lrange $t 2 end]"
putserv "gline $nick $time :$reason ($h)"
} |
Sloppy, very very sloppy.. not a good way to teach beginners or those wishing to pick up habits from other tcl scripters. This is how you should do it..
| Code: | set nick "[lindex [split $t] 0]"
set time "[lindex [split $t] 1]"
set reason "[join [lrange [split $t] 2 end]]" |
nml375 is only trying to help you, not ridicule you, neither am I. Just showing you that others will pick up your (bad) habit and unexpected consequences often arise with tcl special characters when treating strings as lists and vice versa.
@nml375 --v | Code: | | if {[llenght $data] <3} { |
llenght??!  |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 13, 2008 3:34 pm Post subject: |
|
|
As said by speechles, my intention of pointing out errors/flaws is to help people improve their coding. Just as I hope/expect ppl to point out errors I've made.
For some odd reason, it is (almost) always easier to see other peoples errors than one's own.. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 3:44 pm Post subject: |
|
|
splitting $t a second time is quite unneeded as it is already separated by spaces, no need to use split here (TCL already defaults to using the spaces as separators)
it's more of a "bad habit" to do unneeded things, at least in my opinion
thank you for pointing out the global variable error, my ircd configuration uses 1440 as default, so I didn't catch that one |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Mar 13, 2008 3:47 pm Post subject: |
|
|
| DragnLord wrote: | splitting $t a second time is quite unneeded as it is already separated by spaces, no need to use split here (TCL already defaults to using the spaces as separators)
it's more of a "bad habit" to do unneeded things, at least in my opinion
thank you for pointing out the global variable error, my ircd configuration uses 1440 as default, so I didn't catch that one |
Your forgetting your using unsanitized user input . I can use {[]} (nicknames allow these, don't they?) in my input and I've just broken your script (splitting would've kept this from happening).... these are the unexpected consequences that I mentioned happening with tcl special characters. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Mar 13, 2008 3:50 pm Post subject: |
|
|
Splitting a second time?
I think you are abit confused 'bout splitting...
Split converts a string to a list, $t is a string since it originates from the binding. Hence it should (must) be splitted prior being used with any commands expecting a list as a parameter. Using your code with a "reason" such as "evil user typing {" would illustrate how your script was broken, and how split is necessary.
A bad habit, in my opinion, is not bothering to keep track whether the content of a variable is a string or a list (always considder user input to be a string, never a list). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Thu Mar 13, 2008 4:04 pm Post subject: |
|
|
| speechles wrote: | | Your forgetting your using unsanitized user input . I can use {[]} (nicknames allow these, don't they?) in my input and I've just broken your script (splitting would've kept this from happening).... these are the unexpected consequences that I mentioed happening with tcl special characters. |
true enough, special characters may present issues, although on my tests with nicknames that included braces it still worked
as I said earlier, coding before coffee is baaaad |
|
| Back to top |
|
 |
CyberWar Voice
Joined: 04 Feb 2008 Posts: 36
|
Posted: Thu Mar 13, 2008 4:09 pm Post subject: |
|
|
My problem at the moment is not yet resolved?
this scripts does not work? |
|
| Back to top |
|
 |
|