Fix bug #152 - disable self-registering

This commit is contained in:
Jan Vidar Krey
2011-08-16 15:09:02 +02:00
parent 472c489ae1
commit 998f5a57e2
4 changed files with 37 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ void config_defaults(struct hub_config* config)
config->show_banner_sys_info = 1;
config->max_users = 500;
config->registered_users_only = 0;
config->register_self = 0;
config->obsolete_clients = 0;
config->chat_only = 0;
config->chat_is_privileged = 0;
@@ -184,6 +185,16 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
return 0;
}
if (!strcmp(key, "register_self"))
{
if (!apply_boolean(key, data, &config->register_self))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
}
return 0;
}
if (!strcmp(key, "obsolete_clients"))
{
if (!apply_boolean(key, data, &config->obsolete_clients))
@@ -502,7 +513,6 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
if (!apply_string(key, data, &config->tls_require_redirect_addr, (char*) ""))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
LOG_ERROR("\"tls_require_redirect_addr\" (string), default=\"\"");
return -1;
}
return 0;
@@ -1062,6 +1072,9 @@ void dump_config(struct hub_config* config, int ignore_defaults)
if (!ignore_defaults || config->registered_users_only != 0)
fprintf(stdout, "registered_users_only = %s\n", config->registered_users_only ? "yes" : "no");
if (!ignore_defaults || config->register_self != 0)
fprintf(stdout, "register_self = %s\n", config->register_self ? "yes" : "no");
if (!ignore_defaults || config->obsolete_clients != 0)
fprintf(stdout, "obsolete_clients = %s\n", config->obsolete_clients ? "yes" : "no");