mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 2,812
Raccoon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Ever since mIRC 5.3 or there-abouts, I've wondered why there weren't any IDENT identifying identifiers (say that 3 times fast). smirk

Here is the current lineup of Address Identifiers:

Local
[*] $me -- returns your nickname. (Nickname)
[*] $host -- returns your hostname. (ppp-123.webaccess.net)
[*] $ip -- returns your IP address. (123.123.123.123)

Remote
[*] $nick -- returns the user's nickname. (Nickname)
[*] $site -- returns the user's hostname. (ppp-123.webaccess.net)
[*] $wildsite -- returns the type 2 $mask... (*!*@ppp-123.webaccess.net)
[*] $address -- returns the [email]user@address[/email] (~user@ppp-123.webaccess.net)
[*] $fulladdress -- returns the whole shebang (Nickname!~user@ppp-123.webaccess.net)

What we are missing is the ability to directly access the "user" (aka: ident) portion of a remote address, or our own. So I propose the following identifiers:

Local
[*] [color:000099]$ident -- returns the user portion of your own address. (~user)[/color]
Instead of having to use $gettok($gettok($address($me,5),1,64),2,33) -- and that only works if you're presently in a channel.

Remote
[*] [color:000099]$user -- returns the "user" portion of the user's nickname. (~user)[/color]
Instead of having to use $gettok($address,1,64).

And
[*] [color:000099]$identd -- returns On/Off and Default Identd value (like /identd).[/color]

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Nice suggestions, I've been wanting these identifiers for a long time.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Nice suggestions.
For now, you could use:

Code:
alias user { return $readini($mircini,mirc,user) }
alias identd { return $readini($mircini,ident,active) }
alias ident { return $readini($mircini,ident,userid) }


for local info.


New username: hixxy
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
And to add to what's already been said as far as workarounds in the meantime...

; Here are the identifiers you named...
;

alias ident if ($isid) return $ial($me).user
alias user if ($isid) return $ial($1).user
alias Identd if ($isid) return $Identd.EnableIdentdServer ( $+ $Identd.UserID $+ )

; And here are the rest of the properties from that Options page, as $identifiers.
;

alias Identd.EnableIdentdServer if ($isid) return $iif($readini($mircini, ident, active) == yes, On, Off)
alias Identd.UserID if ($isid) return $readini($mircini, ident, userid)
alias Identd.System if ($isid) return $readini($mircini, ident, system)
alias Identd.Port if ($isid) return $readini($mircini, ident, port)
alias Identd.ShowIdentdRequests if ($isid) return $iif($readini($mircini, Options, n0), 4, 44), On, Off)
alias Identd.EnableOnlyWhenConnecting if ($isid) return $iif($readini($mircini, Options, n0), 27, 44), On, Off)

; And finally, here is an example of how to more fully implement commands for one of these properties,
; using $com, the WScript.Shell object and its SendKeys method to change the selections as necessary.
;
; USAGE:
; [color:#840017]$Identd.UseIDFromEmailAddress
(returns On or Off)
; /Identd.UseIDFromEmailAddress (echos the current state)
; /Identd.UseIDFromEmailAddress On
; /Identd.UseIDFromEmailAddress Off
;[/color]
alias Identd.UseIDFromEmailAddress {
  • ; Retrieve the current setting in On or Off format.
    ;

    var %OnOff = $iif($readini($mircini, Options, n6), 33, 44), On, Off)

    ; If it's being called as an identifier, return the current setting.
    ;

    if ($isid) return %OnOff

    ; If it's being called as a command with no parameter, echo the current setting.
    ;

    elseif (!$1) echo -atic info2 * Identd: Use ID from email address is $+($chr(2),%OnOff)

    ; Make sure the first parameter is either "On" or "Off", case insensitive.
    ;

    elseif (!$istok(On Off, $1, 32)) echo -atic info2 * Usage: /Identd.UseIDFromEmailAddress [On|Off]

    ; Check to see if the setting is already set to the chosen parameter, On or Off.
    ;

    elseif ($1 == %OnOff) echo -atic info2 * Identd: Use ID from email address is already $+($chr(2),%OnOff)

    ; Otherwise, toggle the setting, using the SendKeys method to navigate to and change the correct setting.
    ; % $+ o means Alt+O, and opens the Options dialog.
    ; {HOME} puts the cursor on Connect.
    ; {LEFT} closes the Connect node, if it wasn't already.
    ; {RIGHT 5} opens it back up (gets it to a known state) and then moves down to the 4th node underneath Connect, which is Identd.
    ; {TAB 7} tabs seven times to arrive on the correct checkbox.
    ; The space between the {TAB 7} and {ENTER} toggles (either puts a check in or removes the check from) the checkbox.
    ; {ENTER} presses the OK button to save and exit.
    ;

    else {

    ; Open the WScript.Shell object by the name W.
    ;

    .comopen W WScript.Shell

    ; Close the W object after using its SendKeys method to send the string to mIRC.
    ;

    .comclose W $com(W,SendKeys,3,*bstr,% $+ o{HOME}{LEFT}{RIGHT 5}{TAB 7} {ENTER})

    }
}

Note: I would normally have used a more descriptive object name, such as objWSH, and perhaps added $ticks to its name to prevent duplicate objects. However, for the purposes of this example, I didn't want the SendKeys string to wrap so that you would see where the space goes, between {TAB 7} and {ENTER}, that toggles the checkbox. That is why I intentionally made the else block as short as I could and still fit on a single line to fit these forums.

Is this overkill, or what? cool


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
Can use $ial(nick).user to return what you want.

will work for both the $ident & $user

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I believe Raccoon is talking about an non IAL-related place in memory which would hold your own full address. This would require a silent /who $me upon connection (certain ircds include your full address in one or more of the 00? raws. Perhaps mirc could check that and skip the /who $me in such cases, although I have no idea how reliable this can be). It can be scripted of course, but I'd prefer having it built-in.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
sounds good to me smile


Those who fail history are doomed to repeat it

Link Copied to Clipboard