#!/bin/sh
#
# cygnus.conf generator. This script will only prompt for required
# informatation. If it is run with the -auto option, it is assumed that
# it is being run by the Makefile, and will ask if you want to run it.

# Nifty handy functions.

echo2 () {
	$ECHO2 "$*$ECHO2SUF"
}

ECHO2SUF=''
if [ "`echo -n a ; echo b`" = "ab" ] ; then
	ECHO2='echo -n'
elif [ "`echo 'a\c' ; echo 'b'`" = "ab" ] ; then
	ECHO2='echo' ; ECHO2SUF='\c'
elif [ "`printf 'a' 2>&1 ; printf 'b\n' 2>&1`" = "ab" ] ; then
	ECHO2='printf "%s"'
else
	ECHO2='echo'
fi
export ECHO2 ECHO2SUF

# Command line parsing

AUTO=
IGNORE_CACHE=
export AUTO IGNORE_CACHE

while [ $# -gt 0 ] ; do
    if [ "$1" = "-ignore-cache" ] ; then
	IGNORE_CACHE=flibble
    fi
    if [ "$1" = "-auto" ] ; then
	AUTO=flibble
    fi
    shift
done

# And now the defaults for the required options, as found in the conf.

DEST=flibble
DOMAIN=example.net
INFONAME=services.$DOMAIN
CONNECTIP=127.0.0.1
CONNECTPASS=linkage
CONNECTPORT=6667
UNREALNUMERIC=100
IRCDTYPE=1
SRANICK=
SRAPASS=
NETWORK=ExampleNet
IRCD=1

# Load up configure.cache -- For the destination dir.
if [ -f ../configure.cache ] ; then
    . ../configure.cache
fi

# Check for a makeconf.cache
if [ -f ../makeconf.cache -a ! "$IGNORE_CACHE" ] ; then
    cat <<EOT
Using cached answers from a previous run. To ignore, either
remove makeconf.cache or give the command-line option "-ignore-cache".

EOT
    . ../makeconf.cache
fi

# Intro text

export ok INPUT
ok=0
if [ "$AUTO" ] ; then
	echo " "
	echo "*** Would you like to run the makeconf script?"
	echo "*** You will still need to edit your conf file"
	echo "*** by hand to configure most options."
	echo " "
	while [ $ok -eq 0 ] ; do
		echo2 "[Yes] "
		if read INPUT ; then : ; else echo "" ; exit 1 ; fi
		if [ ! "$INPUT" ] ; then
			ok=1
		fi
		case $INPUT in
			[Yy]*)
				ok=1
				;;
			[Nn]*)
				echo " "
				echo "*** Now edit the conf, configure your server(s), and run"
				echo "*** Cygnus. Please read the documentation before seeking"
				echo "*** help. Thanks."
				echo " "
				exit 0
				;;
		esac
	done
fi

clear
echo "Cygnus -- Copyright (c) 2000-2002 Darcy Grexton"
echo ""
echo "This generator will only ask you for information for the"
echo "most crucial questions. The cygnus.conf file contains"
echo "many configurable options. It's suggested that after you"
echo "are done with this script, you check your conf file over."
echo ""
echo2 "Press enter to begin, or CTRL+C to abort."
if read INPUT ; then : ; else echo "" ; exit 1 ; fi

# On to the questions!

echo " "
echo "What IP address should Cygnus try to connect to?"
echo2 "[$CONNECTIP] "
read cc
if [ ! -z "$cc" ]; then
	CONNECTIP="$cc"
fi

echo " "
echo "What port should we use when connecting to the above address?"
echo2 "[$CONNECTPORT] "
read cc
if [ ! -z "$cc" ]; then
	CONNECTPORT="$cc"
fi

echo " "
echo "What password should we use for the link?"
echo2 "[$CONNECTPASS] "
read cc
if [ ! -z "$cc" ]; then
	CONNECTPASS="$cc"
fi

echo " "
echo "What is your network's domain name? ie, example.net"
echo2 "[$DOMAIN] "
read cc
if [ ! -z "$cc" ]; then
	DOMAIN="$cc"
fi

# Update these
INFONAME=services.$DOMAIN

echo " "
echo "What should Cygnus call it's server?"
echo2 "[$INFONAME] "
read cc
if [ ! -z "$cc" ]; then
	INFONAME="$cc"
fi

echo " "
echo "What is your network's name? ie, ExampleNet"
echo2 "[$NETWORK] "
read cc
if [ ! -z "$cc" ]; then
	NETWORK="$cc"
fi

ok=0
echo " "
echo "Please select the IRCd you are using from the list below."
echo "This MUST be set properly or Cygnus will not function correctly."
echo " "
echo "    1) DreamForge"
echo "    2) Prometheus"
echo "    3) Bahamut"
echo "    4) UnrealIRCd 3"
echo "    5) UnrealIRCd 3.2"
while [ $ok -eq 0 ] ; do
        echo2 "[$IRCDTYPE] "
        if read INPUT ; then : ; else echo "" ; exit 1 ; fi
        if [ ! "$INPUT" ] ; then
                INPUT=$IRCDTYPE
        fi
        case $INPUT in
                [1-5])
                        ok=1
                        ;;
                *)
                        echo "Please choose one of the options listed above."
                        ;;
        esac
done
IRCDTYPE=$INPUT

if [ "$IRCDTYPE" -eq "4" -o "$IRCDTYPE" -eq "5" ] ; then
	echo " "
	echo "Please enter a number between 1 and 255 for use with Unreal."
	echo "This number cannot be in use by any other servers on your network."
	echo2 "[$UNREALNUMERIC] "
	read cc
	if [ ! -z "$cc" ]; then
		UNREALNUMERIC="$cc"
	fi
fi

echo " "
echo "Please give the nickname for one SRA. If you want to define more,"
echo "edit cygnus.conf after you are done makeconf. You must define"
echo "at least one SRA."
echo2 "[$SRANICK] "
read cc
if [ ! -z "$cc" ]; then
	SRANICK="$cc"
fi

echo " "
echo "Please give the password for the above SRA."
echo2 "[$SRAPASS] "
read cc
if [ ! -z "$cc" ]; then
	SRAPASS="$cc"
fi

echo " "
echo2 "Writing cygnus.conf ..."
cat >cygnus.conf <<_EOT_
# Cygnus Config file -- Copyright (c) 2001-2002 Darcy Grexton
#
# Options that indicate a time value should be given as #w#d#h#m#s - Examples:
# 2 weeks, 4 days, 3 hours, 15 minutes, 30 seconds: 2w4d3h15m30s
# 5 days, 12 hours, 10 minutes, 30 seconds: 5d12h10m30s
# 6 hours, 30 seconds: 6h30s
# 60 seconds: 60s
# 1 minute: 1m
#
# Options with no parameters/format listed are toggles and are either
# on or off. (uncommented or commented)
#
# Multi-parameter options require all parameters unless otherwise stated.

# Server Information: What should we call ourselves?
# Format: Info cygnus.server.name Server Description
# This is required.

Info $INFONAME

# Connection Information: Where should we connect to?
# Format: Connect IP.or.address Port Password
# This is required.

Connect $CONNECTIP $CONNECTPORT $CONNECTPASS

# BindTo: What address/port should be bind to, if any?
# Format: BindTo IP.or.address Port
# Comment to disable.

#BindTo $CONNECTIP $CONNECTPORT

# If you are using UnrealIRCd, define this. This needs to be a number
# between 1 and 255, and not used by any other servers on your network.
# This is required for UnrealIRCd.

_EOT_
        
if [ "$IRCD" -eq "3" ] ; then cat <<_EOT_ >>cygnus.conf
UnrealNumeric $UNREALNUMERIC
_EOT_
fi
                
if [ ! "$IRCD" -eq "3" ] ; then cat <<_EOT_ >>cygnus.conf
#UnrealNumeric 100
_EOT_
fi

cat <<_EOT_ >>cygnus.conf

# Define the type of IRCd you are using. This MUST be configured. If
# this is not set properly, Cygnus will not work properly on your network.
# If your IRCd is not listed below, you can try a similar IRCd, but there
# are no gaurantees with any IRCds not listed.
# There are 5 supported IRCds:
#      DreamForge
#      Prometheus
#      Bahamut
#      Unreal 3
#      Unreal 3.2
# You must include any spaces shown above. For example:
# IRCdType Unreal 3.2
# This is required.

_EOT_

if [ "$IRCDTYPE" -eq "1" ] ; then cat <<_EOT_ >>cygnus.conf
IRCdType DreamForge
_EOT_
fi

if [ "$IRCDTYPE" -eq "2" ] ; then cat <<_EOT_ >>cygnus.conf
IRCdType Prometheus
_EOT_
fi

if [ "$IRCDTYPE" -eq "3" ] ; then cat <<_EOT_ >>cygnus.conf
IRCdType Bahamut
_EOT_
fi

if [ "$IRCDTYPE" -eq "4" ] ; then cat <<_EOT_ >>cygnus.conf
IRCdType Unreal 3
_EOT_
fi

if [ "$IRCDTYPE" -eq "5" ] ; then cat <<_EOT_ >>cygnus.conf
IRCdType Unreal 3.2
_EOT_
fi

cat <<_EOT_ >>cygnus.conf

# RootServ Information - Services Root Admin Service
# Format: SRAService NickName UserName HostName Modes RealName
# Mode suggestions:
#      UnrealIRCd: +ioS
#      Other     : +io
# RootServ is required.

SRAService RootServ service $DOMAIN +io Services Root Admin Service

# NickServ Information - NickName Service
# Format: NickNameService NickName UserName HostName Modes RealName
# Mode suggestions:
#      UnrealIRCd: +iS
#      Other     : +i
# Comment to disable.

NickNameService NickServ service $DOMAIN +i NickName Service

# ChanServ Information - Channel Service
# Format: ChannelService NickName UserName HostName Modes RealName
# Mode suggestions:
#      UnrealIRCd: +iSd
#      Other     : +i
# Comment to disable.

ChannelService ChanServ service $DOMAIN +i Channel Service

# MemoServ Information - Memo Service
# Format: MemoService NickName UserName HostName Modes RealName
# Mode suggestions:
#      UnrealIRCd: +iS
#      Other     : +i
# Comment to disable.

MemoService MemoServ service $DOMAIN +i Memo Service

# GlobalNoticer Information - Global Noticer
# Needed by: RS:GLOBAL
# Requires: RootServ
# Format: GlobalNoticer NickName UserName HostName Modes RealName
# Mode suggestions:
#      UnrealIRCd: +ioS
#      Other     : +io
# Note: The GlobalNoticer must always be +o to function.
# Comment to disable.

#GlobalNoticer Global service $DOMAIN +io Global Noticer

# Define your SRAs here. Use one line per SRA. The format is:
# SRA nickname password
# Any opered user can authenticate as an SRA, so you could define
# one SRA to use as a role nick.
# At least one SRA is required.

SRA $SRANICK $SRAPASS

# Do you want SRA access to be secure? If this is on, your SRAs will need
# to AUTH with RootServ to gain SRA access. If it's off, they will only
# need to identify to their nickname.
# Comment to disable.

SecureSRA

# Do you want Services to send out a GlobOps when an SRA AUTHs? Some
# people like it, others don't, it's up to you. Note that Services will
# always globop failed auth attempts.
# Comment to disable.

GlobalOnAuth

# What is the name of your network? This can be up to 32 characters in length.
# This is needed for certain functions of services. Ideally you would put
# something here like 'ExampleNet'.
# This is required.

NetworkName $NETWORK

# Enter your desired flood trigger here. This tells Services how many
# messages in how much time to consider a flood. If it determines that
# a user is flooding, it will ignore them twice, then it will temporarily
# AKill them for 30 minutes. This does NOT detect your average flood. This
# only applies to users communicating with Services. The first number
# controls how many messages may be recieved, and the second number is
# how long before the counter resets. For example, 7 10s would take action
# against users who sent 7 messages to Services in 10 seconds.
# Comment to disable.

FloodTrigger 7 10s

# If you want Services to send GlobOps about people who are flooding,
# define this. Otherwise it will all be done silently.
# Comment to disable.

NoisyFlood

# TLD: Define your network's top level domains. This is nessecary
# for the global noticing functions. This should be a space seperated
# list of TLDs, not including the leading period. For example:
# TLD net org com ca us au
# Needed by: GlobalNoticer

TLD net org com

# Do you want Services to send global notices when they shut down
# and when they come back online?
# Requires: GlobalNoticer
# Comment to disable.

StatusGlobals

# If you want your global notices to be prefixed with something,
# enter that here. Keep this short. An example might be 'Netwide Notice'.
# This would show as '[Netwide Notice] Message'.

#GlobalMSG Netwide Notice

# Select the type of helpfile indexes you want to use. You have
# three choices here:
#   Short : Only the commands are shown, no descriptions.
#   Medium: Some important commands have descriptions, the rest don't.
#   Long  : Every command has a description.
# If this is not set, it will default to Medium.

HelpIndex Medium

# How often should we write the databases to disk? If you are on a
# large network, it may be to your advantage to raise this slightly;
# but beware that the higher this is, the more data you risk losing in
# the event of an unplanned shutdown.
# This is required.

SyncTime 5m

# Do you want to log the DataBase Syncs? Normally you won't need this;
# it'll just cause excessive logging. If you think some of your DB entries
# might be causing crashes, turn this on to see if it crashes during an
# update.
# Comment to disable.

#LogUpdates

# If we terminate for any reason, should we try to reconnect to the server?
# If so, how long should we wait? A good value would be 30 seconds.
# Minimum value is 5s.
# Comment to disable.

WaitRestart 30s

# Does your IRCd have /*Serv commands, such as /NickServ? If this is on,
# Services will tell users to use these aliases, rather than /MSG. This
# also assumes that your IRCd has a complete set of /*Serv commands. A
# complete set consists of /RootServ, /NickServ, /ChanServ, & /MemoServ.
# Comment to disable.

#HaveServ

# Should we output various mundane information to a channel? If so, where?
# Comment to disable.

#SnoopChan #Snoop

# Should the pseudo clients join a channel? This could be the same as your
# Snoop channel, or something different. They'll join this channel and op
# themselves, nothing more.
# Comment to disable.

#JoinChan #Services

# Do you want Cygnus to use the fake hostname assigned by Unreal? If this
# is on, Cygnus will ignore a users real hostname and only use the fake one.
# This option has no effect on IRCds other than Unreal.
# Comment to disable.

UseFakeHost

# If you want to use any of the E-Mailing features of Services, such as
# MemoMail and SENDPASS, Define the path to sendmail or a compatible
# application here.
# Comment to disable.

#SendMailPath /usr/sbin/sendmail

# If you want Cygnus to communicate with OperStats, configure this line.
# Cygnus will send special messages to this server on certain events
# to communicate with OperStats. This doesn't work with any other services.
# Comment to disable.

#OperStatsServer operstats.$DOMAIN

# If you want Cygnus to share AutoKills with OperStats, enable this.
# Cygnus will inform OperStats when AKills are added and deleted, and
# will add and remove AKills from OperStats as well.
# Requires: OperStatsServer
# Comment to disable.

ShareAKills

# If you want Cygnus to share SRAs with OperStats, enable this.
# Cygnus will inform OperStats when SRAs auth and deauth, and will also
# give and take SRA access through OperStats as well. This would allow you
# to receive SRA access on Cygnus and OperStats by identifying for your
# nickname, if you wish.
# Requires: OperStatsServer
# Comment to disable.

ShareSRAs

# Security Setting: How much security should we use in user communication?
# This defines what messages services requires to be secure. Secure
# communication must be sent to the Services server, for example
# /msg NickServ@$INFONAME
# This can be set one of three ways:
#     All       - Total security. All communication must be secure.
#     Passwords - Only password commands require security, such as IDENTIFY.
#     None      - Users can MSG Services any way they want.
# Comment to disable.

SecuritySetting Passwords

# Delays: These allow you to specify how long a user must wait before
# doing certain commands again. There are three delays:
#     NickDelay : Delay before registering another nickname
#     ChanDelay : Delay before registering another channel
#     MemoDelay : Delay before sending another memo
# You can set these to 0s if you don't want to use them.
# Format:
# Delay NickDelay ChanDelay MemoDelay
# Comment to disable.

Delays 10m 10m 60s

# How many times can a user give us a bad password before we KILL them
# from the network?
# This is required for NickServ and ChanServ.

PassFails 5

# How long should we wait for a user to finish registration of a nickname
# or channel before we expire it? This has no effect unless you are using
# an E-Mail Auth register type. For example, if this was set to 1 day, users
# would have 1 day to authenticate to a temporarily registered nickname before
# it would expire.
# This is required for E-Mail authentication.

TempExpire 1d

# Do you want to enable web integration? This is an advanced feature, please
# read doc/web.doc for more information on setting up and using web integration.
# Comment to disable.

#WebIntegration

# For added security, Cygnus can crypt passwords written to the web database.
# In order to do this, you must define a salt value below. This must be two
# characters in length. If this is not set, passwords will be stored as plain
# text in web.db.
# Comment to disable.

#Salt AA

# How many non * and ? characters should we require for AutoKills? This helps
# to prevent against wildcard AKills that affect most of the network. It is
# recommended this be at LEAST 2. It should be no more than 5, or some
# perfectly valid AKills may not be settable. For example: A setting of 2
# would not allow an AKill on *@*.m?, but would allow an AKill on *@*.my.
# Needed by: RootServ

NonWildCards 5

# How long should the default AKill expire time be?
# Needed by: RootServ

AKillExpire 7d

# What reasons should we use for AKills if none is specified?
# Needed by: RootServ

DefaultAKillReason You are banned.

# Do you want RootServ to send a GlobOps when an AKill is placed?
# Comment to disable.

GlobalOnAKill

# What is the default number of allowed connections from a single host?
# If a connecting client would make the number of connections from that
# host exceed this, the new connection will be killed. For example, if
# this was 5, each user would be allowed 5 connections. If a 6th connected,
# it would be killed. If this is not set, there will be no clone detection.
#
# If you give a time, Cygnus will make AKills for cloning last for this time.
# If you don't give a time, Cygnus will use the default AKill expiry time.
#
# IMPORTANT: If you turn this on, make sure you set a Trigger or an
# Exception for any other services and hostnames that exceed this number!
# Otherwise Cygnus will kill those hosts upon linking. You've been warned.
#
# Format:
# MaxConnections Limit AKill-Time
# Comment to disable.

#MaxConnections 5 24h

# How many times should we allow a host to be killed for cloning before
# we AKill it? This is useful for clone attacks. If this is not set, RootServ
# will kill the offending clones continuously.
# Requires: MaxConnections
# Comment to disable.

#MaxCloneKills 5

# Define any Triggers you want here. This allows you to stop Cygnus from
# killing certain hosts when they first link, before you have a chance to
# add a Trigger through RootServ. Use one line per trigger. The format is:
# Trigger user@host limit
# Once Cygnus updates the DBs, these Triggers will be stored there.
# Triggers in the DBs override Triggers in the conf, so you will need to
# change the Trigger through RootServ to change the limit. (Do this by
# simply adding it with the TRIGGER command.)

#Trigger *@$DOMAIN 500

# Should we completely exempt certain hosts from clone detection? If so,
# define those hosts here. These hosts will be immune to all clone
# detection. Triggers set for excepted hosts will have no effect. Use one
# line per exception. The format is:
# Exception user@host

#Exception *@$DOMAIN

# How long must a nickname go unused before we expire it?
# This is required for NickServ.

NickExpire 30d

# How do you want users to register nicknames? This can be set several ways:
#  Normal      - REGISTER Pass - Standard registration
#  EMailAuth   - REGISTER E-Mail - Auth password E-Mailed to user
#  EMailNoAuth - REGISTER Pass E-Mail - E-Mail required, no auth
#  PassAuth    - REGISTER Pass E-Mail - Like above, with auth
#  Verify      - REGISTER Pass Pass - Require password twice
#  EMailVerify - REGISTER Pass Pass E-Mail - Like above, with E-Mail
#  AuthVerify  - REGISTER Pass Pass E-Mail - Like above, with auth
#
# Note that for E-Mail Auth, SET EMAIL will also E-Mail an AUTH password.
#
# This is required for NickServ.

NSRegisterType Normal

# How many nicknames should we allow to have the same E-Mail? This is useful
# for limiting how many nicknames someone can register. This will not allow
# people to register a new nickname or change their E-Mail if the E-Mail they
# want is already in use on too many other nicknames. Note that linked nicks
# are an exception to this. If you have this set to 1, and MaxLinks set to 5,
# each user could register up to 6 nicknames on one E-Mail.
# Comment to disable.

EMailLimit 1

# How many nicknames can a user link to a given nickname?
# Comment to disable nick linking.

MaxLinks 5

# Define the type of nick collisions you wish to use here. This tells
# Services what to do when a user doesn't identify for a nick. There are 5
# options:
#    Guest      - NickName -> Guest12345
#    User       - NickName -> User12345
#    Nick       - NickName -> NickName12345
#    Underscore - NickName -> NickName_
#    Hyphen     - NickName -> NickName-
#    Kill       - Kill from network
# If this is not defined, it defaults to Guest.

CollideType Guest

# If you would like the RECOVER command to kill users from the network,
# define this. Otherwise, they will be dealt with in the manner defined
# above in CollideType.
# Comment to disable.

#RecoverKill

# If you want NickServ to give a URL to users when they register a nickname,
# define that URL here. Ideally this would contain information about nickname
# flags, settings, etc. An example can be found at the URL below and in the
# dist/ directory.
# Comment to disable.

#NSRegisterURL http://www.habber.net/services/nickreg.html

# If you want NickServ to give a URL to users when they get collided,
# define that URL here. Ideally this would contain information about why
# they got collided and how they can avoid being collided in the future.
# An example can be found at the URL below and in the dist/ directory.
# Comment to disable.

#CollisionURL http://www.habber.net/services/collision.html

# Define the default nickname flags you want newly registered nicks to
# have. You can pick any of the ones listed below, seperated by a space.
# Flags:
#     Enforce        - Nickname enforcement
#     Secure         - Nickname security
#     MailVisibility - Either HideMail or ShowMail, whichever you use
#     NeverOp        - ChanServ won't automatically +o/h/v on join
#     NoOp           - Unable to be added to ChanServ lists
#     NoSuccessor    - Cannot be named channel Successor
#     Private        - Some information hidden in INFO
#     NoMemo         - Doesn't receive memos
#     Receipts       - Gets memo receipts
#     MemoMail       - Gets memomail (This only works if MemoMail is on.)
# For example, if you wanted Enforce, NoOp and Receipts on, you'd have:
# NickFlags Enforce NoOp Receipts
# Comment to disable.

NickFlags Enforce

# Do you want Services to PRIVMSG all users by default? Users can have
# Services NOTICE them via an option in NickServ. If this is off, Services
# will NOTICE all users, and they can have Services PRIVMSG them via an
# option in NickServ.
# Comment to disable.

#UsePRIVMSG

# Do you want Services to hide all E-Mail addresses by default, and give
# users the option to show their E-Mail address? If this is off, all E-Mail
# addresses are visible, and users can hide them if they want to.
# Comment to disable.

#UseShowMail

# Do you want users to be able to store their E-Mail in NickServ? This
# is required if you want to use things like SENDPASS and MemoMail.
# Comment to disable.

UseEMail

# Do you want users to be able to store a URL in NickServ?
# Comment to disable.

UseURL

# Do you want users to be able to store ICQ UINs in NickServ?
# According to ICQ, a valid UIN is a number in the range of
# 1001 to 2147483646. NickServ requires UINs to be in this range.
# Comment to disable.

#UseUIN

# Do you want users to be able to store their Name in NickServ?
# Note: There are no syntax limits on Names, only a length limit
# of 100 characters. You should keep in mind that users could put
# anything they want in this field.
# Comment to disable.

#UseName

# Do you want users to be able to store their Age in NickServ?
# Ages must be a number between 5 and 100.
# Comment to disable.

#UseAge

# Do you want users to be able to store their Sex in NickServ?
# Sex can be either Male or Female, nothing else.
# Comment to disable.

#UseSex

# Do you want users to be able to store their Location in NickServ?
# Note: There are no syntax limits on Locations, only a length limit
# of 100 characters. You should keep in mind that users could put
# anything they want in this field.
# Comment to disable.

#UseLocation

# How long must a channel go unused before we expire it?
# This is required for ChanServ.

ChanExpire 30d

# How do you want users to register channels? This can be set several ways:
#  Normal      - REGISTER #Channel Pass - Standard registration
#  EMailAuth   - REGISTER #Channel - Auth password E-Mailed to founder
#  Verify      - REGISTER #Channel Pass Pass - Require password twice
#  AuthVerify  - REGISTER #Channel Pass Pass - Like above, with auth
#  CSOpVerify  - REGISTER #Channel Pass - Require CSOp to verify channel
#
# Note that for E-Mail Auth types, you must have a NickServ E-Mail auth
# registration type set above.
#
# This is required for ChanServ.

CSRegisterType Normal

# How many channels should we allow per user? This allows you to limit the
# number of channels each user can have.
# Comment to disable.

ChannelLimit 5

# If you want ChanServ to give a URL to users when they register a channel,
# define that URL here. Ideally this would contain information about owning
# a channel, such as channel flags, settings, etc. An example can be found
# at the URL below and in the dist/ directory.
# Comment to disable.

#CSRegisterURL http://www.habber.net/services/chanreg.html

# Define the default channel flags you want newly registered channels to
# have. You can pick any of the ones listed below, seperated by a space.
# Flags:
#     Verbose        - Extra information sent to channel ops
#     VOPAll         - Everyone gets voiced on join
#     Secure         - ChanServ will -o/h/v people not on access list
#     Restricted     - Anyone not on access list will be kicked and banned
# For example, if you wanted Verbose, VOPAll and Restricted on, you'd have:
# ChanFlags Verbose VOPAll Restricted
# Comment to disable.

ChanFlags Secure

# If you want ChanServ to set a default topic when a channel is registered,
# define that topic here. Be aware that most IRCds have a limit of 307
# characters for topics. This will only be set if the channel does not already
# have a topic.
# Comment to disable.

DefaultTopic This channel has been successfully registered.

# If you want ChanServ to set a default modelock when a channel is registered,
# define that modelock here. Services does no error checking on this, so be
# careful when setting it. Channel mode +r is always set for registered channels.
# The format is DefaultModes ModesToLockOn ModesToLockOff. You cannot lock
# parameter modes (such as +l, +k) on here. Do not give + or - in modes.
# Comment to disable.

DefaultModes tn smlipk

# What should the default AKick reason be if no reason is given for an AKick?
# This is required for ChanServ.

DefaultAKickReason User has been banned from channel

# How many AKicks should we allow per channel? A good value here would be 50.
# This would allow users a fairly large number of AKicks, but also keep the
# list somewhat small do it doesn't fill up the DBs needlessly. This value
# defaults to 50 if not set.
# This is required for ChanServ.

AKickMax 50

# If you don't want ChanServ to guard voice access when SECURE is on, turn
# this option off. If this is off, ChanServ will leave voiced users alone
# regardless of the channels SECURE flag. If it's on, ChanServ will treat
# voiced users like opped users and devoice them if they don't have VOP
# access.
# Comment to disable.

SecureVOP

# How many memos do you want each user to be able to have? Every user
# can change this value for their nickname, as long as it's not greater
# than the value you give below. They will not be able to have more than
# this amount of memos.
# This is required for MemoServ.

MemoBoxSize 25

# Do you want users to be able to turn on the MemoMail option?
# This is open to some abuse. MemoServ will only allow a certain number
# of memos to be sent by E-Mail. You can change this number in the
# MemoMailMax setting below.
# Comment to disable.

#UseMemoMail

# How many memos should we allow users to recieve by E-Mail? If this was
# set to 10, for example, a MemoServ would only E-Mail 10 memos to the
# user, and the rest would be stored normally, as Unread memos.
# This is required for MemoMail.

#MemoMailMax 10

# How many memos should we allow a user to send to another user? This is
# useful for preventing one user from completely fill another users MemoBox.
# Comment to disable.

MemosFromUser 5

# That's it. Most options in this file can be updated through the REHASH
# function and don't require a restart. If your changes don't get done
# with REHASH, you will need to use RESTART to have them take effect.
_EOT_
echo "done."

# Move the conf to the data directory if it exists.
if [ -d $DEST ] ; then
    echo2 'Moving conf... '
    mv cygnus.conf $DEST
    echo 'done.'
    echo ' '
    echo '*** Now configure your server(s), and run Cygnus.'
    echo '*** Please read the documentation before seeking help. Thanks.'
    echo ' '
else
    echo ' '
    echo '*** Now move the conf to the directory you installed'
    echo '*** Cygnus in, configure your server(s), and run Cygnus.'
    echo '*** Please read the documentation before seeking help. Thanks.'
    echo ' '
fi

# Now cache it all for a next run
cat <<EOT >../makeconf.cache
INFONAME=$INFONAME
CONNECTIP=$CONNECTIP
CONNECTPASS=$CONNECTPASS
CONNECTUPLINK=$CONNECTUPLINK
CONNECTPORT=$CONNECTPORT
UNREALNUMERIC=$UNREALNUMERIC
SRANICK=$SRANICK
SRAPASS=$SRAPASS
DOMAIN=$DOMAIN
EOT
exit 0
