diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/tox.api.h | 7 | ||||
-rw-r--r-- | toxcore/tox.c | 4 | ||||
-rw-r--r-- | toxcore/tox.h | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index 2df57429..e9e3483d 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h | |||
@@ -844,14 +844,17 @@ inline namespace self { | |||
844 | 844 | ||
845 | uint32_t nospam { | 845 | uint32_t nospam { |
846 | /** | 846 | /** |
847 | * Set the 4-byte nospam part of the address. | 847 | * Set the 4-byte nospam part of the address. This value is expected in host |
848 | * byte order. I.e. 0x12345678 will form the bytes [12, 34, 56, 78] in the | ||
849 | * nospam part of the Tox friend address. | ||
848 | * | 850 | * |
849 | * @param nospam Any 32 bit unsigned integer. | 851 | * @param nospam Any 32 bit unsigned integer. |
850 | */ | 852 | */ |
851 | set(); | 853 | set(); |
852 | 854 | ||
853 | /** | 855 | /** |
854 | * Get the 4-byte nospam part of the address. | 856 | * Get the 4-byte nospam part of the address. This value is returned in host |
857 | * byte order. | ||
855 | */ | 858 | */ |
856 | get(); | 859 | get(); |
857 | } | 860 | } |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 7898868b..c7d90871 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -479,13 +479,13 @@ void tox_self_get_address(const Tox *tox, uint8_t *address) | |||
479 | void tox_self_set_nospam(Tox *tox, uint32_t nospam) | 479 | void tox_self_set_nospam(Tox *tox, uint32_t nospam) |
480 | { | 480 | { |
481 | Messenger *m = tox; | 481 | Messenger *m = tox; |
482 | set_nospam(&(m->fr), nospam); | 482 | set_nospam(&(m->fr), htonl(nospam)); |
483 | } | 483 | } |
484 | 484 | ||
485 | uint32_t tox_self_get_nospam(const Tox *tox) | 485 | uint32_t tox_self_get_nospam(const Tox *tox) |
486 | { | 486 | { |
487 | const Messenger *m = tox; | 487 | const Messenger *m = tox; |
488 | return get_nospam(&(m->fr)); | 488 | return ntohl(get_nospam(&(m->fr))); |
489 | } | 489 | } |
490 | 490 | ||
491 | void tox_self_get_public_key(const Tox *tox, uint8_t *public_key) | 491 | void tox_self_get_public_key(const Tox *tox, uint8_t *public_key) |
diff --git a/toxcore/tox.h b/toxcore/tox.h index eae37ac2..af25d8fa 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -979,14 +979,17 @@ void tox_iterate(Tox *tox, void *user_data); | |||
979 | void tox_self_get_address(const Tox *tox, uint8_t *address); | 979 | void tox_self_get_address(const Tox *tox, uint8_t *address); |
980 | 980 | ||
981 | /** | 981 | /** |
982 | * Set the 4-byte nospam part of the address. | 982 | * Set the 4-byte nospam part of the address. This value is expected in host |
983 | * byte order. I.e. 0x12345678 will form the bytes [12, 34, 56, 78] in the | ||
984 | * nospam part of the Tox friend address. | ||
983 | * | 985 | * |
984 | * @param nospam Any 32 bit unsigned integer. | 986 | * @param nospam Any 32 bit unsigned integer. |
985 | */ | 987 | */ |
986 | void tox_self_set_nospam(Tox *tox, uint32_t nospam); | 988 | void tox_self_set_nospam(Tox *tox, uint32_t nospam); |
987 | 989 | ||
988 | /** | 990 | /** |
989 | * Get the 4-byte nospam part of the address. | 991 | * Get the 4-byte nospam part of the address. This value is returned in host |
992 | * byte order. | ||
990 | */ | 993 | */ |
991 | uint32_t tox_self_get_nospam(const Tox *tox); | 994 | uint32_t tox_self_get_nospam(const Tox *tox); |
992 | 995 | ||