callbacks update, bug fixes
This commit is contained in:
parent
e0dd55d395
commit
18e027ffd9
4 changed files with 17 additions and 12 deletions
|
@ -1,14 +1,20 @@
|
||||||
# TODO: add all callbacks (use wrappers)
|
# TODO: add all callbacks (replace test callbacks and use wrappers)
|
||||||
|
|
||||||
|
|
||||||
def status(a, b, c):
|
def self_connection_status(a, b, c):
|
||||||
print 'WOW, it works!'
|
print 'WOW, it works!'
|
||||||
print str(b)
|
print 'Status: ', str(b)
|
||||||
|
|
||||||
|
|
||||||
def friend_status(a, b, c, d, e):
|
def friend_status(a, b, c, d):
|
||||||
print 'Friend connected! Friend number: ' + str(c)
|
print "Friend connected! Friend's data: ", str(a), str(b), str(c)
|
||||||
|
|
||||||
|
|
||||||
def message(a, b, c, d, e, f):
|
def friend_message(a, b, c, d, e, f):
|
||||||
print 'Message: ', str(d)
|
print 'Message: ', unicode(d, "utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def init_callbacks(tox):
|
||||||
|
tox.callback_friend_status(friend_status, 0)
|
||||||
|
tox.callback_friend_message(friend_message, 0)
|
||||||
|
tox.callback_self_connection_status(self_connection_status, 0)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from mainscreen import MainWindow
|
||||||
from profile import Profile, tox_factory
|
from profile import Profile, tox_factory
|
||||||
import sys
|
import sys
|
||||||
from PySide import QtCore, QtGui
|
from PySide import QtCore, QtGui
|
||||||
from callbacks import *
|
from callbacks import init_callbacks
|
||||||
from tox import Tox
|
from tox import Tox
|
||||||
from bootstrap import node_generator
|
from bootstrap import node_generator
|
||||||
|
|
||||||
|
@ -73,9 +73,7 @@ def main():
|
||||||
# bootstrap
|
# bootstrap
|
||||||
for data in node_generator():
|
for data in node_generator():
|
||||||
tox.bootstrap(*data)
|
tox.bootstrap(*data)
|
||||||
# TODO: set all callbacks and init it with ms
|
init_callbacks(tox)
|
||||||
tox.callback_friend_message(message, 0)
|
|
||||||
tox.callback_self_connection_status(status, 0)
|
|
||||||
# starting thread for tox iterate
|
# starting thread for tox iterate
|
||||||
mainloop = ToxIterateThread(tox)
|
mainloop = ToxIterateThread(tox)
|
||||||
mainloop.start()
|
mainloop.start()
|
||||||
|
|
|
@ -51,7 +51,7 @@ def tox_factory(data, settings):
|
||||||
tox_options.contents.start_port = settings['start_port']
|
tox_options.contents.start_port = settings['start_port']
|
||||||
tox_options.contents.end_port = settings['end_port']
|
tox_options.contents.end_port = settings['end_port']
|
||||||
tox_options.contents.tcp_port = settings['tcp_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_type = TOX_SAVEDATA_TYPE['TOX_SAVE']
|
||||||
tox_options.contents.savedata_data = c_char_p(data)
|
tox_options.contents.savedata_data = c_char_p(data)
|
||||||
tox_options.contents.savedata_length = len(data)
|
tox_options.contents.savedata_length = len(data)
|
||||||
return Tox(tox_options)
|
return Tox(tox_options)
|
||||||
|
|
|
@ -33,6 +33,7 @@ class Settings(dict):
|
||||||
'save_history': False,
|
'save_history': False,
|
||||||
'allow_inline': True,
|
'allow_inline': True,
|
||||||
'allow_auto_accept': False,
|
'allow_auto_accept': False,
|
||||||
|
'show_online_friends': False,
|
||||||
'auto_accept_from_friends': [],
|
'auto_accept_from_friends': [],
|
||||||
'friends_aliases': [],
|
'friends_aliases': [],
|
||||||
'typing_notifications': True,
|
'typing_notifications': True,
|
||||||
|
|
Loading…
Reference in a new issue