diff options
author | irungentoo <irungentoo@gmail.com> | 2015-01-28 20:48:07 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-01-28 20:48:07 -0500 |
commit | b83ff00c277671e087d580452288c89a84a0f3df (patch) | |
tree | e6bde54b39e8ab2baf97ddfccb216a7ed1e02a87 | |
parent | 10ef3a674f16a02045c5135b4d568d3a2b53b8c4 (diff) |
Code cleanups.
-rw-r--r-- | toxcore/friend_requests.c | 14 | ||||
-rw-r--r-- | toxcore/friend_requests.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c index 98937131..e4a10008 100644 --- a/toxcore/friend_requests.c +++ b/toxcore/friend_requests.c | |||
@@ -58,12 +58,12 @@ void set_filter_function(Friend_Requests *fr, int (*function)(const uint8_t *, v | |||
58 | } | 58 | } |
59 | 59 | ||
60 | /* Add to list of received friend requests. */ | 60 | /* Add to list of received friend requests. */ |
61 | static void addto_receivedlist(Friend_Requests *fr, const uint8_t *client_id) | 61 | static void addto_receivedlist(Friend_Requests *fr, const uint8_t *real_pk) |
62 | { | 62 | { |
63 | if (fr->received_requests_index >= MAX_RECEIVED_STORED) | 63 | if (fr->received_requests_index >= MAX_RECEIVED_STORED) |
64 | fr->received_requests_index = 0; | 64 | fr->received_requests_index = 0; |
65 | 65 | ||
66 | id_copy(fr->received_requests[fr->received_requests_index], client_id); | 66 | id_copy(fr->received_requests[fr->received_requests_index], real_pk); |
67 | ++fr->received_requests_index; | 67 | ++fr->received_requests_index; |
68 | } | 68 | } |
69 | 69 | ||
@@ -72,28 +72,28 @@ static void addto_receivedlist(Friend_Requests *fr, const uint8_t *client_id) | |||
72 | * return 0 if it did not. | 72 | * return 0 if it did not. |
73 | * return 1 if it did. | 73 | * return 1 if it did. |
74 | */ | 74 | */ |
75 | static int request_received(Friend_Requests *fr, const uint8_t *client_id) | 75 | static int request_received(Friend_Requests *fr, const uint8_t *real_pk) |
76 | { | 76 | { |
77 | uint32_t i; | 77 | uint32_t i; |
78 | 78 | ||
79 | for (i = 0; i < MAX_RECEIVED_STORED; ++i) | 79 | for (i = 0; i < MAX_RECEIVED_STORED; ++i) |
80 | if (id_equal(fr->received_requests[i], client_id)) | 80 | if (id_equal(fr->received_requests[i], real_pk)) |
81 | return 1; | 81 | return 1; |
82 | 82 | ||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* Remove client id from received_requests list. | 86 | /* Remove real pk from received_requests list. |
87 | * | 87 | * |
88 | * return 0 if it removed it successfully. | 88 | * return 0 if it removed it successfully. |
89 | * return -1 if it didn't find it. | 89 | * return -1 if it didn't find it. |
90 | */ | 90 | */ |
91 | int remove_request_received(Friend_Requests *fr, const uint8_t *client_id) | 91 | int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk) |
92 | { | 92 | { |
93 | uint32_t i; | 93 | uint32_t i; |
94 | 94 | ||
95 | for (i = 0; i < MAX_RECEIVED_STORED; ++i) { | 95 | for (i = 0; i < MAX_RECEIVED_STORED; ++i) { |
96 | if (id_equal(fr->received_requests[i], client_id)) { | 96 | if (id_equal(fr->received_requests[i], real_pk)) { |
97 | memset(fr->received_requests[i], 0, crypto_box_PUBLICKEYBYTES); | 97 | memset(fr->received_requests[i], 0, crypto_box_PUBLICKEYBYTES); |
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h index b7e07af4..86069f3b 100644 --- a/toxcore/friend_requests.h +++ b/toxcore/friend_requests.h | |||
@@ -51,12 +51,12 @@ typedef struct { | |||
51 | void set_nospam(Friend_Requests *fr, uint32_t num); | 51 | void set_nospam(Friend_Requests *fr, uint32_t num); |
52 | uint32_t get_nospam(const Friend_Requests *fr); | 52 | uint32_t get_nospam(const Friend_Requests *fr); |
53 | 53 | ||
54 | /* Remove client id from received_requests list. | 54 | /* Remove real_pk from received_requests list. |
55 | * | 55 | * |
56 | * return 0 if it removed it successfully. | 56 | * return 0 if it removed it successfully. |
57 | * return -1 if it didn't find it. | 57 | * return -1 if it didn't find it. |
58 | */ | 58 | */ |
59 | int remove_request_received(Friend_Requests *fr, const uint8_t *client_id); | 59 | int remove_request_received(Friend_Requests *fr, const uint8_t *real_pk); |
60 | 60 | ||
61 | /* Set the function that will be executed when a friend request for us is received. | 61 | /* Set the function that will be executed when a friend request for us is received. |
62 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata) | 62 | * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata) |