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.

how to change?

Old posts that have not been replied to for several years.
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

how to change?

Post by mm »

Hi, I hope some C expert can help me to change the source codes of +ban dcc command, when we use .+ban <host> <reason> and when we do .bans or .bans all
we can see that bans informations including who set the ban and ban's reason. I was wondering is it possible if kick message can show "who kicked" and "date" with a reason? like "nick was kicked by bot (Apr 23 mm: tesing.)

thank you
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

you could use the FILT bind to caputure all .+ban partyline commands and alter the banreason. that wouldnt require source code changes.
i least this is my interpretation of this:

Code: Select all

    (28) FILT (stackable)
         bind filt <flags> <mask> <proc>
         procname <idx> <text>

         Description: party line and file system users have their text sent
           through filt before being processed. If the proc returns a blank
           string, the text is considered parsed. Otherwise, the bot will use
           the text returned from the proc and continue parsing that
         Module: core
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

heh but how? can you give me some example pls?

thanks
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Code: Select all

bind filt - ".+ban *" banfilter

proc banfilter {idx text} {
   set text [split $text]
   if { [string match #* [lindex $text end]] || [string match \%* [lindex $text end]] || [llength $text] == 2 } {
      set reason "requested"
      set default 1
   } else {
      set reason [string trim [lindex $text end] "\""]
      set default 0
   }
   set reason "kicked by [idx2hand $idx] ([ctime [unixtime]]: $reason)"
   if {$default} {
      return "[join [lrange $text 0 end]] $reason"
   } else {
      return "[join [lrange $text 0 end-1]] $reason"
   }
}
I meant something like this. Untested, don't know if it works. maybe you may not split $text, maybe it doesnt trigger when it is supposed to, maybe the bot won't recognize the list elements for +ban right in the end.

the reason change the banreason to something like this, too of course:
append reason " (kicked by [idx2hand $idx] on [ctime [unixtime]])"

if you want to change the date format, replace ctime with strftime, refer TCL-Commands.doc and/or http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm#M6 for details.
Last edited by De Kus on Fri Apr 29, 2005 3:29 am, edited 2 times in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

thank you so much de kus, i'll test it and i'll let you know. Thanks again.

sorry i get this error message in the partyline
[03:20] Tcl error [banfilter]: extra characters after close-quote
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

mm wrote:[03:20] Tcl error [banfilter]: extra characters after close-quote
there were a redudant ] bracet and one was not moved correctly when I edited some part (after I noticed, that join kills "" quotes).

at least it seems to trigger correctly?!
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

well now i get this error
[02:28] Tcl error [banfilter]: wrong # args: should be "lindex list ?index...?"
thanks again
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

maybe your TCL version doesnt support the shortcut of "end", try using "end" instead of "e" (dont forget the one in lrange then). I tested it locally and there it works ^-^.
[09:02:03] tcl: evaluate (.tcl): lindex {one two three} e
Tcl: three
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

Thanks De kus, i'll let you know.
MM
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

thank you De Kus, it worked fine. the kick message shows like this
was kicked by testbot("kicked by mm (date, time: reason)", how do i remove these quotes?


thanks
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I told you to refer the manual to customize the date/time format ><

that quotes is strange, you could of course try to remove the quotes around $reason, seems they are not neccesarry in the party line command.

Tip: this strange in your head can be used to think, you don't need others to relay on for everything.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

Thanks but if i remove these quotes

Code: Select all

set reason "kicked by [idx2hand $idx] ([ctime [unixtime]]: $reason)" 
then i get error message

thanks
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

then read again what I said and look again what you did.

Tip: you removed the " quotes around the expression after reason
Tip2: Last edited by De Kus on Fri Apr 29, 2005 8:29 am; edited 2 times in total
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
m
mm
Halfop
Posts: 78
Joined: Thu Jul 01, 2004 10:24 pm

Post by mm »

Thank you so much De Kus, works great..
just one last thing, if i don't mention "reason" then it leaves it blank, doesn't put "requested"


thanks again
MM
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

the reason thing would require some enhancement anyway, if you really need it, I might change the whole thing (currently probably only 1 list element reasons will work).
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked