mIRC Homepage
Posted By: Krayzee isreg - 22/07/04 11:34 PM
i would like to see a new addition to the if command

isreg works like isop but will check if a nickname is registered with nickserv.

eg
Code:
if ( $nick isreg ) {
  do something
}


also maybe a $registered which returns $true is the nickname is registered with nickserv.
Posted By: Seifer Re: isreg - 22/07/04 11:40 PM
isreg is already in use:
isreg nickname v1 is a normal nick on channel v2

Also, I don't see how this would be possible, the server doesn't send a message out when a nickname is registered, so you'd have to use /who or /whois on every person that joined the channel.
Posted By: Mentality Re: isreg - 23/07/04 12:14 AM
Registration with NickServ has nothing to do with mIRC. What's more, some of the bigger networks use other services, other than NickServ, to allow their users to register usernames and the like. It would be inappropriate for mIRC to do such a thing, this can be accomplished with a raw event.

Regards,
Posted By: Wolfie Re: isreg - 04/08/04 06:34 AM
Untested, but the idea should be obvious:
Code:
on *:connect:hadd -m RegNicks $cid $gmt
raw 307:*:if ($comchan($2,0)) { AddReg $2 $gmt }
raw 318:*:var %x = $numtok($2,44) | while (%x) { var %n = $gettok($2,%x,44), %x = %x - 1 | if (!$isregnick(%n)) { AddReg %n $false } }
on *:quit:delreg $nick
on *:part:#:if ($comchan($nick,0) == 1) { delreg $nick }
on *:kick:#:if ($comchan($nick,0) == 1) { delreg $nick }
on *:nick:#:delreg $nick
alias -l AddReg { if (!$hget(regnicks).size) { hadd -m RegNicks $cid $gmt } | hadd RegNicks $+($cid,.,$1-) }
alias -l DelReg { if ($hget(regnicks,$+($cid,$1))) { hdel regnicks $+($cid,.,$1) } }
alias isregnick { return $iif($hget(regnicks,$+($cid,.,$1)),$ifmatch) }

This will function similar to the $ial in that when you do a whois on someone, if they are identified to their nick (it's registered) *AND* they are in at least one room you are in, then they'll be flagged as registered. If they change their nick or leave all the rooms you both are in (quit/get kicked/part), then they are removed from the list. (Someone else could switch to the nick and it's not practical to assume that the user on it is the owner).

Some networks permit you to do multiple nicks on one whois command in the form of /whois nick1,nick2,nick3,etc. so if the network you want to use this on supports that, then it's not too hard to make a script that will do a whois on all who are in rooms with you to fill up your list. smile When a /whois is done on someone (or multiple people), it will add a $false value for all the nicks that don't have a timestamp on them. (This makes it easier to know which nicks were already whois'd, but for some reason failed to be seen as a registered nick).

To add: Simple, it runs on it's own. Just get the whois's to list up smile
To check: $isregnick(nickname) = returns ($null if no whois was done), ($false if a whois was done but doesn't recognize the person as being registered) or (a timestamp ($gmt value) of when the last whois was done that returned the nick as being registered).

If you want it to return the timestamp of when it was first recognized, change the "raw 307" line to read as follows: raw 307:*:if ($comchan($2,0) && !$isregnick($2)) { AddReg $2 $gmt }

Hope this helps out (and works) for you.
© mIRC Discussion Forums