summaryrefslogtreecommitdiff
path: root/core/Messenger.c
diff options
context:
space:
mode:
authorcharmlesscoin <charmlesscoin@gmail.com>2013-08-06 20:58:42 -0400
committercharmlesscoin <charmlesscoin@gmail.com>2013-08-06 20:58:42 -0400
commitc644ccd28782e9d74f5962a97a0973551fb7afe2 (patch)
tree42f892aea55a6394d5d6ff0dbace2214675cbd71 /core/Messenger.c
parent95a3f69580749b8fcabf92cc2ace757d61fa34de (diff)
parentd04f2d0e51931db5fbd8c672c44bb1e59fc58b79 (diff)
Merge branch 'master' of git://github.com/irungentoo/ProjectTox-Core
Diffstat (limited to 'core/Messenger.c')
-rw-r--r--core/Messenger.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/Messenger.c b/core/Messenger.c
index d8bf3413..5532c9cc 100644
--- a/core/Messenger.c
+++ b/core/Messenger.c
@@ -116,7 +116,7 @@ int m_addfriend(uint8_t *client_id, uint8_t *data, uint16_t length)
116 return FAERR_ALREADYSENT; 116 return FAERR_ALREADYSENT;
117 117
118 uint32_t i; 118 uint32_t i;
119 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ 119 for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */
120 if(friendlist[i].status == NOFRIEND) { 120 if(friendlist[i].status == NOFRIEND) {
121 DHT_addfriend(client_id); 121 DHT_addfriend(client_id);
122 friendlist[i].status = FRIEND_ADDED; 122 friendlist[i].status = FRIEND_ADDED;
@@ -141,7 +141,7 @@ int m_addfriend_norequest(uint8_t * client_id)
141 if (getfriend_id(client_id) != -1) 141 if (getfriend_id(client_id) != -1)
142 return -1; 142 return -1;
143 uint32_t i; 143 uint32_t i;
144 for (i = 0; i <= numfriends && i <= MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */ 144 for (i = 0; i < numfriends && i < MAX_NUM_FRIENDS; ++i) { /*TODO: dynamic memory allocation to allow for more than MAX_NUM_FRIENDS friends */
145 if(friendlist[i].status == NOFRIEND) { 145 if(friendlist[i].status == NOFRIEND) {
146 DHT_addfriend(client_id); 146 DHT_addfriend(client_id);
147 friendlist[i].status = FRIEND_REQUESTED; 147 friendlist[i].status = FRIEND_REQUESTED;
@@ -352,7 +352,7 @@ static int send_userstatus(int friendnumber, uint8_t * status, uint16_t length)
352 memcpy(thepacket + 2, status, length); 352 memcpy(thepacket + 2, status, length);
353 thepacket[0] = PACKET_ID_USERSTATUS; 353 thepacket[0] = PACKET_ID_USERSTATUS;
354 thepacket[1] = self_userstatus_kind; 354 thepacket[1] = self_userstatus_kind;
355 int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 1); 355 int written = write_cryptpacket(friendlist[friendnumber].crypt_connection_id, thepacket, length + 2);
356 free(thepacket); 356 free(thepacket);
357 return written; 357 return written;
358} 358}