proc addowner:pub {nick uhost hand chan arg} {
# Check if the user has the necessary permission
if {![matchattr [nick2hand $nick] n]} {
return
}
# Extract the owner's nickname from the argument
set owneradd [lindex [split $arg] 0]
# Validate the nickname parameter
if {$owneradd eq ""} {
putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [addTrigger]addowner nickname"
return
}
# Check if the owner is a valid user
if {[validuser [nick2hand $owneradd]]} {
putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is already a valid user."
return
}
# Check if the owner is on the channel
if {![onchan $owneradd $chan]} {
putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is not even on $chan ..."
return
}
# Get the hostmask of the owner and add them as a global owner
set chanhost [getchanhost $owneradd $chan]
set mask *!*@[lindex [split $chanhost @] 1]
adduser $owneradd $mask
chattr $owneradd +n
# Send notifications to the involved users
putquick "NOTICE $nick :Added $owneradd to the Global Owner List."
putquick "NOTICE $owneradd :$nick ($hand) has added you to the Global Owner List."
}