mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'GrayHatter-master'
This commit is contained in:
commit
72b1a17cc2
|
@ -106,24 +106,28 @@ void call_kill_transmission(ToxAVCall *call);
|
|||
|
||||
uint32_t toxav_version_major(void)
|
||||
{
|
||||
return 0;
|
||||
return TOXAV_VERSION_MAJOR;
|
||||
}
|
||||
|
||||
uint32_t toxav_version_minor(void)
|
||||
{
|
||||
return 0;
|
||||
return TOXAV_VERSION_MINOR;
|
||||
}
|
||||
|
||||
uint32_t toxav_version_patch(void)
|
||||
{
|
||||
return 0;
|
||||
return TOXAV_VERSION_PATCH;
|
||||
}
|
||||
|
||||
bool toxav_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
(void)major;
|
||||
(void)minor;
|
||||
(void)patch;
|
||||
|
||||
return 1;
|
||||
return (TOXAV_VERSION_MAJOR == major && /* Force the major version */
|
||||
(TOXAV_VERSION_MINOR > minor || /* Current minor version must be newer than requested -- or -- */
|
||||
(TOXAV_VERSION_MINOR == minor && TOXAV_VERSION_PATCH >= patch) /* the patch must be the same or newer */
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
ToxAV *toxav_new(Tox *tox, TOXAV_ERR_NEW *error)
|
||||
{
|
||||
TOXAV_ERR_NEW rc = TOXAV_ERR_NEW_OK;
|
||||
|
|
|
@ -72,23 +72,26 @@ typedef struct Messenger Tox;
|
|||
|
||||
uint32_t tox_version_major(void)
|
||||
{
|
||||
return 0;
|
||||
return TOX_VERSION_MAJOR;
|
||||
}
|
||||
|
||||
uint32_t tox_version_minor(void)
|
||||
{
|
||||
return 0;
|
||||
return TOX_VERSION_MINOR;
|
||||
}
|
||||
|
||||
uint32_t tox_version_patch(void)
|
||||
{
|
||||
return 0;
|
||||
return TOX_VERSION_PATCH;
|
||||
}
|
||||
|
||||
bool tox_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
//TODO
|
||||
return 1;
|
||||
return (TOX_VERSION_MAJOR == major && /* Force the major version */
|
||||
(TOX_VERSION_MINOR > minor || /* Current minor version must be newer than requested -- or -- */
|
||||
(TOX_VERSION_MINOR == minor && TOX_VERSION_PATCH >= patch) /* the patch must be the same or newer */
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,6 +47,30 @@
|
|||
#error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH)
|
||||
#endif
|
||||
|
||||
uint32_t toxes_version_major(void)
|
||||
{
|
||||
return TOXES_VERSION_MAJOR;
|
||||
}
|
||||
|
||||
uint32_t toxes_version_minor(void)
|
||||
{
|
||||
return TOXES_VERSION_MINOR;
|
||||
}
|
||||
|
||||
uint32_t toxes_version_patch(void)
|
||||
{
|
||||
return TOXES_VERSION_PATCH;
|
||||
}
|
||||
|
||||
bool toxes_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch)
|
||||
{
|
||||
return (TOXES_VERSION_MAJOR == major && /* Force the major version */
|
||||
(TOXES_VERSION_MINOR > minor || /* Current minor version must be newer than requested -- or -- */
|
||||
(TOXES_VERSION_MINOR == minor && TOXES_VERSION_PATCH >= patch) /* the patch must be the same or newer */
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/* Clients should consider alerting their users that, unlike plain data, if even one bit
|
||||
* becomes corrupted, the data will be entirely unrecoverable.
|
||||
* Ditto if they forget their password, there is no way to recover the data.
|
||||
|
|
|
@ -42,6 +42,87 @@ struct Tox_Options;
|
|||
#define TOX_PASS_KEY_LENGTH 32
|
||||
#define TOX_PASS_ENCRYPTION_EXTRA_LENGTH 80
|
||||
|
||||
/**
|
||||
* ToxEncryptSave.
|
||||
*/
|
||||
#ifndef TOXES_DEFINED
|
||||
#define TOXES_DEFINED
|
||||
#endif /* TOXES_DEFINED */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* :: API version
|
||||
*
|
||||
******************************************************************************/
|
||||
/**
|
||||
* The major version number. Incremented when the API or ABI changes in an
|
||||
* incompatible way.
|
||||
*/
|
||||
#define TOXES_VERSION_MAJOR 0u
|
||||
|
||||
/**
|
||||
* The minor version number. Incremented when functionality is added without
|
||||
* breaking the API or ABI. Set to 0 when the major version number is
|
||||
* incremented.
|
||||
*/
|
||||
#define TOXES_VERSION_MINOR 0u
|
||||
|
||||
/**
|
||||
* The patch or revision number. Incremented when bugfixes are applied without
|
||||
* changing any functionality or API or ABI.
|
||||
*/
|
||||
#define TOXES_VERSION_PATCH 0u
|
||||
|
||||
/**
|
||||
* A macro to check at preprocessing time whether the client code is compatible
|
||||
* with the installed version of ToxAV.
|
||||
*/
|
||||
#define TOXES_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \
|
||||
(TOXES_VERSION_MAJOR == MAJOR && \
|
||||
(TOXES_VERSION_MINOR > MINOR || \
|
||||
(TOXES_VERSION_MINOR == MINOR && \
|
||||
TOXES_VERSION_PATCH >= PATCH)))
|
||||
|
||||
/**
|
||||
* A macro to make compilation fail if the client code is not compatible with
|
||||
* the installed version of ToxAV.
|
||||
*/
|
||||
#define TOXES_VERSION_REQUIRE(MAJOR, MINOR, PATCH) \
|
||||
typedef char toxes_required_version[TOXES_IS_COMPATIBLE(MAJOR, MINOR, PATCH) ? 1 : -1]
|
||||
|
||||
/**
|
||||
* A convenience macro to call toxES_version_is_compatible with the currently
|
||||
* compiling API version.
|
||||
*/
|
||||
#define TOXES_VERSION_IS_ABI_COMPATIBLE() \
|
||||
toxes_version_is_compatible(TOXES_VERSION_MAJOR, TOXES_VERSION_MINOR, TOXES_VERSION_PATCH)
|
||||
|
||||
/**
|
||||
* Return the major version number of the library. Can be used to display the
|
||||
* ToxAV library version or to check whether the client is compatible with the
|
||||
* dynamically linked version of ToxAV.
|
||||
*/
|
||||
uint32_t toxes_version_major(void);
|
||||
|
||||
/**
|
||||
* Return the minor version number of the library.
|
||||
*/
|
||||
uint32_t toxes_version_minor(void);
|
||||
|
||||
/**
|
||||
* Return the patch number of the library.
|
||||
*/
|
||||
uint32_t toxes_version_patch(void);
|
||||
|
||||
/**
|
||||
* Return whether the compiled library version is compatible with the passed
|
||||
* version numbers.
|
||||
*/
|
||||
bool toxes_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch);
|
||||
|
||||
|
||||
|
||||
/* This module is conceptually organized into two parts. The first part are the functions
|
||||
* with "key" in the name. To use these functions, first derive an encryption key
|
||||
* from a password with tox_derive_key_from_pass, and use the returned key to
|
||||
|
|
Loading…
Reference in New Issue
Block a user