summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_account.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-17 08:49:56 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-17 08:49:56 +0000
commitd73ec8491056f109d8470b973e9f514a26644010 (patch)
tree258b99b57c137c507da04665e442b445acaf6009 /protocols/Tox/src/tox_account.cpp
parent1c894ee5f3448792123b550e0620fe3bafc1635e (diff)
Tox:
- updated tox lib - ability to disable udp - ability to disable ipv6 - socks proxy support git-svn-id: http://svn.miranda-ng.org/main/trunk@10212 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_account.cpp')
-rw-r--r--protocols/Tox/src/tox_account.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp
index 77a8095dd2..a517673398 100644
--- a/protocols/Tox/src/tox_account.cpp
+++ b/protocols/Tox/src/tox_account.cpp
@@ -6,6 +6,54 @@ bool CToxProto::IsOnline()
return isConnected && m_iStatus > ID_STATUS_OFFLINE;
}
+void CToxProto::InitToxCore()
+{
+ Tox_Options options = { 0 };
+ options.udp_disabled = getByte("DisableUDP", 0);
+ options.ipv6enabled = !getByte("DisableIPv6", 0);
+
+ if (hNetlibUser)
+ {
+ NETLIBUSERSETTINGS nlus = { sizeof(NETLIBUSERSETTINGS) };
+ CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)hNetlibUser, (LPARAM)&nlus);
+
+ if (nlus.useProxy)
+ {
+ if (nlus.proxyType == PROXYTYPE_SOCKS4 || nlus.proxyType == PROXYTYPE_SOCKS5)
+ {
+ debugLogA("Setting socks user proxy config");
+ options.proxy_enabled = 1;
+ strcpy(&options.proxy_address[0], nlus.szProxyServer);
+ options.proxy_port = nlus.wProxyPort;
+ }
+ }
+ }
+
+ tox = tox_new(&options);
+ tox_callback_friend_request(tox, OnFriendRequest, this);
+ tox_callback_friend_message(tox, OnFriendMessage, this);
+ tox_callback_friend_action(tox, OnAction, this);
+ tox_callback_name_change(tox, OnFriendNameChange, this);
+ tox_callback_status_message(tox, OnStatusMessageChanged, this);
+ tox_callback_user_status(tox, OnUserStatusChanged, this);
+ tox_callback_read_receipt(tox, OnReadReceipt, this);
+ tox_callback_connection_status(tox, OnConnectionStatusChanged, this);
+
+ LoadToxData();
+
+ std::vector<uint8_t> username(TOX_MAX_NAME_LENGTH);
+ tox_get_self_name(tox, &username[0]);
+ std::string nick(username.begin(), username.end());
+ setString("Nick", nick.c_str());
+}
+
+void CToxProto::UninitToxCore()
+{
+ SaveToxData();
+
+ tox_kill(tox);
+}
+
void CToxProto::DoBootstrap()
{
static int j = 0;
@@ -13,7 +61,7 @@ void CToxProto::DoBootstrap()
while (i < 2)
{
struct bootstrap_node *d = &bootstrap_nodes[j % SIZEOF(bootstrap_nodes)];
- tox_bootstrap_from_address(tox, d->address, TOX_ENABLE_IPV6_DEFAULT, d->port, d->key);
+ tox_bootstrap_from_address(tox, d->address, d->port, d->key);
i++; j++;
}
}