diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-13 15:10:51 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-13 15:10:51 -0700 |
commit | 3a95d5da41a0b1f77180dc71871df454d900fd61 (patch) | |
tree | 7ee5f682fc5130bebc757d8d7650bc19fb4e0329 /core/Messenger.c | |
parent | d63d63de9b17afaa5896929d00fbc1ba04e52491 (diff) | |
parent | c2fb803ad5d3fdfeebd3fa2d61cb2cc3d68d2930 (diff) |
Merge pull request #33 from nurupo/master
Added conversion from friend_id to client_id
Diffstat (limited to 'core/Messenger.c')
-rw-r--r-- | core/Messenger.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/Messenger.c b/core/Messenger.c index 8236c117..65a73876 100644 --- a/core/Messenger.c +++ b/core/Messenger.c | |||
@@ -66,6 +66,25 @@ int getfriend_id(uint8_t * client_id) | |||
66 | return -1; | 66 | return -1; |
67 | } | 67 | } |
68 | 68 | ||
69 | //copies the public key associated to that friend id into client_id buffer. | ||
70 | //make sure that client_id is of size CLIENT_ID_SIZE. | ||
71 | //returns 0 if success | ||
72 | //return -1 if failure. | ||
73 | int getclient_id(int friend_id, uint8_t * client_id) | ||
74 | { | ||
75 | if(friendnumber >= numfriends || friendnumber < 0) | ||
76 | { | ||
77 | return -1; | ||
78 | } | ||
79 | |||
80 | if(friendlist[friend_id].status > 0) | ||
81 | { | ||
82 | memcpy(client_id, friendlist[friend_id].client_id, CLIENT_ID_SIZE); | ||
83 | return 0; | ||
84 | } | ||
85 | return -1; | ||
86 | } | ||
87 | |||
69 | 88 | ||
70 | //add a friend | 89 | //add a friend |
71 | //set the data that will be sent along with friend request | 90 | //set the data that will be sent along with friend request |