Skip to content

Commit

Permalink
Add deprecation notices to functions that will go away in v0.3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Feb 23, 2018
1 parent c8359c8 commit 02600f0
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 7 deletions.
36 changes: 30 additions & 6 deletions toxcore/tox.api.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,26 +257,36 @@ const ADDRESS_SIZE = PUBLIC_KEY_SIZE + NOSPAM_SIZE + sizeof(uint1

/**
* Maximum length of a nickname in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_NAME_LENGTH = 128;

/**
* Maximum length of a status message in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_STATUS_MESSAGE_LENGTH = 1007;

/**
* Maximum length of a friend request message in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_FRIEND_REQUEST_LENGTH = 1016;

/**
* Maximum length of a single message after which it should be split.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_MESSAGE_LENGTH = 1372;

/**
* Maximum size of custom packets. TODO(iphydf): should be LENGTH?
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_CUSTOM_PACKET_SIZE = 1373;

Expand All @@ -292,6 +302,8 @@ const FILE_ID_LENGTH = 32;

/**
* Maximum file name length for file transfers.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
const MAX_FILENAME_LENGTH = 255;

Expand Down Expand Up @@ -443,7 +455,7 @@ static class options {
* @deprecated The memory layout of this struct (size, alignment, and field
* order) is not part of the ABI. To remain compatible, prefer to use $new to
* allocate the object and accessor functions to set the members. The struct
* will become opaque (i.e. the definition will become private) in v0.2.0.
* will become opaque (i.e. the definition will become private) in v0.3.0.
*/
struct this [get, set] {
/**
Expand Down Expand Up @@ -801,6 +813,9 @@ inline namespace self {
/**
* Return whether we are connected to the DHT. The return value is equal to the
* last value received through the `${event connection_status}` callback.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
get();
}
Expand Down Expand Up @@ -1217,11 +1232,11 @@ namespace friend {

uint64_t last_online {
/**
* Return a unix-time timestamp of the last time the friend associated with a given
* friend number was seen online. This function will return UINT64_MAX on error.
*
* @param friend_number The friend number you want to query.
*/
* Return a unix-time timestamp of the last time the friend associated with a given
* friend number was seen online. This function will return UINT64_MAX on error.
*
* @param friend_number The friend number you want to query.
*/
get(uint32_t friend_number) {
/**
* No friend with the given number exists on the friend list.
Expand Down Expand Up @@ -1351,6 +1366,9 @@ namespace friend {
*
* The status returned is equal to the last status received through the
* `${event status}` callback.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
get(uint32_t friend_number)
with error for query;
Expand Down Expand Up @@ -1382,6 +1400,9 @@ namespace friend {
*
* @return the friend's connection status as it was received through the
* `${event connection_status}` event.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
get(uint32_t friend_number)
with error for query;
Expand Down Expand Up @@ -1415,6 +1436,9 @@ namespace friend {
* @return true if the friend is typing.
* @return false if the friend is not typing, or the friend number was
* invalid. Inspect the error code to determine which case it is.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
get(uint32_t friend_number)
with error for query;
Expand Down
35 changes: 34 additions & 1 deletion toxcore/tox.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,34 +266,44 @@ uint32_t tox_address_size(void);

/**
* Maximum length of a nickname in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_NAME_LENGTH 128

uint32_t tox_max_name_length(void);

/**
* Maximum length of a status message in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_STATUS_MESSAGE_LENGTH 1007

uint32_t tox_max_status_message_length(void);

/**
* Maximum length of a friend request message in bytes.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_FRIEND_REQUEST_LENGTH 1016

uint32_t tox_max_friend_request_length(void);

/**
* Maximum length of a single message after which it should be split.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_MESSAGE_LENGTH 1372

uint32_t tox_max_message_length(void);

/**
* Maximum size of custom packets. TODO(iphydf): should be LENGTH?
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_CUSTOM_PACKET_SIZE 1373

Expand All @@ -315,6 +325,8 @@ uint32_t tox_file_id_length(void);

/**
* Maximum file name length for file transfers.
*
* @deprecated The macro will be removed in 0.3.0. Use the function instead.
*/
#define TOX_MAX_FILENAME_LENGTH 255

Expand Down Expand Up @@ -494,7 +506,7 @@ typedef void tox_log_cb(Tox *tox, TOX_LOG_LEVEL level, const char *file, uint32_
* @deprecated The memory layout of this struct (size, alignment, and field
* order) is not part of the ABI. To remain compatible, prefer to use tox_options_new to
* allocate the object and accessor functions to set the members. The struct
* will become opaque (i.e. the definition will become private) in v0.2.0.
* will become opaque (i.e. the definition will become private) in v0.3.0.
*/
struct Tox_Options {

Expand Down Expand Up @@ -956,6 +968,9 @@ typedef enum TOX_CONNECTION {
/**
* Return whether we are connected to the DHT. The return value is equal to the
* last value received through the `self_connection_status` callback.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
TOX_CONNECTION tox_self_get_connection_status(const Tox *tox);

Expand Down Expand Up @@ -1459,6 +1474,9 @@ size_t tox_friend_get_name_size(const Tox *tox, uint32_t friend_number, TOX_ERR_
* @param name A valid memory region large enough to store the friend's name.
*
* @return true on success.
*
* @deprecated This getter is deprecated. Use the event and store the name
* in the client state.
*/
bool tox_friend_get_name(const Tox *tox, uint32_t friend_number, uint8_t *name, TOX_ERR_FRIEND_QUERY *error);

Expand Down Expand Up @@ -1496,6 +1514,9 @@ size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number
* `friend_status_message` callback.
*
* @param status_message A valid memory region large enough to store the friend's status message.
*
* @deprecated This getter is deprecated. Use the event and store the message
* in the client state.
*/
bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8_t *status_message,
TOX_ERR_FRIEND_QUERY *error);
Expand Down Expand Up @@ -1525,6 +1546,9 @@ void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *
*
* The status returned is equal to the last status received through the
* `friend_status` callback.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error);

Expand Down Expand Up @@ -1554,6 +1578,9 @@ void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *callback);
*
* @return the friend's connection status as it was received through the
* `friend_connection_status` event.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error);

Expand Down Expand Up @@ -1586,6 +1613,9 @@ void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_statu
* @return true if the friend is typing.
* @return false if the friend is not typing, or the friend number was
* invalid. Inspect the error code to determine which case it is.
*
* @deprecated This getter is deprecated. Use the event and store the status
* in the client state.
*/
bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error);

Expand Down Expand Up @@ -2750,6 +2780,9 @@ size_t tox_conference_get_title_size(const Tox *tox, uint32_t conference_number,
* If this parameter is NULL, this function has no effect.
*
* @return true on success.
*
* @deprecated This getter is deprecated. Use the event and store the title
* in the client state.
*/
bool tox_conference_get_title(const Tox *tox, uint32_t conference_number, uint8_t *title,
TOX_ERR_CONFERENCE_TITLE *error);
Expand Down

0 comments on commit 02600f0

Please sign in to comment.