diff options
author | irungentoo <irungentoo@gmail.com> | 2013-08-09 05:29:07 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-08-09 05:29:07 -0700 |
commit | 9673900278e2f6e4ec8766107f27a81933be2201 (patch) | |
tree | a3ed7b95ed09342402f37892ba2246436897e9d9 /core/friend_requests.c | |
parent | 29264b58fc58c5c22f301b9c2ed1a03eab78b310 (diff) | |
parent | 0b8fa729146c8033be161540289baa2244c94042 (diff) |
Merge pull request #408 from cbrueffer/receivedfix
Fix a recurring typo in code and comments.
Diffstat (limited to 'core/friend_requests.c')
-rw-r--r-- | core/friend_requests.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/friend_requests.c b/core/friend_requests.c index 5550b662..b8dab87e 100644 --- a/core/friend_requests.c +++ b/core/friend_requests.c | |||
@@ -68,32 +68,32 @@ void callback_friendrequest(void (*function)(uint8_t *, uint8_t *, uint16_t)) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | /*NOTE: the following is just a temporary fix for the multiple friend requests recieved at the same time problem | 71 | /*NOTE: the following is just a temporary fix for the multiple friend requests received at the same time problem |
72 | TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/ | 72 | TODO: Make this better (This will most likely tie in with the way we will handle spam.)*/ |
73 | 73 | ||
74 | #define MAX_RECIEVED_STORED 32 | 74 | #define MAX_RECEIVED_STORED 32 |
75 | 75 | ||
76 | static uint8_t recieved_requests[MAX_RECIEVED_STORED][crypto_box_PUBLICKEYBYTES]; | 76 | static uint8_t received_requests[MAX_RECEIVED_STORED][crypto_box_PUBLICKEYBYTES]; |
77 | static uint16_t recieved_requests_index; | 77 | static uint16_t received_requests_index; |
78 | 78 | ||
79 | /*Add to list of recieved friend requests*/ | 79 | /*Add to list of received friend requests*/ |
80 | static void addto_recievedlist(uint8_t * client_id) | 80 | static void addto_receivedlist(uint8_t * client_id) |
81 | { | 81 | { |
82 | if (recieved_requests_index >= MAX_RECIEVED_STORED) | 82 | if (received_requests_index >= MAX_RECEIVED_STORED) |
83 | recieved_requests_index = 0; | 83 | received_requests_index = 0; |
84 | 84 | ||
85 | memcpy(recieved_requests[recieved_requests_index], client_id, crypto_box_PUBLICKEYBYTES); | 85 | memcpy(received_requests[received_requests_index], client_id, crypto_box_PUBLICKEYBYTES); |
86 | ++recieved_requests_index; | 86 | ++received_requests_index; |
87 | } | 87 | } |
88 | 88 | ||
89 | /* Check if a friend request was already recieved | 89 | /* Check if a friend request was already received |
90 | return 0 if not, 1 if we did */ | 90 | return 0 if not, 1 if we did */ |
91 | static int request_recieved(uint8_t * client_id) | 91 | static int request_received(uint8_t * client_id) |
92 | { | 92 | { |
93 | uint32_t i; | 93 | uint32_t i; |
94 | 94 | ||
95 | for (i = 0; i < MAX_RECIEVED_STORED; ++i) { | 95 | for (i = 0; i < MAX_RECEIVED_STORED; ++i) { |
96 | if (memcmp(recieved_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0) | 96 | if (memcmp(received_requests[i], client_id, crypto_box_PUBLICKEYBYTES) == 0) |
97 | return 1; | 97 | return 1; |
98 | } | 98 | } |
99 | 99 | ||
@@ -117,10 +117,10 @@ int friendreq_handlepacket(uint8_t * packet, uint32_t length, IP_Port source) | |||
117 | 117 | ||
118 | if (len == -1) | 118 | if (len == -1) |
119 | return 1; | 119 | return 1; |
120 | if (request_recieved(public_key)) | 120 | if (request_received(public_key)) |
121 | return 1; | 121 | return 1; |
122 | 122 | ||
123 | addto_recievedlist(public_key); | 123 | addto_receivedlist(public_key); |
124 | (*handle_friendrequest)(public_key, data, len); | 124 | (*handle_friendrequest)(public_key, data, len); |
125 | } else { /* if request is not for us, try routing it. */ | 125 | } else { /* if request is not for us, try routing it. */ |
126 | if(route_packet(packet + 1, packet, length) == length) | 126 | if(route_packet(packet + 1, packet, length) == length) |