! $eterna: functions,v 1.23 2021/03/20 21:34:53 mrg Exp $ ! ! Copyright (c) 1990-2018 Michael Sandrof, Troy Rollo, Matthew Green, ! and other ircII contributors. ! ! All rights reserved. See the HELP IRCII COPYRIGHT file for more ! information. ! IRCII Functions IRCII functions are substituted with the format $FUNCTION(arguments). A function is an ALIAS which assigns a value to FUNCTION_RETURN. For example: ALIAS DOUBLE assign FUNCTION_RETURN ${[$0]+[$0]} which is the same as: ALIAS DOUBLE @ function_return = [$0] * 2 used with: ALIAS SHOWDOUBLE echo $DOUBLE($0) will cause SHOWDOUBLE 7 to display "14". The following built-in functions already exist and cannot be overriden: CHATPEERS() Returns the list of nicks who you have dcc-chat connections with, in format nick,nick2,... Useful if you want to broadcast. CHANUSERS(channel) Returns a list of users on channel. CONNECT(HOST PORT) Returns the file descriptor for the connection. A NULL fd means host could not be resolved. Negative fd means some error occurred in the attempt. Communication through the connection is done with DCC RAW and ON DCC_RAW. (See DCC RAW and ON DCC_RAW) CURPOS() Returns the postition from the start of the input line to where the cursor is now. CRYPT(salt key) Crypts the input using the BSD crypt() function. There is no way of decrypting the result. This could be used for password crypting in a bot. (Note that this function is available only if the system libraries contain it.) DCCLIST(nick) Returns a list of dcc operations for specified nick. The list is a string which consists of two-character constants, where first char is one of: (C)hat, (S)end, (G)et, raw_(L)isten and (R)aw. Second char is one of: (C)losed, (A)ctive, (W)aiting, (O)ffered. You can use this for example to detect if you have a dcc-chat connection to someone. Returns 0 if you don't specify nick. DECODE(encoded text) Decode a single STRING of text produced by ENCODE() into its original characters. Note that these are case sensitive. ENCODE(input text) Convert input text to an encoded string suitable for use as an ircII variable or alias name. Any special including spaces can be encoded into the string. FILESTAT(filename) Performs a stat(2) on the specified filename. The returned values are size, uid, gid, mode and filename. HASVOICE(nick channel) Returns 1 if nick has voice on the given channel. Note that if the person is an operator on the given channel, this function is unreliable: It returns 1. IDLE() Returns the number of seconds since the last keyboard activity. IGNORED(NICK TYPE) Returns "ignored", "highlighted", "dont" or "0", depending on what ignore action will be applied to this NICK and TYPE of ignorance. TYPE must be one of MSGS, PUBLIC, WALLS, WALLOPS, INVITES, NOTICES, NOTES, CTCP or CRAP. If TYPE is missing, all of the ignore types matching NICK are returned, or "0". If both NICK and TYPE are missing, all ignored nicks, including full user@hosts, are returned. INDEX(CHARLIST STRING) Returns the index to the first character in STRING which appears in CHARLIST. If the first char in CHARLIST is a '^' returns the index to first char in STRING *NOT* in CHARLIST. ISCHANNEL(word) Returns 1 if word is a valid channel name. ISCHANOP(nick channel) Returns 1 if nick is a chanop on the given channel. LEFT(COUNT STRING) Returns the COUNT leftmost bytes from the STRING. LISTEN(PORT) Creates a listening socket on the specified port. If the port # is not specified then it returns the number of the port it chose arbitrarily. It cannot open a port# < 1025 MATCH(PATTERN WORDS) Returns an index into the list of WORDS of the first match for the given PATTERN. Returns 1 if it matches the first word, 0 if it matches none. MID(INDEX COUNT STRING) Returns COUNT bytes starting at position INDEX in STRING. MYCHANNELS(refnum) Returns a string with a list of channels on that windows server. (defaults to current window) MYSERVERS() Returns a string of the names of the servers you are connected to. NOTIFY(TYPE) Returns either the TYPE "here", "gone" or "all" lists, default being "here". ONCHANNEL(nick channel) Returns 1 if nick is on channel PID() Returns the current process ID. PPID() Returns the current parent process iD. QUERYNICK(refnum) Returns the nick, if any, that the window is queried to. RAND(LIMIT) Returns a random number x such that 0<=x