| View previous topic :: View next topic |
| Author |
Message |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Wed Aug 24, 2005 9:58 pm Post subject: How to detect SOP (&nick) in Unreal ircd |
|
|
Hi guys,
We are sterted to use Unreal ircd in our network. And I want to recode some of cmds. How to detect that user is SOP in Unreal?
op detecting is workin properly in old version: | Code: | | if {[isop $nick]} {...} | (@ op char)
But how can I detect sop (& sop char)
And may be it is possible channel owener detection (~ char)
Thank in advance. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Wed Aug 24, 2005 10:19 pm Post subject: |
|
|
| catch the NAMES (automatically sent to each client upon joining a chan) or WHO #chan reply (eggdrop issues that command on joining a channel itself) and interpret whatever weird nick prefix sh*t Unreal might be using (of course, you also need to maintain your own [chanlist], updating it on MODE changes if necessary) |
|
| Back to top |
|
 |
awyeah Revered One

Joined: 26 Apr 2004 Posts: 1580 Location: Switzerland
|
Posted: Wed Aug 24, 2005 11:01 pm Post subject: |
|
|
Yeah like, you can use string index, string range and other string functions.
| Code: |
if {[string equal "&" [string index $var 0]]} { #do task 1 }
} elseif {[string equal "~" [string index $var 0]]} { #do task 2 }
} elseif {[string equal "%" [string index $var 0]]} { #do task 3 }
|
_________________ ·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
================================== |
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Wed Aug 24, 2005 11:08 pm Post subject: |
|
|
| thanx guys, I'll try. I asked just to be sure that there is no standart command for this. |
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Thu Aug 25, 2005 5:36 pm Post subject: |
|
|
Hi, I have tried to catch names with the special symbols, but no result.
Could you please give me a some code how can I catch the nickname with the specialsymol, like &AUTIST or ~AUTIST
Thanx |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 25, 2005 6:14 pm Post subject: |
|
|
| what did you try? post your code, we'll try to fix it |
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Thu Aug 25, 2005 6:27 pm Post subject: |
|
|
| Code: | if {([isop $nick $chan]) || ([isvoice $nick $chan]) || ([ishalfop $nick $chan]) || ([matchattr $hand n])} {
return
} else {
set phrase [lindex $plist [rand [llength $plist]]]
regsub -all -nocase {%nick} $phrase $nick phrase
putserv "PRIVMSG $chan :$phrase"
} |
This is a code.
This code check op, halfop, voice and botowner.
This check works for most irc network bacuse there are no more modes (flags) for user in channel. But, in the Unreal we have two additional flags (+a for SOP(superop) and +q for channel owner ). Like an op there is an additional symbol in nick ("@" for op) the has "&" - for SOP and "~" - for ChanOwner.
How can I detect that user has +q or +a mode (the user SOP or ChanOwner)
I have tried to get all chanlist by using:
| Code: | set chlist [chanlist $chan]
putlog "$chlist" |
but it's not create a list with additional sysmbol.
I need to catch the first spesial symbol if it is[/code] |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 25, 2005 7:38 pm Post subject: |
|
|
hmm I've got the feeling you didn't understand my suggestions
anyway, here's how to do it:
| Code: |
bind raw - 353 foo ;# NAMES reply
proc foo {f k t} {
set chan [lindex [split $t] 2]
set nicks [lrange [split $t] 3 e]
set ::sops($chan) {}
set ::owns($chan) {}
foreach n $nicks {
set i 0
set nick [string trimleft $n :@+&~]
while {1} {
set c [string index $n $i]
if {[string first $c :@+&~] == -1} {break}
if {$c == "&"} {lappend ::sops($chan) $nick}
if {$c == "~"} {lappend ::owns($chan) $nick}
incr i
}
}
}
bind raw - 366 bar ;# End Of NAMES reply
proc bar {f k t} {
# you can now use [issop] and [isown]
}
proc issop {nick chan} {
if {[lsearch -exact $::sops($chan) $nick] != -1} {return 1} {return 0}
}
proc isown {nick chan} {
if {[lsearch -exact $::owns($chan) $nick] != -1} {return 1} {return 0}
}
|
|
|
| Back to top |
|
 |
greenbear Owner
Joined: 24 Sep 2001 Posts: 733 Location: Norway
|
Posted: Thu Aug 25, 2005 10:05 pm Post subject: |
|
|
| isnt this what 'set opchars' is for ? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Aug 25, 2005 10:20 pm Post subject: |
|
|
| greenbear wrote: | | isnt this what 'set opchars' is for ? |
yeah, but the guy wants to know if a nick is actually "sop" or "owner" (according Unreal's designation), not simply if a nick is an op
of course, I've omitted MODE handling, but it's trivial, that guy should be able to add it himself |
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Thu Aug 25, 2005 10:46 pm Post subject: |
|
|
Thanks, it works, but how can I track realtime modes? I mean if the bot is on the channel and any user have had a SOP status (+a) or may be it has both of them +aoq
May be you have any ideas how track it?
Is the | Code: | | bind mode - * catch_mode | the best method to update the sops and owns list every time?
Thanks. |
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Thu Aug 25, 2005 10:50 pm Post subject: |
|
|
And additional question:
The bot is joining the channel and update his list with sops and owns.
But any owner also has +ao mode.
When this owner sets -q (remove owner flag) for himself - the bot removes him from owns list, BUT he is a SOP now and his nick doesn't exist in the sops list.
Have any ideas how to track it? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Aug 26, 2005 12:43 am Post subject: |
|
|
I don't use Unreal (it's a bloated mess), but I guess the server notifies channel members on sop/owner status change via +a/+q and -a/-q MODE change sent to channel (deduced from your last posting); if that's not the case and/or this doesn't work, you are on your own to fix it, I can't be bothered to investigate on real Unreal hehe
| Code: |
bind mode - * moo
proc moo {n u h c m v} {
switch -- $m {
"+a" {lappend ::sops($c) $v}
"+q" {lappend ::owns($c) $v}
"-a" {if {[info exists ::sops($c)] && [set i [lsearch -exact $::sops($c) $v]] != -1} {
set ::sops($c) [lreplace $::sops($c) $i $i]
}}
"-q" {if {[info exists ::owns($c)] && [set i [lsearch -exact $::owns($c) $v]] != -1} {
set ::owns($c) [lreplace $::owns($c) $i $i]
}}
}
}
bind raw - 353 foo ;# NAMES reply
proc foo {f k t} {
set chan [lindex [split $t] 2]
set nicks [lrange [split $t] 3 e]
set ::sops($chan) {}
set ::owns($chan) {}
foreach n $nicks {
set i 0
set nick [string trimleft $n :$::opchars]
while {1} {
set c [string index $n $i]
if {[string first $c :$::opchars] == -1} {break}
if {$c == "&"} {lappend ::sops($chan) $nick}
if {$c == "~"} {lappend ::owns($chan) $nick}
incr i
}
}
}
bind raw - 366 bar ;# End Of NAMES reply
proc bar {f k t} {
# you can now use [issop] and [isown]
}
proc issop {nick chan} {
if {[lsearch -exact $::sops($chan) $nick] != -1} {return 1} {return 0}
}
proc isown {nick chan} {
if {[lsearch -exact $::owns($chan) $nick] != -1} {return 1} {return 0}
}
|
|
|
| Back to top |
|
 |
AUTIST Voice

Joined: 01 Feb 2004 Posts: 20
|
Posted: Fri Aug 26, 2005 11:42 am Post subject: |
|
|
Yes, thanks, but one more problem
I use this for debug:
| Code: | "+q" {lappend ::owns($c) $v
putlog "$m $v"
} |
but in the bot console only +q appeared... without nickname. As the result it not deleting nicks if -flag and not adding is +flag. Cannot catch why it doesn't appear |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Aug 26, 2005 1:31 pm Post subject: |
|
|
| post a channel log with those modes (a/q) from your bot or IRC client |
|
| Back to top |
|
 |
|