You can use [getchanhost $nick] or [getchanhost $nick $chan] but for this case it seems redundant as you said the user is out of the channel. This getchanhost only works if the user is on any of the channels as same with the bot, otherwise it returns "".
What you can do is bind raw after executing the proc:
Code: Select all
proc my:unban {nick uhost hand chan arg} {
................
.......................
bind raw - 354 my:getuhost
putserv "who $nicks \[i]%h
}
}
#and unbind it after you have removed the ban.
proc grp:getuhost {botnick hand arg} {
................
.......................
unbind raw - 354 my:getuhost
putserv "MODE #mychannel -b $nn"
}
}
Or either you can make a global variable, and do something like this:
Code: Select all
if {($pub_unban == 1)} { bind raw - 354 my:getuhost }
#Then in your both procs declare pub_unban as global.
#After that in the first one:
proc my:unban {nick uhost hand chan arg} {
global pub_unban
................
.......................
set pub_unban 1
putserv "who $nicks \[i]%h
}
}
#And in the second one:
proc grp:getuhost {botnick hand arg} {
global pub_unban
................
.......................
set pub_unban 0
unbind raw - 354 my:getuhost
putserv "MODE #mychannel -b $nn"
}
}
The only way to retrieve a userhost of a user outside a channel is in my knowledge, /who or /whois, or if you have nickserv services, say or some kind of services so the user is identified you can match them as well, but easier would be the first two. Secondly, when a bot joins a channel it does a /who upon the channel so thats why it is able to use getchanhost in the first place.
As for the channel thingy, this would be a bit complicated since you are doing /who and it has nothing todo with channels plus the user is not in the channel. You can make the bot do a foreach chan [channels] loop, and check with ischanban or some function and match if the ban is in the channel ban list then go ahead and remove it, something of that sort yeah.