void Core::start() { tox = tox_new(); tox_callback_friendrequest(tox, onFriendRequest, this); tox_callback_friendmessage(tox, onFriendMessage, this); tox_callback_namechange(tox, onFriendNameChange, this); tox_callback_statusmessage(tox, onStatusMessageChanged, this); tox_callback_userstatus(tox, onUserStatusChanged, this); tox_callback_connectionstatus(tox, onConnectionStatusChanged, this); tox_callback_action(tox, onAction, this); uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE]; tox_getaddress(tox, friendAddress); emit friendAddressGenerated(CFriendAddress::toString(friendAddress)); CString cUsername(Settings::getInstance().getUsername()); tox_setname(tox, cUsername.data(), cUsername.size()); bootstrapDht(); timer->setInterval(30); timer->start(); }
void Core::setUsername(const QString& username) { CString cUsername(username); if (tox_setname(tox, cUsername.data(), cUsername.size()) == -1) { emit failedToSetUsername(username); } else { emit usernameSet(username); } }
void Core::setUsername(const QString& username) { CString cUsername(username); if (tox_set_name(tox, cUsername.data(), cUsername.size()) == -1) { emit failedToSetUsername(username); } else { saveConfiguration(); emit usernameSet(username); } }
void Core::start() { const Settings &settings = Settings::getInstance(); Tox_Options options; options.ipv6enabled = settings.isIPv6Enabled(); options.proxy_type = TOX_PROXY_NONE; options.udp_disabled = 0; tox = tox_new(&options); // if failed to initialize -- try to fallback to ipv4 if (tox == nullptr && settings.isIPv6Enabled() && settings.isIPv4FallbackEnabled()) { options.ipv6enabled = 0; tox = tox_new(&options); } // if still didn't manage to initialize -- throw an error if (tox == nullptr) { emit failedToStart(); return; } loadConfiguration(); 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_typing_change(tox, onFriendTypingChange, this); tox_callback_status_message(tox, onStatusMessageChanged, this); tox_callback_user_status(tox, onUserStatusChanged, this); tox_callback_connection_status(tox, onConnectionStatusChanged, this); uint8_t friendAddress[TOX_FRIEND_ADDRESS_SIZE]; tox_get_address(tox, friendAddress); emit friendAddressGenerated(CFriendAddress::toString(friendAddress)); CString cUsername(settings.getUsername()); tox_set_name(tox, cUsername.data(), cUsername.size()); CString cStatusMessage(settings.getStatusMessage()); tox_set_status_message(tox, cStatusMessage.data(), cStatusMessage.size()); bootstrapDht(); timer->start(tox_do_interval(tox)); }
void Core::setUsername(const QString& username) { CString cUsername(username); if (tox_self_set_name(tox, cUsername.data(), cUsername.size(), nullptr) == false) { emit failedToSetUsername(username); } else { emit usernameSet(username); if (ready) profile.saveToxSave(); } }
void Core::setUsername(const QString& username) { if (username == getUsername()) return; CString cUsername(username); if (!tox_self_set_name(tox, cUsername.data(), cUsername.size(), nullptr)) { emit failedToSetUsername(username); return; } emit usernameSet(username); if (ready) profile.saveToxSave(); }
void Core::start() { tox_callback_friendrequest(handle, onFriendRequest, (void*)this); tox_callback_friendmessage(handle, onFriendMessage, (void*)this); tox_callback_namechange(handle, onFriendNameChange, (void*)this); tox_callback_statusmessage(handle, onStatusMessageChanged, (void*)this); tox_callback_userstatus(handle, onFriendStatusChanged, (void*)this); uint8_t self_public_key [TOX_FRIEND_ADDRESS_SIZE]; tox_getaddress(handle, self_public_key); emit userIdGenerated(CUserId::toString(self_public_key)); CString cUsername(Settings::getInstance().getUsername()); tox_setname(handle, cUsername.data(), cUsername.size()); bootstrapDht(); timer->setInterval(30); timer->start(); }