egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to detect SOP (&nick) in Unreal ircd
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Wed Aug 24, 2005 9:58 pm    Post subject: How to detect SOP (&nick) in Unreal ircd Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Wed Aug 24, 2005 10:19 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
awyeah
Revered One


Joined: 26 Apr 2004
Posts: 1580
Location: Switzerland

PostPosted: Wed Aug 24, 2005 11:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Wed Aug 24, 2005 11:08 pm    Post subject: Reply with quote

thanx guys, I'll try. I asked just to be sure that there is no standart command for this.
Back to top
View user's profile Send private message MSN Messenger
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Thu Aug 25, 2005 5:36 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 25, 2005 6:14 pm    Post subject: Reply with quote

what did you try? post your code, we'll try to fix it
Back to top
View user's profile Send private message Visit poster's website
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Thu Aug 25, 2005 6:27 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 25, 2005 7:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
greenbear
Owner


Joined: 24 Sep 2001
Posts: 733
Location: Norway

PostPosted: Thu Aug 25, 2005 10:05 pm    Post subject: Reply with quote

isnt this what 'set opchars' is for ?
Back to top
View user's profile Send private message Send e-mail
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Thu Aug 25, 2005 10:20 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Thu Aug 25, 2005 10:46 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Thu Aug 25, 2005 10:50 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Aug 26, 2005 12:43 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
AUTIST
Voice


Joined: 01 Feb 2004
Posts: 20

PostPosted: Fri Aug 26, 2005 11:42 am    Post subject: Reply with quote

Yes, thanks, but one more problem Smile
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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Fri Aug 26, 2005 1:31 pm    Post subject: Reply with quote

post a channel log with those modes (a/q) from your bot or IRC client
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber