Adding support for redirecting clients to other hubs when they fail to login

for various reasons.

Config variable is "redirect_addr".
This commit is contained in:
Jan Vidar Krey
2010-04-22 21:07:46 +02:00
parent b29f34af4a
commit c70119870a
4 changed files with 67 additions and 33 deletions

View File

@@ -16,6 +16,7 @@ void config_defaults(struct hub_config* config)
config->chat_is_privileged = 0;
config->hub_name = hub_strdup("uhub");
config->hub_description = hub_strdup("no description");
config->redirect_addr = hub_strdup("");
config->max_recv_buffer = 4096;
config->max_send_buffer = 131072;
config->max_send_buffer_soft = 98304;
@@ -231,6 +232,16 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
return 0;
}
if (!strcmp(key, "redirect_addr"))
{
if (!apply_string(key, data, &config->redirect_addr, (char*) ""))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
}
return 0;
}
if (!strcmp(key, "max_recv_buffer"))
{
if (!apply_integer(key, data, &config->max_recv_buffer, 0, 0))
@@ -909,6 +920,8 @@ void free_config(struct hub_config* config)
hub_free(config->hub_description);
hub_free(config->redirect_addr);
hub_free(config->tls_certificate);
hub_free(config->tls_private_key);
@@ -1037,6 +1050,9 @@ void dump_config(struct hub_config* config, int ignore_defaults)
if (!ignore_defaults || strcmp(config->hub_description, "no description") != 0)
fprintf(stdout, "hub_description = \"%s\"\n", config->hub_description);
if (!ignore_defaults || strcmp(config->redirect_addr, "") != 0)
fprintf(stdout, "redirect_addr = \"%s\"\n", config->redirect_addr);
if (!ignore_defaults || config->max_recv_buffer != 4096)
fprintf(stdout, "max_recv_buffer = %d\n", config->max_recv_buffer);