Skip to content

Commit

Permalink
Add deprecation notice to some UPPER_CASE enums.
Browse files Browse the repository at this point in the history
The enumerators won't change, but the type name will change in 0.3.0.
Reasoning:
- Type names in toxcore start with an uppercase letter and either have at
  least one lowercase letter in them, or are less than 4 characters long.
- Constants consist of 4 or more uppercase letters or underscores.

By these rules, "DHT" is a type name, but "TOX_USER_STATUS" is a
constant. We provide Tox_User_Status as an alternative for now, and will
switch to that in 0.3.0, removing the UPPER_CASE versions.
  • Loading branch information
iphydf committed Aug 9, 2018
1 parent ffd71e8 commit fceee56
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions toxcore/tox.api.h
Expand Up @@ -342,6 +342,9 @@ const MAX_HOSTNAME_LENGTH = 255;

/**
* Represents the possible statuses a client can have.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class USER_STATUS {
/**
Expand All @@ -364,6 +367,9 @@ enum class USER_STATUS {
/**
* Represents message types for ${tox.friend.send.message} and conference
* messages.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class MESSAGE_TYPE {
/**
Expand All @@ -387,6 +393,9 @@ enum class MESSAGE_TYPE {

/**
* Type of proxy used to connect to TCP relays.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class PROXY_TYPE {
/**
Expand All @@ -405,6 +414,9 @@ enum class PROXY_TYPE {

/**
* Type of savedata to create the Tox instance from.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class SAVEDATA_TYPE {
/**
Expand All @@ -424,6 +436,9 @@ enum class SAVEDATA_TYPE {

/**
* Severity level of log messages.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class LOG_LEVEL {
/**
Expand Down Expand Up @@ -813,6 +828,9 @@ bool add_tcp_relay(string host, uint16_t port, const uint8_t[PUBLIC_KEY_SIZE] pu

/**
* Protocols that can be used to connect to the network or friends.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class CONNECTION {
/**
Expand Down Expand Up @@ -2104,6 +2122,9 @@ namespace conference {

/**
* Conference types for the ${event invite} event.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
enum class TYPE {
/**
Expand Down
21 changes: 21 additions & 0 deletions toxcore/tox.h
Expand Up @@ -374,6 +374,9 @@ uint32_t tox_max_hostname_length(void);

/**
* Represents the possible statuses a client can have.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_USER_STATUS {

Expand All @@ -400,6 +403,9 @@ typedef enum TOX_USER_STATUS {
/**
* Represents message types for tox_friend_send_message and conference
* messages.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_MESSAGE_TYPE {

Expand Down Expand Up @@ -428,6 +434,9 @@ typedef enum TOX_MESSAGE_TYPE {

/**
* Type of proxy used to connect to TCP relays.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_PROXY_TYPE {

Expand All @@ -451,6 +460,9 @@ typedef enum TOX_PROXY_TYPE {

/**
* Type of savedata to create the Tox instance from.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_SAVEDATA_TYPE {

Expand All @@ -474,6 +486,9 @@ typedef enum TOX_SAVEDATA_TYPE {

/**
* Severity level of log messages.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_LOG_LEVEL {

Expand Down Expand Up @@ -972,6 +987,9 @@ bool tox_add_tcp_relay(Tox *tox, const char *host, uint16_t port, const uint8_t

/**
* Protocols that can be used to connect to the network or friends.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_CONNECTION {

Expand Down Expand Up @@ -2379,6 +2397,9 @@ void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *callback);

/**
* Conference types for the conference_invite event.
*
* @deprecated All UPPER_CASE enum type names are deprecated. Use the
* Camel_Snake_Case versions, instead.
*/
typedef enum TOX_CONFERENCE_TYPE {

Expand Down

0 comments on commit fceee56

Please sign in to comment.