mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
docs(net): Added leading stars
This commit is contained in:
parent
902828fcc2
commit
956a04af8d
@ -40,11 +40,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@file autoupdate.cpp
|
* @file autoupdate.cpp
|
||||||
|
*
|
||||||
For now we only support auto updates on Windows and OS X, although extending it is not a technical issue.
|
* For now we only support auto updates on Windows and OS X, although extending it is not a technical issue.
|
||||||
Linux users are expected to use their package managers or update manually through official channels.
|
* Linux users are expected to use their package managers or update manually through official channels.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#ifdef Q_OS_WIN64
|
#ifdef Q_OS_WIN64
|
||||||
@ -80,47 +80,47 @@ unsigned char AutoUpdater::key[crypto_sign_PUBLICKEYBYTES];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@var unsigned char AutoUpdater::UpdateFileMeta::sig[crypto_sign_BYTES]
|
* @var unsigned char AutoUpdater::UpdateFileMeta::sig[crypto_sign_BYTES]
|
||||||
@brief Signature of the file (ed25519)
|
* @brief Signature of the file (ed25519)
|
||||||
|
*
|
||||||
@var QString AutoUpdater::UpdateFileMeta::id
|
* @var QString AutoUpdater::UpdateFileMeta::id
|
||||||
@brief Unique id of the file
|
* @brief Unique id of the file
|
||||||
|
*
|
||||||
@var QString AutoUpdater::UpdateFileMeta::installpath
|
* @var QString AutoUpdater::UpdateFileMeta::installpath
|
||||||
@brief Local path including the file name. May be relative to qtox-updater or absolute
|
* @brief Local path including the file name. May be relative to qtox-updater or absolute
|
||||||
|
*
|
||||||
@var uint64_t AutoUpdater::UpdateFileMeta::size
|
* @var uint64_t AutoUpdater::UpdateFileMeta::size
|
||||||
@brief Size in bytes of the file
|
* @brief Size in bytes of the file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@var static const QString AutoUpdater::updateServer
|
* @var static const QString AutoUpdater::updateServer
|
||||||
@brief Hostname of the qTox update server
|
* @brief Hostname of the qTox update server
|
||||||
|
*
|
||||||
@var static const QString AutoUpdater::platform
|
* @var static const QString AutoUpdater::platform
|
||||||
@brief Name of platform we're trying to get updates for
|
* @brief Name of platform we're trying to get updates for
|
||||||
|
*
|
||||||
@var static const QString AutoUpdater::checkURI
|
* @var static const QString AutoUpdater::checkURI
|
||||||
@brief URI of the file containing the latest version string
|
* @brief URI of the file containing the latest version string
|
||||||
|
*
|
||||||
@var static const QString AutoUpdater::flistURI
|
* @var static const QString AutoUpdater::flistURI
|
||||||
@brief URI of the file containing info on each file (hash, signature, size, name, ..)
|
* @brief URI of the file containing info on each file (hash, signature, size, name, ..)
|
||||||
|
*
|
||||||
@var static const QString AutoUpdater::filesURI
|
* @var static const QString AutoUpdater::filesURI
|
||||||
@brief URI of the actual files of the latest version
|
* @brief URI of the actual files of the latest version
|
||||||
|
*
|
||||||
@var static const QString AutoUpdater::updaterBin
|
* @var static const QString AutoUpdater::updaterBin
|
||||||
@brief Path to the qtox-updater binary
|
* @brief Path to the qtox-updater binary
|
||||||
|
*
|
||||||
@var static std::atomic_bool AutoUpdater::abortFlag
|
* @var static std::atomic_bool AutoUpdater::abortFlag
|
||||||
@brief If true, try to abort everything.
|
* @brief If true, try to abort everything.
|
||||||
|
*
|
||||||
@var static std::atomic_bool AutoUpdater::isDownloadingUpdate
|
* @var static std::atomic_bool AutoUpdater::isDownloadingUpdate
|
||||||
@brief We'll pretend there's no new update available if we're already updating
|
* @brief We'll pretend there's no new update available if we're already updating
|
||||||
|
*
|
||||||
@var static QMutex AutoUpdater::progressVersionMutex
|
* @var static QMutex AutoUpdater::progressVersionMutex
|
||||||
@brief No, we can't just make the QString atomic
|
* @brief No, we can't just make the QString atomic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString AutoUpdater::checkURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/version";
|
const QString AutoUpdater::checkURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/version";
|
||||||
const QString AutoUpdater::flistURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/flist";
|
const QString AutoUpdater::flistURI = AutoUpdater::updateServer+"/qtox/"+AutoUpdater::platform+"/flist";
|
||||||
@ -132,18 +132,18 @@ QString AutoUpdater::progressVersion;
|
|||||||
QMutex AutoUpdater::progressVersionMutex;
|
QMutex AutoUpdater::progressVersionMutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class AutoUpdater
|
* @class AutoUpdater
|
||||||
@brief Handles checking and applying updates for qTox.
|
* @brief Handles checking and applying updates for qTox.
|
||||||
@note Do *NOT* use auto update unless AUTOUPDATE_ENABLED is defined to 1.
|
* @note Do *NOT* use auto update unless AUTOUPDATE_ENABLED is defined to 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Checks if an update is available for download.
|
* @brief Checks if an update is available for download.
|
||||||
@return True if an update is available for download, false otherwise.
|
* @return True if an update is available for download, false otherwise.
|
||||||
|
*
|
||||||
Connects to the qTox update server, and check if an update is available for download
|
* Connects to the qTox update server, and check if an update is available for download
|
||||||
Will call getUpdateVersion, and as such may block and processEvents.
|
* Will call getUpdateVersion, and as such may block and processEvents.
|
||||||
*/
|
*/
|
||||||
bool AutoUpdater::isUpdateAvailable()
|
bool AutoUpdater::isUpdateAvailable()
|
||||||
{
|
{
|
||||||
if (isDownloadingUpdate)
|
if (isDownloadingUpdate)
|
||||||
@ -159,10 +159,10 @@ bool AutoUpdater::isUpdateAvailable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Fetch the version info of the last update available from the qTox update server
|
* @brief Fetch the version info of the last update available from the qTox update server
|
||||||
@note Will try to follow qTox's proxy settings, may block and processEvents
|
* @note Will try to follow qTox's proxy settings, may block and processEvents
|
||||||
@return Avaliable version info.
|
* @return Avaliable version info.
|
||||||
*/
|
*/
|
||||||
AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
|
AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
|
||||||
{
|
{
|
||||||
VersionInfo versionInfo;
|
VersionInfo versionInfo;
|
||||||
@ -228,10 +228,10 @@ AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Parses and validates a flist file.
|
* @brief Parses and validates a flist file.
|
||||||
@param flistData Install file data.
|
* @param flistData Install file data.
|
||||||
@return An empty list on error.
|
* @return An empty list on error.
|
||||||
*/
|
*/
|
||||||
QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
|
QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
|
||||||
{
|
{
|
||||||
QList<UpdateFileMeta> flist;
|
QList<UpdateFileMeta> flist;
|
||||||
@ -292,10 +292,10 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Gets the update server's flist.
|
* @brief Gets the update server's flist.
|
||||||
@note Will try to follow qTox's proxy settings, may block and processEvents
|
* @note Will try to follow qTox's proxy settings, may block and processEvents
|
||||||
@return An empty array on error
|
* @return An empty array on error
|
||||||
*/
|
*/
|
||||||
QByteArray AutoUpdater::getUpdateFlist()
|
QByteArray AutoUpdater::getUpdateFlist()
|
||||||
{
|
{
|
||||||
QByteArray flist;
|
QByteArray flist;
|
||||||
@ -326,10 +326,10 @@ QByteArray AutoUpdater::getUpdateFlist()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Generates a list of files we need to update.
|
* @brief Generates a list of files we need to update.
|
||||||
@param updateFlist List of files available to update.
|
* @param updateFlist List of files available to update.
|
||||||
@return List of files we need to update.
|
* @return List of files we need to update.
|
||||||
*/
|
*/
|
||||||
QList<AutoUpdater::UpdateFileMeta> AutoUpdater::genUpdateDiff(QList<UpdateFileMeta> updateFlist)
|
QList<AutoUpdater::UpdateFileMeta> AutoUpdater::genUpdateDiff(QList<UpdateFileMeta> updateFlist)
|
||||||
{
|
{
|
||||||
QList<UpdateFileMeta> diff;
|
QList<UpdateFileMeta> diff;
|
||||||
@ -342,10 +342,10 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::genUpdateDiff(QList<UpdateFileMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Checks if we have an up to date version of this file locally installed.
|
* @brief Checks if we have an up to date version of this file locally installed.
|
||||||
@param fileMeta File to check.
|
* @param fileMeta File to check.
|
||||||
@return True if file doesn't need updates, false if need.
|
* @return True if file doesn't need updates, false if need.
|
||||||
*/
|
*/
|
||||||
bool AutoUpdater::isUpToDate(AutoUpdater::UpdateFileMeta fileMeta)
|
bool AutoUpdater::isUpToDate(AutoUpdater::UpdateFileMeta fileMeta)
|
||||||
{
|
{
|
||||||
QString appDir = qApp->applicationDirPath();
|
QString appDir = qApp->applicationDirPath();
|
||||||
@ -362,13 +362,13 @@ bool AutoUpdater::isUpToDate(AutoUpdater::UpdateFileMeta fileMeta)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Tries to fetch the file from the update server.
|
* @brief Tries to fetch the file from the update server.
|
||||||
@note Note that a file with an empty but non-null QByteArray is not an error, merely a file of size 0.
|
* @note Note that a file with an empty but non-null QByteArray is not an error, merely a file of size 0.
|
||||||
@note Will try to follow qTox's proxy settings, may block and processEvents.
|
* @note Will try to follow qTox's proxy settings, may block and processEvents.
|
||||||
@param fileMeta Meta data fo file to update.
|
* @param fileMeta Meta data fo file to update.
|
||||||
@param progressCallback Callback function, which will connected with QNetworkReply::downloadProgress
|
* @param progressCallback Callback function, which will connected with QNetworkReply::downloadProgress
|
||||||
@return A file with a null QByteArray on error.
|
* @return A file with a null QByteArray on error.
|
||||||
*/
|
*/
|
||||||
AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta,
|
AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta,
|
||||||
std::function<void(int,int)> progressCallback)
|
std::function<void(int,int)> progressCallback)
|
||||||
{
|
{
|
||||||
@ -402,10 +402,10 @@ AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Will try to download an update, if successful qTox will apply it after a restart
|
* @brief Will try to download an update, if successful qTox will apply it after a restart
|
||||||
@note Will try to follow qTox's proxy settings, may block and processEvents
|
* @note Will try to follow qTox's proxy settings, may block and processEvents
|
||||||
@result True if successful and qTox will apply it after a restart
|
* @result True if successful and qTox will apply it after a restart
|
||||||
*/
|
*/
|
||||||
bool AutoUpdater::downloadUpdate()
|
bool AutoUpdater::downloadUpdate()
|
||||||
{
|
{
|
||||||
// Updates only for supported platforms
|
// Updates only for supported platforms
|
||||||
@ -534,12 +534,12 @@ fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Checks if an update is downloaded and ready to be installed.
|
* @brief Checks if an update is downloaded and ready to be installed.
|
||||||
@note If result is true, call installLocalUpdate,
|
* @note If result is true, call installLocalUpdate,
|
||||||
@return True if an update is downloaded, false if partially downloaded.
|
* @return True if an update is downloaded, false if partially downloaded.
|
||||||
|
*
|
||||||
If an update was partially downloaded, the function will resume asynchronously and return false.
|
* If an update was partially downloaded, the function will resume asynchronously and return false.
|
||||||
*/
|
*/
|
||||||
bool AutoUpdater::isLocalUpdateReady()
|
bool AutoUpdater::isLocalUpdateReady()
|
||||||
{
|
{
|
||||||
// Updates only for supported platforms
|
// Updates only for supported platforms
|
||||||
@ -580,12 +580,12 @@ bool AutoUpdater::isLocalUpdateReady()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Launches the qTox updater to try to install the local update and exits immediately.
|
* @brief Launches the qTox updater to try to install the local update and exits immediately.
|
||||||
|
*
|
||||||
@note Will not check that the update actually exists, use isLocalUpdateReady first for that.
|
* @note Will not check that the update actually exists, use isLocalUpdateReady first for that.
|
||||||
The qTox updater will restart us after the update is done.
|
* The qTox updater will restart us after the update is done.
|
||||||
If we fail to start the qTox updater, we will delete the update and exit.
|
* If we fail to start the qTox updater, we will delete the update and exit.
|
||||||
*/
|
*/
|
||||||
void AutoUpdater::installLocalUpdate()
|
void AutoUpdater::installLocalUpdate()
|
||||||
{
|
{
|
||||||
qDebug() << "About to start the qTox updater to install a local update";
|
qDebug() << "About to start the qTox updater to install a local update";
|
||||||
@ -626,13 +626,13 @@ void AutoUpdater::installLocalUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Checks update an show dialog asking to download it.
|
* @brief Checks update an show dialog asking to download it.
|
||||||
@note Runs asynchronously in its own thread, and will return immediatly
|
* @note Runs asynchronously in its own thread, and will return immediatly
|
||||||
|
*
|
||||||
Will call isUpdateAvailable, and as such may processEvents.
|
* Will call isUpdateAvailable, and as such may processEvents.
|
||||||
Connects to the qTox update server, if an update is found
|
* Connects to the qTox update server, if an update is found
|
||||||
shows a dialog to the user asking to download it.
|
* shows a dialog to the user asking to download it.
|
||||||
*/
|
*/
|
||||||
void AutoUpdater::checkUpdatesAsyncInteractive()
|
void AutoUpdater::checkUpdatesAsyncInteractive()
|
||||||
{
|
{
|
||||||
if (isDownloadingUpdate)
|
if (isDownloadingUpdate)
|
||||||
@ -642,10 +642,10 @@ void AutoUpdater::checkUpdatesAsyncInteractive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Does the actual work for checkUpdatesAsyncInteractive
|
* @brief Does the actual work for checkUpdatesAsyncInteractive
|
||||||
|
*
|
||||||
Blocking, but otherwise has the same properties than checkUpdatesAsyncInteractive
|
* Blocking, but otherwise has the same properties than checkUpdatesAsyncInteractive
|
||||||
*/
|
*/
|
||||||
void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
|
void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
|
||||||
{
|
{
|
||||||
if (!isUpdateAvailable())
|
if (!isUpdateAvailable())
|
||||||
@ -685,9 +685,9 @@ void AutoUpdater::checkUpdatesAsyncInteractiveWorker()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Thread safe setter
|
* @brief Thread safe setter
|
||||||
@param version Version to set.
|
* @param version Version to set.
|
||||||
*/
|
*/
|
||||||
void AutoUpdater::setProgressVersion(QString version)
|
void AutoUpdater::setProgressVersion(QString version)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&progressVersionMutex);
|
QMutexLocker lock(&progressVersionMutex);
|
||||||
@ -695,11 +695,11 @@ void AutoUpdater::setProgressVersion(QString version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Abort update process.
|
* @brief Abort update process.
|
||||||
|
*
|
||||||
@note Aborting will make some functions try to return early.
|
* @note Aborting will make some functions try to return early.
|
||||||
Call before qTox exits to avoid the updater running in the background.
|
* Call before qTox exits to avoid the updater running in the background.
|
||||||
*/
|
*/
|
||||||
void AutoUpdater::abortUpdates()
|
void AutoUpdater::abortUpdates()
|
||||||
{
|
{
|
||||||
abortFlag = true;
|
abortFlag = true;
|
||||||
@ -707,8 +707,8 @@ void AutoUpdater::abortUpdates()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Functions giving info on the progress of update downloads.
|
* @brief Functions giving info on the progress of update downloads.
|
||||||
@return Version as string.
|
* @return Version as string.
|
||||||
*/
|
*/
|
||||||
QString AutoUpdater::getProgressVersion()
|
QString AutoUpdater::getProgressVersion()
|
||||||
{
|
{
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class AvatarBroadcaster
|
* @class AvatarBroadcaster
|
||||||
|
*
|
||||||
Takes care of broadcasting avatar changes to our friends in a smart way
|
* Takes care of broadcasting avatar changes to our friends in a smart way
|
||||||
Cache a copy of our current avatar and friends who have received it
|
* Cache a copy of our current avatar and friends who have received it
|
||||||
so we don't spam avatar transfers to a friend who already has it.
|
* so we don't spam avatar transfers to a friend who already has it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QByteArray AvatarBroadcaster::avatarData;
|
QByteArray AvatarBroadcaster::avatarData;
|
||||||
QMap<uint32_t, bool> AvatarBroadcaster::friendsSentTo;
|
QMap<uint32_t, bool> AvatarBroadcaster::friendsSentTo;
|
||||||
@ -41,9 +41,9 @@ static auto autoBroadcast = [](uint32_t friendId, Status)
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Set our current avatar.
|
* @brief Set our current avatar.
|
||||||
@param data Byte array on avater.
|
* @param data Byte array on avater.
|
||||||
*/
|
*/
|
||||||
void AvatarBroadcaster::setAvatar(QByteArray data)
|
void AvatarBroadcaster::setAvatar(QByteArray data)
|
||||||
{
|
{
|
||||||
if (avatarData == data)
|
if (avatarData == data)
|
||||||
@ -58,9 +58,9 @@ void AvatarBroadcaster::setAvatar(QByteArray data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Send our current avatar to this friend, if not already sent
|
* @brief Send our current avatar to this friend, if not already sent
|
||||||
@param friendId Id of friend to send avatar.
|
* @param friendId Id of friend to send avatar.
|
||||||
*/
|
*/
|
||||||
void AvatarBroadcaster::sendAvatarTo(uint32_t friendId)
|
void AvatarBroadcaster::sendAvatarTo(uint32_t friendId)
|
||||||
{
|
{
|
||||||
if (friendsSentTo.contains(friendId) && friendsSentTo[friendId])
|
if (friendsSentTo.contains(friendId) && friendsSentTo[friendId])
|
||||||
@ -72,9 +72,9 @@ void AvatarBroadcaster::sendAvatarTo(uint32_t friendId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Setup auto broadcast sending avatar.
|
* @brief Setup auto broadcast sending avatar.
|
||||||
@param state If true, we automatically broadcast our avatar to friends when they come online.
|
* @param state If true, we automatically broadcast our avatar to friends when they come online.
|
||||||
*/
|
*/
|
||||||
void AvatarBroadcaster::enableAutoBroadcast(bool state)
|
void AvatarBroadcaster::enableAutoBroadcast(bool state)
|
||||||
{
|
{
|
||||||
QObject::disconnect(autoBroadcastConn);
|
QObject::disconnect(autoBroadcastConn);
|
||||||
|
@ -30,20 +30,20 @@
|
|||||||
#define TOX_HEX_ID_LENGTH 2*TOX_ADDRESS_SIZE
|
#define TOX_HEX_ID_LENGTH 2*TOX_ADDRESS_SIZE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class ToxDNS
|
* @class ToxDNS
|
||||||
@brief Handles tox1 and tox3 DNS queries.
|
* @brief Handles tox1 and tox3 DNS queries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@struct tox3_server
|
* @struct tox3_server
|
||||||
@brief Represents a tox3 server.
|
* @brief Represents a tox3 server.
|
||||||
|
*
|
||||||
@var const char* tox3_server::name
|
* @var const char* tox3_server::name
|
||||||
@brief Hostname of the server, e.g. toxme.se.
|
* @brief Hostname of the server, e.g. toxme.se.
|
||||||
|
*
|
||||||
@var uint8_t* tox3_server::pubkey
|
* @var uint8_t* tox3_server::pubkey
|
||||||
@brief Public key of the tox3 server, usually 256bit long.
|
* @brief Public key of the tox3 server, usually 256bit long.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const ToxDNS::tox3_server ToxDNS::pinnedServers[]
|
const ToxDNS::tox3_server ToxDNS::pinnedServers[]
|
||||||
{
|
{
|
||||||
@ -67,11 +67,11 @@ void ToxDNS::showWarning(const QString &message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Try to fetch the first entry of the given TXT record.
|
* @brief Try to fetch the first entry of the given TXT record.
|
||||||
@param record Record to search.
|
* @param record Record to search.
|
||||||
@param silent May display message boxes on error if silent is false.
|
* @param silent May display message boxes on error if silent is false.
|
||||||
@return An empty object on failure. May block for up to ~3s.
|
* @return An empty object on failure. May block for up to ~3s.
|
||||||
*/
|
*/
|
||||||
QByteArray ToxDNS::fetchLastTextRecord(const QString& record, bool silent)
|
QByteArray ToxDNS::fetchLastTextRecord(const QString& record, bool silent)
|
||||||
{
|
{
|
||||||
QDnsLookup dns;
|
QDnsLookup dns;
|
||||||
@ -131,13 +131,13 @@ QByteArray ToxDNS::fetchLastTextRecord(const QString& record, bool silent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Send query to DNS to find Tox Id.
|
* @brief Send query to DNS to find Tox Id.
|
||||||
@note Will *NOT* fallback on queryTox1 anymore.
|
* @note Will *NOT* fallback on queryTox1 anymore.
|
||||||
@param server Server to sending query.
|
* @param server Server to sending query.
|
||||||
@param record Should look like user@domain.tld.
|
* @param record Should look like user@domain.tld.
|
||||||
@param silent If true, there will be no output on error.
|
* @param silent If true, there will be no output on error.
|
||||||
@return Tox Id string.
|
* @return Tox Id string.
|
||||||
*/
|
*/
|
||||||
QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool silent)
|
QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool silent)
|
||||||
{
|
{
|
||||||
QByteArray nameData = record.left(record.indexOf('@')).toUtf8(), id, realRecord;
|
QByteArray nameData = record.left(record.indexOf('@')).toUtf8(), id, realRecord;
|
||||||
@ -218,11 +218,11 @@ fallbackOnTox1:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Tries to map a text string to a ToxId struct, will query Tox DNS records if necessary.
|
* @brief Tries to map a text string to a ToxId struct, will query Tox DNS records if necessary.
|
||||||
@param address Adress to search for Tox ID.
|
* @param address Adress to search for Tox ID.
|
||||||
@param silent If true, there will be no output on error.
|
* @param silent If true, there will be no output on error.
|
||||||
@return Found Tox Id.
|
* @return Found Tox Id.
|
||||||
*/
|
*/
|
||||||
ToxId ToxDNS::resolveToxAddress(const QString &address, bool silent)
|
ToxId ToxDNS::resolveToxAddress(const QString &address, bool silent)
|
||||||
{
|
{
|
||||||
if (address.isEmpty())
|
if (address.isEmpty())
|
||||||
|
@ -31,12 +31,12 @@
|
|||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class Toxme
|
* @class Toxme
|
||||||
@brief This class implements a client for the toxme.se API
|
* @brief This class implements a client for the toxme.se API
|
||||||
|
*
|
||||||
@note The class is thread safe
|
* @note The class is thread safe
|
||||||
@note May process events while waiting for blocking calls
|
* @note May process events while waiting for blocking calls
|
||||||
*/
|
*/
|
||||||
|
|
||||||
QByteArray Toxme::makeJsonRequest(QString url, QString json, QNetworkReply::NetworkError &error)
|
QByteArray Toxme::makeJsonRequest(QString url, QString json, QNetworkReply::NetworkError &error)
|
||||||
{
|
{
|
||||||
@ -145,10 +145,10 @@ QByteArray Toxme::prepareEncryptedJson(QString url, int action, QString payload)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Converts a toxme address to a Tox ID.
|
* @brief Converts a toxme address to a Tox ID.
|
||||||
@param address Toxme address.
|
* @param address Toxme address.
|
||||||
@return Found ToxId (an empty ID on error).
|
* @return Found ToxId (an empty ID on error).
|
||||||
*/
|
*/
|
||||||
ToxId Toxme::lookup(QString address)
|
ToxId Toxme::lookup(QString address)
|
||||||
{
|
{
|
||||||
// JSON injection ?
|
// JSON injection ?
|
||||||
@ -218,15 +218,15 @@ Toxme::ExecCode Toxme::extractError(QString json)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Creates a new toxme address associated with a Tox ID.
|
* @brief Creates a new toxme address associated with a Tox ID.
|
||||||
@param[out] code Tox error code @see getErrorMessage.
|
* @param[out] code Tox error code @see getErrorMessage.
|
||||||
@param[in] server Create toxme account on this server.
|
* @param[in] server Create toxme account on this server.
|
||||||
@param[in] id ToxId of current user.
|
* @param[in] id ToxId of current user.
|
||||||
@param[in] address Create toxme account with this adress.
|
* @param[in] address Create toxme account with this adress.
|
||||||
@param[in] keepPrivate If true, the address will not be published on toxme site.
|
* @param[in] keepPrivate If true, the address will not be published on toxme site.
|
||||||
@param[in] bio A short optional description of yourself if you want to publish your address.
|
* @param[in] bio A short optional description of yourself if you want to publish your address.
|
||||||
@return password on success, else sets code parameter and returns an empty QString.
|
* @return password on success, else sets code parameter and returns an empty QString.
|
||||||
*/
|
*/
|
||||||
QString Toxme::createAddress(ExecCode &code, QString server, ToxId id, QString address,
|
QString Toxme::createAddress(ExecCode &code, QString server, ToxId id, QString address,
|
||||||
bool keepPrivate, QString bio)
|
bool keepPrivate, QString bio)
|
||||||
{
|
{
|
||||||
@ -295,11 +295,11 @@ QString Toxme::getPass(QString json, ExecCode &code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Deletes the address associated with your current Tox ID.
|
* @brief Deletes the address associated with your current Tox ID.
|
||||||
@param server Server to delete the address from.
|
* @param server Server to delete the address from.
|
||||||
@param id ToxId to delete.
|
* @param id ToxId to delete.
|
||||||
@return Status code returned from server.
|
* @return Status code returned from server.
|
||||||
*/
|
*/
|
||||||
Toxme::ExecCode Toxme::deleteAddress(QString server, ToxId id)
|
Toxme::ExecCode Toxme::deleteAddress(QString server, ToxId id)
|
||||||
{
|
{
|
||||||
const QString payload{"{\"public_key\":\""+id.toString().left(64)+"\","
|
const QString payload{"{\"public_key\":\""+id.toString().left(64)+"\","
|
||||||
@ -318,10 +318,10 @@ Toxme::ExecCode Toxme::deleteAddress(QString server, ToxId id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Return string of the corresponding error code
|
* @brief Return string of the corresponding error code
|
||||||
@param errorCode Code to get error message
|
* @param errorCode Code to get error message
|
||||||
@return Source error message
|
* @return Source error message
|
||||||
*/
|
*/
|
||||||
QString Toxme::getErrorMessage(int errorCode)
|
QString Toxme::getErrorMessage(int errorCode)
|
||||||
{
|
{
|
||||||
switch (errorCode) {
|
switch (errorCode) {
|
||||||
@ -365,10 +365,10 @@ QString Toxme::getErrorMessage(int errorCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Return translated error message
|
* @brief Return translated error message
|
||||||
@param errorCode Code to translate
|
* @param errorCode Code to translate
|
||||||
@return Translated Toxme error message
|
* @return Translated Toxme error message
|
||||||
*/
|
*/
|
||||||
QString Toxme::translateErrorMessage(int errorCode)
|
QString Toxme::translateErrorMessage(int errorCode)
|
||||||
{
|
{
|
||||||
switch (errorCode) {
|
switch (errorCode) {
|
||||||
|
@ -45,11 +45,11 @@ bool toxURIEventHandler(const QByteArray& eventData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Shows a dialog asking whether or not to add this tox address as a friend.
|
* @brief Shows a dialog asking whether or not to add this tox address as a friend.
|
||||||
@note Will wait until the core is ready first.
|
* @note Will wait until the core is ready first.
|
||||||
@param toxURI Tox URI to try to add.
|
* @param toxURI Tox URI to try to add.
|
||||||
@return True, if tox URI is correct, false otherwise.
|
* @return True, if tox URI is correct, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool handleToxURI(const QString &toxURI)
|
bool handleToxURI(const QString &toxURI)
|
||||||
{
|
{
|
||||||
Core* core = Core::getInstance();
|
Core* core = Core::getInstance();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user