I posted this about 3 years ago, and I notice that it has long since left these forums... but with the advice of a few people in #mIRC, I'm posting it again.

I would like permission to access mIRC's callstack. That is, like $event and $ctimer, I want to be able to tell what Alias called the current alias/function. This is mainly for debugging purposes, but also for Anti-viral purposes in assisting a user with the detection and removal of undesirable code/scripts.

Certainly, mIRC must already keep a callstack, or else it wouldn't know what alias and line number to return to after it finishes processing a called sub-alias. So accessing this information doesn't seem as if it should be very difficult.

___ HELP ENTRY: ___

$calias
Returns the name of the alias presently being executed.
example: echo -s DEBUG! Alias: $calias - Line: $scriptline

$calias(N)
Returns the Nth parent alias in the callstack hierarchy. If N = 0 then the number of nested alias generations is returned. If a negative value is given, then the callstack is read in reverse.
$calias(-1) would return the present alias's immediate parent.

Properties: .fname, .ln, .local, .rcsv, .type

fname - returns the name of the script file
ln - returns the line number of the file in which the alias is presently stopped on, until the child alias returns
local - returns $true if ALIAS -l was used, making the alias local
rcsv - returns $true if ALIAS -r was used, making the alias recursive wink
type - returns 'remote' or 'alias' depending on which section the alias resides in

Examples:

echo -s *** $iif($ctimer,Timer: $ctimer,$iif($event, Event: $event, User Input)) -> $calias(1) -> $calias(2) -> $calias(3)

Alias UNSETALL { echo 4 -s *** UNSETALL attempt by $calias(-1) on line $calias(-1).ln in file $calias(-1).fname loaded under the $calias(-1).type section. | BEEP 99 | HALT }

- Raccoon

What do you think?


Well. At least I won lunch.
Good philosophy, see good in bad, I like!