summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-07-13 15:10:51 -0700
committerirungentoo <irungentoo@gmail.com>2013-07-13 15:10:51 -0700
commit3a95d5da41a0b1f77180dc71871df454d900fd61 (patch)
tree7ee5f682fc5130bebc757d8d7650bc19fb4e0329
parentd63d63de9b17afaa5896929d00fbc1ba04e52491 (diff)
parentc2fb803ad5d3fdfeebd3fa2d61cb2cc3d68d2930 (diff)
Merge pull request #33 from nurupo/master
Added conversion from friend_id to client_id
-rw-r--r--core/Messenger.c19
-rw-r--r--core/Messenger.h6
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.
73int 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
50int getfriend_id(uint8_t * client_id); 50int 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.
56int getclient_id(int friend_id, uint8_t * client_id)
57
52//remove a friend 58//remove a friend
53int m_delfriend(int friendnumber); 59int m_delfriend(int friendnumber);
54 60