# $EPIC: redirect,v 1.3 2004/05/10 05:53:02 jnelson Exp $
Synopsis:
   redirect <nick>|*|<channel>|%<process>|=<nick> <command>

Description:
   Redirect sends a copy of all of the output sent to any windows connected
   to the current server to any place you can send a MSG to (ie, an 
   irc nickname, a channel, an EXEC process, a DCC CHATT, etc)
   The first argument is a MSG list and it can contain any number of
   targets and it's formatted like like a MSG would be.  REDIRECTing
   to the special target 0 (zero) acts as a sink and throws away all output.

   Because REDIRECT uses MSG to send the messages, redirected output
   will sometimes be PRIVMSGs and sometimes be NOTICEs.  This is all handled
   by the protocol enforcement and is not directly under anyone's control.

   REDIRECT will execute <command>, and any immediate output from 
   <command> will directly be sent to the target(s).  If <command> sends
   any data to the server, REDIRECT assumes it is a server request and
   will CONTINUE TO FORWARD YOUR OUTPUT to the targets until a full PING
   cycle to the server completes.  This can be VERY BAD especially since 
   it is possible (and likely) that things other than just the output of 
   <command> will be forwarded to your target(s).  YOU HAVE BEEN WARNED!

   REDIRECT is synchronous.  It will not return until <command> has 
   completed.  However, if <command> launches a server request, then 
   REDIRECT will return immediately but will continue redirecting
   output to the target(s) for a full PING cycle afterwards.  You cannot
   stop a REDIRECT in progress!

   It is possible to set up two clients to get into a REDIRECT loop
   with each other, if you try hard enough.  This is really bad, and you 
   should try not to allow this to happen.

   It is VERY possible that you could accidentally flood yourself off of
   irc or annoy others by REDIRECTing them something with a lot of 
   output, such as the LASTLOG command.

   All output that is redirected with this command is hooked through the
   ON REDIRECT hook, and you can suppress redirected lines by 
   hooking them silently.

   It is probably a good idea not to send (or recieve) any msgs while a
   REDIRECT is going on, as those messages will be forwarded on to 
   whoever your REDIRECT target is.  This is not a bug in EPIC, it's
   just one of the problems with using REDIRECT.

   You cannot use REDIRECT in a window that is not connected to a
   server, even if you are going to run a command that does not need a 
   server connection and you are not going to send the output to a target
   over irc. 

Examples:
   To send the output of a WHOIS to channel #blah:
      /redirect #blah whois foobar

   To send the output of a USERHOST to a running subprocess:
      /redirect %finger userhost foobar

   To send the current topic to JoeBob and JimBob:
      /redirect joebob,jimbob topic #blah

See Also:
   msg(1); wait(5); lastlog(1)

