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 detect SOP (&nick) in Unreal ircd

Old posts that have not been replied to for several years.
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

How to detect SOP (&nick) in Unreal ircd

Post by AUTIST »

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: Select all

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.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yeah like, you can use string index, string range and other string functions.

Code: Select all

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.
==================================
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

thanx guys, I'll try. I asked just to be sure that there is no standart command for this.
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

what did you try? post your code, we'll try to fix it
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

Code: Select all

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: Select all

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]
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

hmm I've got the feeling you didn't understand my suggestions

anyway, here's how to do it:

Code: Select all

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}
}
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

isnt this what 'set opchars' is for ?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

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: Select all

bind mode - * catch_mode
the best method to update the sops and owns list every time?

Thanks.
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

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?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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: Select all

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}
} 
User avatar
AUTIST
Voice
Posts: 20
Joined: Sun Feb 01, 2004 8:52 am

Post by AUTIST »

Yes, thanks, but one more problem :)
I use this for debug:

Code: Select all

"+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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

post a channel log with those modes (a/q) from your bot or IRC client
Locked