summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-11-23 09:30:26 +0100
committerSébastien Helleu <flashcode@flashtux.org>2014-11-23 09:30:26 +0100
commit570beab90afe7ae0715162d39ba50cabf6ac0aa2 (patch)
tree1f235ae34b9918197ed1add7dee58f7afbfc7abb /src/plugins
parent4dd5125054c47628fad4bfb38217e4a765f5a195 (diff)
downloadweechat-570beab90afe7ae0715162d39ba50cabf6ac0aa2.zip
irc: merge arrays with server options names and default values into a single array
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-config.c12
-rw-r--r--src/plugins/irc/irc-server.c81
-rw-r--r--src/plugins/irc/irc-server.h3
3 files changed, 51 insertions, 45 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index ce92f271a..1d9eb392a 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -1517,7 +1517,7 @@ irc_config_server_write_default_cb (void *data,
{
snprintf (option_name, sizeof (option_name),
"freenode.%s",
- irc_server_option_string[i]);
+ irc_server_options[i][0]);
switch (i)
{
case IRC_SERVER_OPTION_ADDRESSES:
@@ -2243,20 +2243,20 @@ irc_config_server_create_default_options (struct t_config_section *section)
break;
}
if (!default_value)
- default_value = irc_server_option_default[i];
+ default_value = irc_server_options[i][1];
irc_config_server_default[i] = irc_config_server_new_option (
irc_config_file,
section,
i,
- irc_server_option_string[i],
- irc_server_option_default[i],
+ irc_server_options[i][0],
+ irc_server_options[i][1],
default_value,
0,
&irc_config_server_check_value_cb,
- irc_server_option_string[i],
+ irc_server_options[i][0],
&irc_config_server_default_change_cb,
- irc_server_option_string[i]);
+ irc_server_options[i][0]);
}
if (nicks)
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 1bc67feb9..d154c0090 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -71,36 +71,44 @@ struct t_irc_server *last_irc_server = NULL;
struct t_irc_message *irc_recv_msgq = NULL;
struct t_irc_message *irc_msgq_last_msg = NULL;
-char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] =
-{ "addresses", "proxy", "ipv6",
- "ssl", "ssl_cert", "ssl_priorities", "ssl_dhkey_size", "ssl_fingerprint",
- "ssl_verify",
- "password", "capabilities",
- "sasl_mechanism", "sasl_username", "sasl_password", "sasl_timeout", "sasl_disconnect_on_fail",
- "autoconnect", "autoreconnect", "autoreconnect_delay",
- "nicks", "username", "realname", "local_hostname",
- "command", "command_delay", "autojoin", "autorejoin", "autorejoin_delay",
- "connection_timeout",
- "anti_flood_prio_high", "anti_flood_prio_low",
- "away_check", "away_check_max_nicks",
- "default_msg_kick", "default_msg_part", "default_msg_quit",
- "notify",
-};
-
-char *irc_server_option_default[IRC_SERVER_NUM_OPTIONS] =
-{ "", "", "on",
- "off", "", "NORMAL:-VERS-SSL3.0", "2048", "",
- "on",
- "", "",
- "plain", "", "", "15", "off",
- "off", "on", "10",
- "", "", "", "",
- "", "0", "", "off", "30",
- "60",
- "2", "2",
- "0", "25",
- "","WeeChat %v", "WeeChat %v",
- "",
+char *irc_server_options[IRC_SERVER_NUM_OPTIONS][2] =
+{ { "addresses", "" },
+ { "proxy", "" },
+ { "ipv6", "on" },
+ { "ssl", "off" },
+ { "ssl_cert", "" },
+ { "ssl_priorities", "NORMAL:-VERS-SSL3.0" },
+ { "ssl_dhkey_size", "2048" },
+ { "ssl_fingerprint", "" },
+ { "ssl_verify", "on" },
+ { "password", "" },
+ { "capabilities", "" },
+ { "sasl_mechanism", "plain" },
+ { "sasl_username", "" },
+ { "sasl_password", "" },
+ { "sasl_timeout", "15" },
+ { "sasl_disconnect_on_fail", "off" },
+ { "autoconnect", "off" },
+ { "autoreconnect", "on" },
+ { "autoreconnect_delay", "10" },
+ { "nicks", "" },
+ { "username", "" },
+ { "realname", "" },
+ { "local_hostname", "" },
+ { "command", "" },
+ { "command_delay", "0" },
+ { "autojoin", "" },
+ { "autorejoin", "off" },
+ { "autorejoin_delay", "30" },
+ { "connection_timeout", "60" },
+ { "anti_flood_prio_high", "2" },
+ { "anti_flood_prio_low", "2" },
+ { "away_check", "0" },
+ { "away_check_max_nicks", "25" },
+ { "default_msg_kick", "" },
+ { "default_msg_part", "WeeChat %v" },
+ { "default_msg_quit", "WeeChat %v" },
+ { "notify", "" },
};
char *irc_server_casemapping_string[IRC_SERVER_NUM_CASEMAPPING] =
@@ -211,8 +219,7 @@ irc_server_search_option (const char *option_name)
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
- if (weechat_strcasecmp (irc_server_option_string[i],
- option_name) == 0)
+ if (weechat_strcasecmp (irc_server_options[i][0], option_name) == 0)
return i;
}
@@ -1035,13 +1042,13 @@ irc_server_alloc (const char *name)
for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++)
{
length = strlen (new_server->name) + 1 +
- strlen (irc_server_option_string[i]) + 1;
+ strlen (irc_server_options[i][0]) + 1;
option_name = malloc (length);
if (option_name)
{
snprintf (option_name, length, "%s.%s",
new_server->name,
- irc_server_option_string[i]);
+ irc_server_options[i][0]);
new_server->options[i] =
irc_config_server_new_option (irc_config_file,
irc_config_section_server,
@@ -1051,10 +1058,10 @@ irc_server_alloc (const char *name)
NULL,
1,
&irc_config_server_check_value_cb,
- irc_server_option_string[i],
+ irc_server_options[i][0],
&irc_config_server_change_cb,
- irc_server_option_string[i]);
- irc_config_server_change_cb (irc_server_option_string[i],
+ irc_server_options[i][0]);
+ irc_config_server_change_cb (irc_server_options[i][0],
new_server->options[i]);
free (option_name);
}
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index 1f1bbaaa0..910e7b766 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -236,8 +236,7 @@ extern const int gnutls_cert_type_prio[];
extern const int gnutls_prot_prio[];
#endif
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
-extern char *irc_server_option_string[];
-extern char *irc_server_option_default[];
+extern char *irc_server_options[][2];
extern int irc_server_valid (struct t_irc_server *server);
extern struct t_irc_server *irc_server_search (const char *server_name);