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.

public command for adding users to access list of eggdrop

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

public command for adding users to access list of eggdrop

Post by simo »

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


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
}
  

  
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: public command for adding users to access list of eggdr

Post by willyw »

simo wrote:
...

in partyline i did :
.+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:
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 !
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Re: public command for adding users to access list of eggdr

Post by willyw »

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

Code: Select all

...

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

set who [lindex [split $testes] 0 ]
Next:
simo wrote:

Code: Select all

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- ... e-hostmask

Then, to modify a user's flags, see:
https://docs.eggheads.org/mainDocs/tcl- ... es-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 !
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Thanks willyw that helped a lot
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
s
simo
Revered One
Posts: 1072
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
Post Reply