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 

detect user flags

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Koach
Voice


Joined: 19 Apr 2009
Posts: 21

PostPosted: Sun Apr 19, 2009 6:59 pm    Post subject: detect user flags Reply with quote

I have looked hard for the answer to this and can't find it. But, I am sure it's going to be a simple solution.

I am trying to write a simple script that will only accept input from users that have channel flag +o.
The input must be sent via a PRIVMSG. The user might or might not be actually opped (channel mode +o) when they send the PRIVMSG, but they will be in the channel and IDENT'd to the bot.

I know I can do something like this:

bind msg o|o qban msg:qban

and then:

proc msg:qban {nick host handle stuff} {
code here
}

But, as I understand it, that won't really test the channel flag for the nick.

I can easily extract the channel name and user name from the string in "stuff" but, how can I test the users nick for channel flags?

Am I missing something obvious?

Thanks in advance.
Koach
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Apr 19, 2009 7:40 pm    Post subject: Reply with quote

Actually, I think you're looking at the wrong kind of binding..
msg bindings are used for user-to-user messages, not user-to-channel messages. As such, there is no channel information related to the message.

Or were you thinking of forcing the user to supply the channel name in the message? If so, extract the channel from the message, and use the matchattr command to test the privileges.

As for the flags-mask, the syntax is "globalflags[(&|)[channelflags[(&|)botflags]]]", where & specifies that all flags must match, and | any flag will be sufficient. For applications that does not provide a channelname, the channelflags part is tested against any/all channels.

A few examples of different "flag-masks". I've used bindings here, but they could easily be swapped for the matchattr command (msg binding would be equivalent of omitting the channel argument, pub would be including it).
Code:
bind msg o msg:test
#Triggers for any global op.

bind msg o|o msg:test2
#Triggers for any global op, and any local op in any channel

bind pub o pub:test
#Triggers for any global op.

bind pub o|o pub:test2
#Triggers for any global op, and any local op in the channel it's invoked within.

bind pub o&o pub:test3
#Triggers for any user who is both a global op and a local op for the channel it's invoked within.

bind pub fp| pub:test4
#Triggers for any global friend or partyline access user.

bind pub fp& pub:test5
#Triggers for any user with both global op and partyline access.


Reading your post a second time, I believe this is what you are looking for:
Code:
bind msg o|o qban msg:qban
proc msg:qban {nick host handle stuff} {
 ... extracting chan and storing it in $chan...

 if {![matchattr $handle "o&o" $chan]} {
  #User does not have permission for this command, abort
  return 0
 }
 
... Rest of code here...
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Koach
Voice


Joined: 19 Apr 2009
Posts: 21

PostPosted: Sun Apr 19, 2009 7:51 pm    Post subject: Reply with quote

That's exactly what I was looking for Smile

Thanks
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
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