Update Tox_Options use to match new API.

This commit is contained in:
Håvard Pettersson 2015-04-09 20:39:28 +02:00
parent f24e15f32a
commit d01c85257e

View File

@ -217,39 +217,40 @@ twc_profile_load(struct t_twc_profile *profile)
profile->name); profile->name);
// create Tox options object // create Tox options object
Tox_Options options; struct Tox_Options options;
tox_options_default(&options);
char *proxy_type; char *proxy_type;
switch (TWC_PROFILE_OPTION_INTEGER(profile, TWC_PROFILE_OPTION_PROXY_TYPE)) switch (TWC_PROFILE_OPTION_INTEGER(profile, TWC_PROFILE_OPTION_PROXY_TYPE))
{ {
case TWC_PROXY_NONE: case TWC_PROXY_NONE:
options.proxy_type = TOX_PROXY_NONE; options.proxy_type = TOX_PROXY_TYPE_NONE;
break; break;
case TWC_PROXY_SOCKS5: case TWC_PROXY_SOCKS5:
options.proxy_type = TOX_PROXY_SOCKS5; options.proxy_type = TOX_PROXY_TYPE_SOCKS5;
proxy_type = "SOCKS5"; proxy_type = "SOCKS5";
break; break;
case TWC_PROXY_HTTP: case TWC_PROXY_HTTP:
options.proxy_type = TOX_PROXY_HTTP; options.proxy_type = TOX_PROXY_TYPE_HTTP;
proxy_type = "HTTP"; proxy_type = "HTTP";
break; break;
} }
const char *proxy_address = const char *proxy_host =
TWC_PROFILE_OPTION_STRING(profile, TWC_PROFILE_OPTION_PROXY_ADDRESS); TWC_PROFILE_OPTION_STRING(profile, TWC_PROFILE_OPTION_PROXY_ADDRESS);
if (proxy_address) if (proxy_host)
memcpy(options.proxy_address, proxy_address, strlen(proxy_address) + 1); options.proxy_host = proxy_host;
options.proxy_port = options.proxy_port =
TWC_PROFILE_OPTION_INTEGER(profile, TWC_PROFILE_OPTION_PROXY_PORT); TWC_PROFILE_OPTION_INTEGER(profile, TWC_PROFILE_OPTION_PROXY_PORT);
options.udp_disabled = options.udp_enabled =
!TWC_PROFILE_OPTION_BOOLEAN(profile, TWC_PROFILE_OPTION_UDP); TWC_PROFILE_OPTION_BOOLEAN(profile, TWC_PROFILE_OPTION_UDP);
options.ipv6enabled = options.ipv6_enabled =
TWC_PROFILE_OPTION_BOOLEAN(profile, TWC_PROFILE_OPTION_IPV6); TWC_PROFILE_OPTION_BOOLEAN(profile, TWC_PROFILE_OPTION_IPV6);
if (options.proxy_type != TOX_PROXY_NONE) if (options.proxy_type != TOX_PROXY_TYPE_NONE)
{ {
if (!options.proxy_address || !options.proxy_port) if (!options.proxy_host || !options.proxy_port)
{ {
weechat_printf(profile->buffer, weechat_printf(profile->buffer,
"%sproxy is enabled, but proxy information is " "%sproxy is enabled, but proxy information is "
@ -263,7 +264,7 @@ twc_profile_load(struct t_twc_profile *profile)
"%susing %s proxy %s:%d", "%susing %s proxy %s:%d",
weechat_prefix("network"), weechat_prefix("network"),
proxy_type, proxy_type,
options.proxy_address, options.proxy_port); options.proxy_host, options.proxy_port);
} }
} }