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 

public command for adding users to access list of eggdrop

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1051

PostPosted: Tue Dec 28, 2021 1:49 pm    Post subject: public command for adding users to access list of eggdrop Reply with quote

greetz im using this small tcl to add users in access list with o flag
i was wondering how we could use per channel access meaning if we add them in that channel they should have o flag for that channel only and not global


in partyline i did :
Quote:

.+user chanops
.chattr chanops -|+o


but it seems to give flag o for all channels where the bot sits
not sure why, as we wanted to grant per channel access






Code:


bind pub m !adduser pub_adduser
 
 
proc pub_adduser {nick host handle channel testes} {
set who [lindex $testes 0]

         if {[set chost [getchanhost $who $channel]] ne ""} {
            switch -glob -- $chost {
               {*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} - {*2001*67c*2f08*} - {*192.184.8.*} - {*192.184.9.*} - {*192.184.9.*} - {*192.184.10.*} {
                         set accessmask "[string trimleft [lindex [split $chost @] 0] "~"]"
                   set what "*!*[string tolower [string range $accessmask 1 end]]@*"
               }
               {default} {
                           set what [maskhost $who!$chost 5]
               }
            }
}

 if {![onchan $who $channel]} {
 putserv "NOTICE $nick :$who isn't on $channel."
 return 1
 }
 if {$who == ""} {
 putserv "NOTICE $nick :Usage: .adduser <User To Add.>"
 return 1
 }
 setuser chanops HOSTS $what
 putserv "NOTICE $nick :Added $who to User-Database."
 return 1
}
 
 
 
bind pub m !deluser pub_deluser

 
proc pub_deluser {nick host handle channel testes} {
set who [lindex $testes 0]

         if {[set chost [getchanhost $who $channel]] ne ""} {
            switch -glob -- $chost {
               {*.irccloud.com} - {*.mibbit.com} - {*.kiwiirc.com} - {*2001*67c*2f08*} - {*192.184.8.*} - {*192.184.9.*} - {*192.184.9.*} - {*192.184.10.*} {

                         set bmask "[string trimleft [lindex [split $chost @] 0] "~"]"
                   set usho *!*[string tolower [string range $bmask 1 end]]@*


                     
               }
               {default} {
                           set usho [maskhost $who!$chost 5]
               }
            }
}


if {$who == ""} {
putserv "NOTICE $nick :Usage: .deluser <User to delete.>"
return 1
}

delhost chanops $usho
putlog "$nick made me delete $who from userlist."
putserv "NOTICE $nick :as u wish $nick i deleted $who from userlist."
return 1
}
 

 
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1193

PostPosted: Tue Dec 28, 2021 6:15 pm    Post subject: Re: public command for adding users to access list of eggdr Reply with quote

simo wrote:

...

in partyline i did :
Quote:

.+user chanops
.chattr chanops -|+o


but it seems to give flag o for all channels where the bot sits
not sure why, as we wanted to grant per channel access


Do: .help chattr in the partyline.
See:
Quote:

You can also change the flags for Usagi on a specific channel by supplying
the channel after the attributes:
.chattr Usagi -m+dk-o #blah

in the info that is returned. There's more there to read, too.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1193

PostPosted: Tue Dec 28, 2021 6:25 pm    Post subject: Re: public command for adding users to access list of eggdr Reply with quote

I haven't run your code. However, I noticed a couple things that you might want to look into.

simo wrote:

Code:

...

proc pub_adduser {nick host handle channel testes} {
set who [lindex $testes 0]
...


lindex works on lists. $testes is a text string, not a list. So, it should be converted.
Thus:
Code:

set who [lindex [split $testes] 0 ]


Next:
simo wrote:

Code:

setuser chanops HOSTS $what



I don't think that you meant "chanops" there. I think you meant $who.

But before you use the setuser command on a username, I think you need to actually add the username.
See:
https://docs.eggheads.org/mainDocs/tcl-commands.html#adduser-handle-hostmask

Then, to modify a user's flags, see:
https://docs.eggheads.org/mainDocs/tcl-commands.html#chattr-handle-changes-channel


I hope this helps.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1051

PostPosted: Tue Dec 28, 2021 9:21 pm    Post subject: Reply with quote

Thanks willyw that helped a lot
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1051

PostPosted: Wed Dec 29, 2021 5:55 am    Post subject: Reply with quote

I was wondering lets say we want to add a nick in 2 or more channels is that possible or can only 1 channels be used
Back to top
View user's profile Send private message
simo
Revered One


Joined: 22 Mar 2015
Posts: 1051

PostPosted: Wed Dec 29, 2021 7:31 am    Post subject: Reply with quote

from the looks of it when doing whois on the user it seems to add channels seperate so it seems to work as we wanted to
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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