# $EPIC: server,v 1.6 2004/06/17 00:03:34 jnelson Exp $
Synopsis:
   server
   server [<server description>|<server refnum>]
   server [+|-][<server name>]
   server [-add] <server description>       [see below]
   server [-delete <server refnum>]

About irc servers:
   The nexus of irc is the server, also known as "ircd", which comes in 
   different classes, such as "irc2.8", "irc2.9", "EFNext", "ircu2.8"
   "ircu2.9", "hybrid5", "hybrid6", "hybrid7", "dreamforge", "bahamut",
   and a huge list of others.  The above list classifies the most likely
   types of servers you will encounter.  There are some irc-like 
   implementations, most of which have been devised for microsoft windows
   operating systems.  EPIC does not promise to work on any server that
   diverges significantly from traditional irc (which these servers usually
   do) and so we will not consider these servers at all in this discussion.

   At the most basic level, all unix irc servers in widespread use have a
   direct lineage to one common ancestor, ircd2.8.  Therefore, the features
   provided by ircd2.8 are portable to all irc servers.  This includes the
   ability to join channels, to send messages to other users, to set topics,
   channel and user modes, to kick users from channels, and the like.  How-
   ever, through the course of time many extensions have been added to the 
   ircd software, and a particular set of extensions to ircd are distributed
   as a software package and typically are used by an entire network.  Each
   server "class" defines a loose set of extended functionality that is
   available to the user whenever you use that class of server.  That server's
   extensions may not be available on other servers, or it may be available
   in a different way.

How EPIC gets your server list:
   How does EPIC know what servers you want to use?  EPIC always tries
   to keep a server list, even if it contains only one server.

   The contents of the server list will always contain:
     * All servers, if any, you list on the command line.
     * The value, if any, of the IRCSERVER environment variable.

   If the server list is still empty *or* if you use the -a command line 
   option, then EPIC will read the "servers file", which is:
     * The value of the IRC_SERVERS_FILE environment variable, if any.
     * Otherwise the value of #define SERVERS_FILE (usually ircII.servers)

   The "servers file" can be an absolute path or start with a tilde (for
   home directory expansion), but if it is neither, then the file will be
   looked for in the IRCLIB directory, which is:
     * The value of the IRCLIB environment variable, if any
     * The value of #define IRCLIB in config.h

   If all of the above fails, EPIC will use the value of 
   #define DEFAULT_SERVER_LIST which is there only as a failsafe and not 
   as a useful default server list.

About server descriptions:
   A server description is a colon-separated list of several data items that 
   changes from time to time.  At the time of this writing, the current list
   was:
       host                 The hostname or IP address of the server
       port                 The port the server is running on
       password             The PASSword (if necessary) to log on with
       nick                 The NICKname to log on with
       group                The server group this belongs to
       protocol             The protocol to use, either "IRC" (the default)
                            or "IRC-SSL" (for ssl server connections)
   If you want to omit a field, just leave it blank.

About server refnums:
   Each entry in the server list contains the server's hostname, the server's
   port, the password (if any) the server requires for you to connect, and
   the nickname to use on the server.  This set of information is called a 
   "server specification" and each server specification is associated with 
   a "server refnum" which is a small integer value starting with 0.  When
   you see "server refnum" or "servref", that refers to the "server refnum"
   which is in the first column when you run the SERVER command with no
   options.

About servers and windows:
   Windows and servers have a many-to-one relationship.  Each window is 
   always connected to exactly one server at a time; no more and no less.
   You can have as many windows connected to a server as you want.  

   You can have as many servers open as you want.  A server is automatically
   opened when the first window is connected to it.  There is always one 
   window connected to every open server; a server is automatically closed
   when the last window is disconnected from it.

Description:
   The SERVER command manages EPIC's server list, letting you add,
   remove, connect, or disconnect servers as you need to.

Options:
    [none]       	If you specify no options, SERVER will show you the
                   	  current server list and the status of each server.
                          The first field is the "server refnum".
   +<server>     	Is an alias for window(4) server.
   -<server>     	Disconnects you from that server; inferior in function 
			  to the DISCONNECT command, which you should use 
			  instead.
   -add <server> 	Add the given server specification to the server list.
   -delete <server>	Delete the given server from the server list.  You may
			  not delete an open server.  You may not delete the
			  last server from the server list.
   +                    Connect to the "next" server (the next higher refnum,
                          or if the current server is the highest refnum, then
                          connect to server 0), and move all windows connected
                          to this server over to the "next" server once the 
                          connection is complete.
   -                    Connect to the "previous" server (the previous higher 
                          refnum, or if the current server is refnum 0, then
                          connect to the highest server refnum), and move all
                          windows connected to this server over to the
                          "previous" server once the connection is complete.

Note:
   As the colon is already used by EPIC as an argument seperator, IPv6
   adresses need to be surrounded in square brackets [] to prevent the
   colons from being interpeted.

Examples:
   To change to a new server, irc.foobar.com, on port 6668:
      /server irc.foobar.com 6668
      /server irc.foobar.com:6668

   To change to a new server and register with the nickname "JoeBob":
      /server irc.foobar.com:::JoeBob

   To switch to the next, or previous, server in your list
      /server +
      /server -

   To associate a new server, irc.booya.net, to your current window:
      /server +irc.booya.net

   To delete server 5 from your list:
      /server -delete 5

   To add server "irc.foo.com" on port 6667 with nick "blah" to your list:
      /server -add irc.foo.com:6667::blah

   To connect to an SSL server:
     /server irc.foobar.com:::::IRC-SSL

See Also:
   disconnect(1); on(5) connect, disconnect; reconnect(1);
   window(4) server

