| View previous topic :: View next topic |
| Author |
Message |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu May 17, 2012 12:20 am Post subject: |
|
|
That's weird. The channel #chan is set correctly yet you don't see the op notice? Anyway, add:
| Code: |
if {![channel get $chan cswhy]} return
if {[lsearch $text "Identification"] == -1} return
|
before:
| Code: |
set csWhyList [channel get $chan csWhyList]
|
and remove the debug line and it should be working fine. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Thu May 17, 2012 8:09 am Post subject: |
|
|
| now I see the chanserv's reply on the telnet only. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri May 18, 2012 4:20 am Post subject: |
|
|
The code in my previous comment makes it *ignore* any other notices if is not one regarding an issued WHY command, thus no more errors like that of a invalid channel.
To be honest I don't quite understand you. You said it's working, then it isn't and then you change your mind again. Decide already, is it working or not? I ran some tests and was working fine at me, yet at you it didn't. Don't know what exactly you've done there as it should work without any issues.
I'll get later on a bot on Dalnet servers and test this again, although the result shouldn't differ, meaning it's working as should. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Sat May 19, 2012 4:34 am Post subject: |
|
|
| I got the result only via telnet , not over ops notice. |
|
| Back to top |
|
 |
Amr Halfop

Joined: 14 Sep 2007 Posts: 94 Location: Egypt
|
Posted: Wed May 23, 2012 3:40 pm Post subject: |
|
|
| caesar; any news? |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu May 24, 2012 12:35 am Post subject: |
|
|
Here's a new version:
| Code: |
namespace eval csWhy {
setudef str csWhyList
setudef flag cswhy
bind mode * "% +o" [namespace current]::checkWhy
bind notc * * [namespace current]::checkReply
bind part * * [namespace current]::remove
bind sign * * [namespace current]::remove
bind nick * * [namespace current]::nick
bind kick * * [namespace current]::kick
bind join * * [namespace current]::botJoin
# purge
proc purge {chan user {newNick ""}} {
set csWhyList [channel get $chan csWhyList]
set pos [lsearch $csWhyList $user]
if {$pos != -1} {
if {![llength $newNick]} {
set csWhyList [lreplace $csWhyList $pos $pos]
} else {
set csWhyList [lreplace $csWhyList $pos $pos $newNick]
}
channel set $chan csWhyList $csWhyList
}
return $pos
}
# cleanup
proc cleanup {chan user} {
if {[isbotnick $user]} {
channel set $chan csWhyList {}
} else {
purge $chan $user
}
}
# join
proc botJoin {nick uhost hand chan} {
if {[isbotnick $nick]} {
channel set $chan csWhyList {}
}
}
# kick
proc kick {nick uhost handle chan vict reason} {
if {![channel get $chan cswhy]} return
if {![wasop $chan $nick]} return
cleanup $chan $nick
}
# part & sign
proc remove {nick uhost handle chan {text ""}} {
if {![channel get $chan cswhy]} return
cleanup $chan $nick
}
# nick
proc nick {nick uhost handle chan newNick} {
if {[isbotnick $nick] || ![channel get $chan cswhy]} return
if {![isop $chan $nick]} return
puthelp "ChanServ WHY $chan $newNick"
purge $chan $nick $newNick
}
# someone got OP'ed on the channel
proc checkWhy {nick uhost hand chan mode target} {
if {[isbotnick $target]} return
if {![channel get $chan cswhy]} return
set csWhyList [channel get $chan csWhyList]
lappend csWhyList $target
channel set $chan csWhyList $csWhyList
puthelp "ChanServ WHY $chan $target"
}
# reply of WHY command from ChanServ
proc checkReply {nick uhost hand text {dest ""}} {
if {[string equal -length 1 # $dest]} return
if {![string equal $nick "ChanServ"]} return
set text [split $text]
if {[lsearch $text "Identification"] == -1} return
set chan [string trim [lindex $text 5] {.}]
if {![channel get $chan cswhy]} return
set user [lindex $text 0]
if {[purge $chan $user] != -1} {
puthelp "NOTICE @$chan :$text"
}
}
}
putlog "cswhy.tcl loaded.."
|
I joined Dalnet in order to check this out but needed AOP on a channel to issue the WHy command so I had to fake a few things in order to test this out, and from my results it's working fine.
| Quote: |
* bot sets mode: +o caesar
<@bot> ChanServ WHY #chan caesar
-bot:@#chan- @ caesar has FOUNDER access to #chan. Reason: Identification to services with the channel password. Channel Frozen: NO
* caesar is now known as user
<@bot> ChanServ WHY #chan user
|
_________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|