/*
 * Example configuration file for Services. After making the appropriate
 * changes to this file, place it in the Services conf directory (as
 * specified in the "configure" script, default /home/username/services/conf)
 * under the name "services.conf".
 *
 * The format of this file is fairly simple: three types of comments are supported:
 *  - All text after a '#' on a line is ignored, as in shell scripting
 *  - All text after '//' on a line is ignored, as in C++
 *  - A block of text like this one is ignored, as in C
 *
 * Outside of comments, there are three structures: blocks, keys, and values.
 *
 * A block is a named container, which contains a number of key to value pairs
 * - you may think of this as an array.
 *
 * A block is created like so:
 * foobar
 * {
 *    moo = "cow"
 *    foo = bar
 * }
 *
 * Note that nameless blocks are allowed and are often used with comments to allow
 * easily commenting an entire block, for example:
 * #foobar
 * {
 *    moo = "cow"
 *    foo = bar
 * }
 * is an entirely commented block.
 *
 * Keys are case insensitive. Values depend on what key - generally, information is
 * given in the key comment. The quoting of values (and most other syntax) is quite
 * flexible, however, please do not forget to quote your strings:
 *
 *   "This is a parameter string with spaces in it"
 *
 * If you need to include a double quote inside a quoted string, precede it
 * by a backslash:
 *
 *   "This string has \"double quotes\" in it"
 *
 * Time parameters can be specified either as an integer representing a
 * number of seconds (e.g. "3600" = 1 hour), or as an integer with a unit
 * specifier: "s" = seconds, "m" = minutes, "h" = hours, "d" = days.
 * Combinations (such as "1h30m") are not permitted. Examples (all of which
 * represent the same length of time, one day):
 *
 *   "86400", "86400s", "1440m", "24h", "1d"
 *
 * In the documentation for each directive, one of the following will be
 * included to indicate whether an option is required:
 *
 * [REQUIRED]
 *     Indicates a directive which must be given. Without it, Services will
 *     not start.
 *
 * [RECOMMENDED]
 *     Indicates a directive which may be omitted, but omitting it may cause
 *     undesirable side effects.
 *
 * [OPTIONAL]
 *     Indicates a directive which is optional. If not given, the feature
 *     will typically be disabled. If this is not the case, more
 *     information will be given in the documentation.
 *
 * [DISCOURAGED]
 *     Indicates a directive which may cause undesirable side effects if
 *     specified.
 *
 * [DEPRECATED]
 *     Indicates a directive which will disappear in a future version of
 *     Services, usually because its functionality has been either
 *     superseded by that of other directives or incorporated into the main
 *     program.
 */

/*
 * [OPTIONAL] Defines
 *
 * You can define values to other values, which can be used to easily change
 * many values in the configuration. at once.
 */

/*
 * The services.host define is used in multiple different locations throughout the
 * configuration for services clients hostnames.
 */
define
{
	name = "services.host"
	value = "services.localhost.net"
}

/*
 * [OPTIONAL] Additional Includes
 *
 * You can include additional configuration files here.
 * You may also include executable files, which will be executed and
 * the output from it will be included into your configuration.
 */

#include
{
	type = "file"
	name = "some.conf"
}

#include
{
	type = "executable"
	name = "/usr/bin/wget -q -O - http://some.misconfigured.network.com/services.conf"
}

/*
 * [REQUIRED] IRCd Config
 *
 * This section is used to set up Anope to connect to your IRC network.
 * This section can be included multiple times, and Anope will attempt to
 * connect to each server until it finally connects.
 *
 * Each uplink IRCd should have a corresponding configuration to allow Services
 * to link to it.
 *
 * An example configuration for InspIRCd that is compatible with the below uplink
 * and serverinfo configuration would look like:
 *
 *     <link name="services.localhost.net"
 *           ipaddr="127.0.0.1"
 *           port="7000"
 *           sendpass="mypassword"
 *           recvpass="mypassword">
 *     <uline server="services.localhost.net" silent="yes">
 *     <bind address="127.0.0.1" port="7000" type="servers">
 *
 * An example configuration for UnrealIRCd that is compatible with the below uplink
 * and serverinfo configuration would look like:
 *
 *     link services.localhost.net
 *     {
 *          username *;
 *          hostname *;
 *          bind-ip "127.0.0.1";
 *          port 7000;
 *          hub *;
 *          password-connect "mypassword";
 *          password-receive "mypassword";
 *          class servers;
 *     };
 *     ulines { services.localhost.net; };
 *     listen 127.0.0.1:7000;
 */
uplink
{
	/*
	 * The IP or hostname of the IRC server you wish to connect Services to.
	 * Usually, you will want to connect Services over 127.0.0.1 (aka localhost).
	 *
	 * NOTE: On some shell providers, this will not be an option.
	 */
	host = "127.0.0.1"

	/*
	 * Enable if Services should connect using IPv6.
	 */
	ipv6 = no

	/*
	 * Enable if Services should connect using SSL.
	 * You must have m_ssl loaded for this to work.
	 */
	ssl = no

	/*
	 * The port to connect to.
	 * The IRCd *MUST* be configured to listen on this port, and to accept
	 * server connections.
	 *
	 * Refer to your IRCd documentation for how this is to be done.
	 */
	port = 7000

	/*
	 * The password to send to the IRC server for authentication.
	 * This must match the link block on your IRCd.
	 *
	 * Refer to your IRCd documentation for more information on link blocks.
	 */
	password = "mypassword"
}

/*
 * [REQUIRED] Server Information
 *
 * This section contains information about the Services server.
 */
serverinfo
{
	/*
	 * The hostname that Services will be seen as, it must have no conflicts with any
	 * other server names on the rest of your IRC network. Note that it does not have
	 * to be an existing hostname, just one that isn't on your network already.
	 */
	name = "stats.localhost.net"

	/*
	 * The text which should appear as the server's information in /whois and similar
	 * queries.
	 */
	description = "Stats for IRC Networks"

	/*
	 * The local address that Services will bind to before connecting to the remote
	 * server. This may be useful for multihomed hosts. If omitted, Services will let
	 * the Operating System choose the local address. This directive is optional.
	 *
	 * If you don't know what this means or don't need to use it, just leave this
	 * directive commented out.
	 */
	#localhost = "nowhere."

	/*
	 * What Server ID to use for this connection?
	 * Note: This should *ONLY* be used for TS6/P10 IRCds. Refer to your IRCd documentation
	 * to see if this is needed.
	 */
	#id = "00A"

	/*
	 * The filename containing the Services process ID. The path is relative to the
	 * services root directory.
	 */
	pid = "data/services.pid"

	/*
	 * The filename containing the Message of the Day. The path is relative to the
	 * services root directory.
	 */
	motd = "conf/services.motd"
}

/*
 * [REQUIRED] Protocol module
 *
 * This directive tells Anope which IRCd Protocol to speak when connecting.
 * You MUST modify this to match the IRCd you run.
 *
 * Supported:
 *  - bahamut
 *  - charybdis
 *  - hybrid
 *  - inspircd12
 *  - inspircd20
 *  - ngircd
 *  - plexus
 *  - ratbox
 *  - unreal
 */
module
{
	name = "inspircd20"
}

/*
 * [REQUIRED] Network Information
 *
 * This section contains information about the IRC network that Services will be
 * connecting to.
 */
networkinfo
{
	/*
	 * This is the name of the network that Services will be running on.
	 */
	networkname = "LocalNet"

	/*
	 * Set this to the maximum allowed nick length on your network.
	 * Be sure to set this correctly, as setting this wrong can result in
	 * Services being disconnected from the network.
	 */
	nicklen = 31

	/* Set this to the maximum allowed ident length on your network.
	 * Be sure to set this correctly, as setting this wrong can result in
	 * Services being disconnected from the network.
	 */
	userlen = 10

	/* Set this to the maximum allowed hostname length on your network.
	 * Be sure to set this correctly, as setting this wrong can result in
	 * Services being disconnected from the network.
	 */
	hostlen = 64

	/* Set this to the maximum allowed channel length on your network.
	 */
	chanlen = 32

	/* The maximum number of list modes settable on a channel (such as b, e, I).
	 * Comment out or set to 0 to disable.
	 */
	modelistsize = 100

	/*
	 * The characters allowed in hostnames. This is used for validating hostnames given
	 * to services, such as BotServ bot hostnames and user vhosts. Changing this is not
	 * recommended unless you know for sure your IRCd supports whatever characters you are
	 * wanting to use. Telling services to set a vHost containing characters your IRCd
	 * disallows could potentially break the IRCd and/or Services.
	 *
	 * It is recommended you DON'T change this.
	 */
	vhost_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"

	/*
	 * If set to true, allows vHosts to not contain dots (.).
	 * Newer IRCds generally do not have a problem with this, but the same warning as
	 * vhost_chars applies.
	 *
	 * It is recommended you DON'T change this.
	 */
	allow_undotted_vhosts = false

	/*
	 * The characters that are not allowed to be at the very beginning or very ending
	 * of a vHost. The same warning as vhost_chars applies.
	 *
	 * It is recommended you DON'T change this.
	 */
	disallow_start_or_end = ".-"
}

/*
 * [REQUIRED] Services Options
 *
 * This section contains various options which determine how Services will operate.
 */
options
{
	/*
	 * On Linux/UNIX systems Anope can setuid and setgid to this user and group
	 * after starting up. This is useful if Anope has to bind to privileged ports
	 */
	#user = "anope"
	#group = "anope"

	/*
	 * The case mapping used by services. This must be set to a valid locale name
	 * installed on your machine. Services use this case map to compare, with
	 * case insensitivity, things such as nick names, channel names, etc.
	 *
	 * We provide two special casemaps shipped with Anope, ascii and rfc1459.
	 *
	 * This value should be set to what your IRCd uses, which is probably rfc1459,
	 * however Anope has always used ascii for comparison, so the default is ascii.
	 *
	 * Changing this value once set is not recommended.
	 */
	casemap = "ascii"

	/*
	 * Sets the timeout period for reading from the uplink.
	 */
	readtimeout = 5s

	/*
	 * Sets the interval between sending warning messages for program errors via
	 * WALLOPS/GLOBOPS.
	 */
	warningtimeout = 4h

	/*
	 * If set, Services will only show /stats o to IRC Operators. This directive
	 * is optional.
	 */
	#hidestatso = yes

	/*
	 * A space-separated list of ulined servers on your network, it is assumed that
	 * the servers in this list are allowed to set channel modes and Services will
	 * not attempt to reverse their mode changes.
	 *
	 * WARNING: Do NOT put your normal IRC user servers in this directive.
	 *
	 * This directive is optional.
	 */
	#ulineservers = "services.your.network"

	/*
	 * How long to wait between connection retries with the uplink(s).
	 */
	retrywait = 60s
}

/*
 * [RECOMMENDED] Logging Configuration
 *
 * This section is used for configuring what is logged and where it is logged to.
 * You may have multiple log blocks if you wish. Remember to properly secure any
 * channels you choose to have Anope log to!
 */
log
{
	/*
	 * Target(s) to log to, which may be one of the following:
	 *   - a channel name
	 *   - a filename
	 *   - globops
	 */
	target = "stats.log"

	/* Log to both services.log and the channel #services
	 *
	 * Note that some older IRCds, such as Ratbox, require services to be in the
	 * log channel to be able to message it. To do this, configure service:channels to
	 * join your logging channel.
	 */
	#target = "stats.log #services"

	/*
	 * The source(s) to only accept log messages from. Leave commented to allow all sources.
	 * This can be a users name, a channel name, one of our clients (eg, OperServ), or a server name.
	 */
	#source = ""

	/*
	 * The bot used to log generic messages which have no predefined sender if there
	 * is a channel in the target directive.
	 */
	bot = "Global"

	/*
	 * The number of days to keep logfiles, only useful if you are logging to a file.
	 * Set to 0 to never delete old logfiles.
	 *
	 * Note that Anope must run 24 hours a day for this feature to work correctly.
	 */
	logage = 7

	/*
	 * What types of log messages should be logged by this block. There are nine general categories:
	 *
	 *  servers    - Server actions, linking, squitting, etc.
	 *  channels   - Actions in channels such as joins, parts, kicks, etc.
	 *  users      - User actions such as connecting, disconnecting, changing name, etc.
	 *  other      - All other messages without a category.
	 *  rawio      - Logs raw input and output from services
	 *  debug      - Debug messages (log files can become VERY large from this).
	 *
	 * These options determine what messages from the categories should be logged. Wildcards are accepted, and
	 * you can also negate values with a ~. For example, "~operserv/akill operserv/*" would log all operserv
	 * messages except for operserv/akill. Note that processing stops at the first matching option, which
	 * means "* ~operserv/*" would log everything because * matches everything.
	 *
	 * Valid server options are:
	 *    connect, quit, sync, squit
	 *
	 * Valid channel options are:
	 *    create, destroy, join, part, kick, leave, mode
	 *
	 * Valid user options are:
	 *    connect, disconnect, quit, nick, ident, host, mode, maxusers, oper
	 *
	 * Rawio and debug are simple yes/no answers, there are no types for them.
	 *
	 * Note that modules may add their own values to these options.
	 */
	servers = "*"
	#channels = "~mode *"
	users = "connect disconnect nick"
	other = "*"
	rawio = no
	debug = no
}

/*
 * [REQUIRED] MySQL Database configuration.
 *
 * m_mysql
 *
 * This module allows other modules to use MySQL.
 */
module
{
	name = "m_mysql"

	mysql
	{
		/* The name of this service. */
		name = "mysql/main"
		database = "anope"
		server = "127.0.0.1"
		username = "anope"
		password = "mypassword"
		port = 3306
	}
}

/*
 * IRC2SQL Gateway
 * This module collects data about users, channels and servers. It doesn't build stats
 * itself, however, it gives you the database, it's up to you how you use it.
 *
 * Requires a MySQL Database and MySQL version 5.5 or higher
 */
include
{
	type = "file"
	name = "irc2sql.example.conf"
}

