diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Messenger.c | 19 | ||||
-rw-r--r-- | core/Messenger.h | 6 |
2 files changed, 25 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 |
diff --git a/core/Messenger.h b/core/Messenger.h index d7e101b2..679df989 100644 --- a/core/Messenger.h +++ b/core/Messenger.h | |||
@@ -49,6 +49,12 @@ int m_addfriend_norequest(uint8_t * client_id); | |||
49 | //return -1 if no such friend | 49 | //return -1 if no such friend |
50 | int getfriend_id(uint8_t * client_id); | 50 | int getfriend_id(uint8_t * client_id); |
51 | 51 | ||
52 | //copies the public key associated to that friend id into client_id buffer. | ||
53 | //make sure that client_id is of size CLIENT_ID_SIZE. | ||
54 | //returns 0 if success | ||
55 | //return -1 if failure. | ||
56 | int getclient_id(int friend_id, uint8_t * client_id) | ||
57 | |||
52 | //remove a friend | 58 | //remove a friend |
53 | int m_delfriend(int friendnumber); | 59 | int m_delfriend(int friendnumber); |
54 | 60 | ||