Added file_plugins directive to configuration file.

This commit is contained in:
Jan Vidar Krey 2010-06-06 16:32:43 +02:00
parent 07d4e4470c
commit baeba01835
3 changed files with 30 additions and 0 deletions

View File

@ -490,6 +490,19 @@
]]></example>
</option>
<option name="file_plugins" type="file" default="">
<short>Plugin configuration file</short>
<description><![CDATA[
Plugin configuration file.
]]></description>
<since>0.3.3</since>
<example><![CDATA[
<p>
file_plugins = "/etc/uhub/plugins.conf"
</p>
]]></example>
</option>
<option name="msg_hub_full" type="message" default="Hub is full" >
<description><![CDATA[This will be sent if the hub is full]]></description>
<since>0.2.0</since>

View File

@ -47,6 +47,7 @@ void config_defaults(struct hub_config* config)
config->file_motd = hub_strdup("");
config->file_acl = hub_strdup("");
config->file_rules = hub_strdup("");
config->file_plugins = hub_strdup("");
config->msg_hub_full = hub_strdup("Hub is full");
config->msg_hub_disabled = hub_strdup("Hub is disabled");
config->msg_hub_registered_users_only = hub_strdup("Hub is for registered users only");
@ -545,6 +546,16 @@ static int apply_config(struct hub_config* config, char* key, char* data, int li
return 0;
}
if (!strcmp(key, "file_plugins"))
{
if (!apply_string(key, data, &config->file_plugins, (char*) ""))
{
LOG_ERROR("Configuration parse error on line %d", line_count);
return -1;
}
return 0;
}
if (!strcmp(key, "msg_hub_full"))
{
if (!apply_string(key, data, &config->msg_hub_full, (char*) ""))
@ -932,6 +943,8 @@ void free_config(struct hub_config* config)
hub_free(config->file_rules);
hub_free(config->file_plugins);
hub_free(config->msg_hub_full);
hub_free(config->msg_hub_disabled);
@ -1143,6 +1156,9 @@ void dump_config(struct hub_config* config, int ignore_defaults)
if (!ignore_defaults || strcmp(config->file_rules, "") != 0)
fprintf(stdout, "file_rules = \"%s\"\n", config->file_rules);
if (!ignore_defaults || strcmp(config->file_plugins, "") != 0)
fprintf(stdout, "file_plugins = \"%s\"\n", config->file_plugins);
if (!ignore_defaults || strcmp(config->msg_hub_full, "Hub is full") != 0)
fprintf(stdout, "msg_hub_full = \"%s\"\n", config->msg_hub_full);

View File

@ -47,6 +47,7 @@ struct hub_config
char* file_motd; /*<<< File containing the 'message of the day (default: ) */
char* file_acl; /*<<< File containing access control lists (default: ) */
char* file_rules; /*<<< File containing hub rules (default: ) */
char* file_plugins; /*<<< Plugin configuration file (default: ) */
char* msg_hub_full; /*<<< "Hub is full" */
char* msg_hub_disabled; /*<<< "Hub is disabled" */
char* msg_hub_registered_users_only; /*<<< "Hub is for registered users only" */