+GLOBAL int
+Conf_GetServer( CONN_ID Idx )
+{
+ /* Get index of server in configuration structure */
+
+ int i = 0;
+
+ assert( Idx > NONE );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( Conf_Server[i].conn_id == Idx ) return i;
+ }
+ return NONE;
+} /* Conf_GetServer */
+
+
+GLOBAL bool
+Conf_EnableServer( const char *Name, UINT16 Port )
+{
+ /* Enable specified server and adjust port */
+
+ int i;
+
+ assert( Name != NULL );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
+ /* Gotcha! Set port and enable server: */
+ Conf_Server[i].port = Port;
+ Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
+ return (Conf_Server[i].port && Conf_Server[i].host[0]);
+ }
+ }
+ return false;
+} /* Conf_EnableServer */
+
+
+GLOBAL bool
+Conf_EnablePassiveServer(const char *Name)
+{
+ /* Enable specified server */
+ int i;
+
+ assert( Name != NULL );
+ for (i = 0; i < MAX_SERVERS; i++) {
+ if ((strcasecmp( Conf_Server[i].name, Name ) == 0) && (Conf_Server[i].port > 0)) {
+ /* BINGO! Enable server */
+ Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED;
+ return true;
+ }
+ }
+ return false;
+} /* Conf_EnablePassiveServer */
+
+
+GLOBAL bool
+Conf_DisableServer( const char *Name )
+{
+ /* Enable specified server and adjust port */
+
+ int i;
+
+ assert( Name != NULL );
+
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ if( strcasecmp( Conf_Server[i].name, Name ) == 0 ) {
+ /* Gotcha! Disable and disconnect server: */
+ Conf_Server[i].flags |= CONF_SFLAG_DISABLED;
+ if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", true);
+ return true;
+ }
+ }
+ return false;
+} /* Conf_DisableServer */
+
+
+GLOBAL bool
+Conf_AddServer( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd )
+{
+ /* Add new server to configuration */
+
+ int i;
+
+ assert( Name != NULL );
+ assert( Host != NULL );
+ assert( MyPwd != NULL );
+ assert( PeerPwd != NULL );
+
+ /* Search unused item in server configuration structure */
+ for( i = 0; i < MAX_SERVERS; i++ ) {
+ /* Is this item used? */
+ if( ! Conf_Server[i].name[0] ) break;
+ }
+ if( i >= MAX_SERVERS ) return false;
+
+ Init_Server_Struct( &Conf_Server[i] );
+ strlcpy( Conf_Server[i].name, Name, sizeof( Conf_Server[i].name ));
+ strlcpy( Conf_Server[i].host, Host, sizeof( Conf_Server[i].host ));
+ strlcpy( Conf_Server[i].pwd_out, MyPwd, sizeof( Conf_Server[i].pwd_out ));
+ strlcpy( Conf_Server[i].pwd_in, PeerPwd, sizeof( Conf_Server[i].pwd_in ));
+ Conf_Server[i].port = Port;
+ Conf_Server[i].flags = CONF_SFLAG_ONCE;
+
+ return true;
+} /* Conf_AddServer */
+
+
+/**
+ * Check if the given nick name is an service
+ */
+GLOBAL bool
+Conf_IsService(int ConfServer, const char *Nick)
+{
+ return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
+} /* Conf_IsService */
+
+
+static void
+Set_Defaults_Optional(void)
+{
+#ifdef IDENTAUTH
+ Conf_Ident = true;
+#else
+ Conf_Ident = false;
+#endif
+#ifdef PAM
+ Conf_PAM = true;
+#else
+ Conf_PAM = false;
+#endif
+}
+
+
+/**
+ * Initialize configuration settings with their default values.
+ */
+static void
+Set_Defaults(bool InitServers)
+{
+ int i;
+
+ strcpy(Conf_ServerName, "");
+ strcpy(Conf_ClientHost, "");
+ snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s",
+ PACKAGE_NAME, PACKAGE_VERSION);
+ strcpy(Conf_ServerPwd, "");
+
+ strcpy(Conf_ServerAdmin1, "");
+ strcpy(Conf_ServerAdmin2, "");
+ strcpy(Conf_ServerAdminMail, "");
+
+ strlcpy(Conf_MotdFile, SYSCONFDIR, sizeof(Conf_MotdFile));
+ strlcat(Conf_MotdFile, MOTD_FILE, sizeof(Conf_MotdFile));