userhost_command
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | userhost_command [2007/02/02 23:17] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ======Synopsis: | ||
| + | __userhost__ [-direct] [-count < | ||
| + | |||
| + | ======Description: | ||
| + | This asks the server for the address (user@hostname) of each of the | ||
| + | specified nicknames. | ||
| + | however the irc protocol limits any one request to 5 nicknames; the client | ||
| + | will break your list into groups of 5 and request each group separately. | ||
| + | If you query too many nicknames, you may flood yourself off the server. | ||
| + | |||
| + | If you specify the **-cmd** option, then anything that follows that | ||
| + | option will be taken as a [[block]] that shall be executed for each and | ||
| + | every nickname in the list **IN THE SAME ORDER AS THE LIST**. | ||
| + | the nicknames in the list are not on irc, a placeholder userhost will be | ||
| + | passed to the -cmd block in that nickname' | ||
| + | |||
| + | ======About asynchronous behavior: | ||
| + | The traditional behavior of USERHOST was to execute the -cmd option | ||
| + | asynchronously. | ||
| + | is postponed until the future, when the server replies to the query. | ||
| + | When USERHOST behaves asynchronously, | ||
| + | a request for userhosts to the server and returns immediately. | ||
| + | option will not have been executed -- not even once -- and will not be | ||
| + | executed until the next time EPIC checks for data from the server. | ||
| + | |||
| + | ======About synchronous behavior: | ||
| + | However, if all of the nicknames in the list are present in the client' | ||
| + | internal userhost cache, then this command behaves synchronously. | ||
| + | -cmd option will be executed for **all** nicknames in the list **before** | ||
| + | **the USERHOST command returns.** | ||
| + | can use the **-direct** option to force __USERHOST__ to send the request | ||
| + | to the server instead of looking in the cache. | ||
| + | |||
| + | However, EPIC cannot cache the "away status" | ||
| + | provided by a userhost request and whenever it behaves synchronously, | ||
| + | away status and oper status will be wrong. | ||
| + | oper status, you should use the **-direct** option to get this information | ||
| + | from the server. | ||
| + | |||
| + | The use of the [[wait]] command arranges for synchronous behavior after | ||
| + | the execution of an asynchronous command. | ||
| + | |||
| + | ======Extra data: | ||
| + | Sometimes you want to pass extra data to the **-cmd** callback, and because | ||
| + | of the asynchronous behavior of [[userhost]], | ||
| + | without [[wait]]ing. | ||
| + | that takes a variable name and saves the contents of that variable at the | ||
| + | time you do the request, and then appends that value when the userhost | ||
| + | callbacks are executed. | ||
| + | userhost request, so you can change it (or use a local variable) and that | ||
| + | won't affect the value passed to the callbacks. | ||
| + | |||
| + | The extra data is appended to $* in the /on 303 numeric as well. | ||
| + | |||
| + | ======Options: | ||
| + | | -direct | ||
| + | | -cmd |Pass the output from __userhost__ as input to other commands: | | ||
| + | | -count | ||
| + | | -extra | ||
| + | |||
| + | __USERHOST__ passes the following arguments to -cmd: | ||
| + | |||
| + | $0 - nickname | ||
| + | $1 - a ' | ||
| + | $2 - a ' | ||
| + | $3 - username | ||
| + | $4 - hostname | ||
| + | $5- - The extra data, if any. | ||
| + | |||
| + | ======Examples: | ||
| + | To get the userhosts of JoeBob and Jimbo: | ||
| + | /userhost joebob jimbo | ||
| + | |||
| + | To use their userhost output as another command' | ||
| + | userhost joebob jimbo -cmd { | ||
| + | echo $0 is $3@$4 | ||
| + | if ( [$1] == [+] ) echo $0 is an irc operator | ||
| + | if ( [$2] == [+] ) echo $1 is away | ||
| + | } | ||
| + | |||
| + | To pass extra data to a userhost callback: | ||
| + | @ var = [This is" a compli\cat\\ed string" | ||
| + | userhost -extra var joebob jimbo -cmd { | ||
| + | xecho -b $0 is $3@$4 ($5-) | ||
| + | } | ||
| + | |||
userhost_command.txt · Last modified: 2007/02/02 23:17 by 127.0.0.1
