From 8d511b4f5fc0cd8edaf675397cff6a4fe512b881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=92=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Sat, 20 Feb 2016 21:21:56 +0300 Subject: [PATCH] tx fctr --- src/profile.py | 17 +++++++++++++++++ src/tox.py | 15 --------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/profile.py b/src/profile.py index 1e52f60..95ee3bd 100644 --- a/src/profile.py +++ b/src/profile.py @@ -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) diff --git a/src/tox.py b/src/tox.py index 4ade7a1..62bb7aa 100644 --- a/src/tox.py +++ b/src/tox.py @@ -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()