This commit is contained in:
Андрей Владимирович 2016-02-20 21:21:56 +03:00
parent cfa91cea96
commit 8d511b4f5f
2 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,8 @@
from settings import Settings
import os
from tox import Tox
from toxcore_enums_and_consts import *
from ctypes import *
class Profile(object):
@ -38,3 +41,17 @@ class Profile(object):
fl.write(data)
print 'Data saved to: {}'.format(Profile._path)
def tox_factory(data, settings):
tox_options = Tox.options_new()
tox_options.contents.udp_enabled = settings['udp_enabled']
tox_options.contents.proxy_type = settings['proxy_type']
tox_options.contents.proxy_host = settings['proxy_host']
tox_options.contents.proxy_port = settings['proxy_port']
tox_options.contents.start_port = settings['start_port']
tox_options.contents.end_port = settings['end_port']
tox_options.contents.tcp_port = settings['tcp_port']
tox_options.contents.savedata_type = TOX_SAVEDATA_TYPE['TOX_SAVEDATA_TYPE_TOX_SAVE']
tox_options.contents.savedata_data = c_char_p(data)
tox_options.contents.savedata_length = len(data)
return Tox(tox_options)

View File

@ -1004,21 +1004,6 @@ class Tox(object):
Tox.libtoxcore.tox_kill(self._tox_pointer)
def tox_factory(data, settings):
tox_options = Tox.options_new()
tox_options.contents.udp_enabled = settings['udp_enabled']
tox_options.contents.proxy_type = settings['proxy_type']
tox_options.contents.proxy_host = settings['proxy_host']
tox_options.contents.proxy_port = settings['proxy_port']
tox_options.contents.start_port = settings['start_port']
tox_options.contents.end_port = settings['end_port']
tox_options.contents.tcp_port = settings['tcp_port']
tox_options.contents.savedata_type = TOX_SAVEDATA_TYPE['TOX_SAVEDATA_TYPE_TOX_SAVE']
tox_options.contents.savedata_data = c_char_p(data)
tox_options.contents.savedata_length = len(data)
return Tox(tox_options)
if __name__ == '__main__':
options = Tox.options_new()