summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 75210830..a78b06b6 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -123,6 +123,18 @@ int getclient_id(const Messenger *m, int32_t friendnumber, uint8_t *client_id)
123 123
124 return -1; 124 return -1;
125} 125}
126
127/* return friend connection id on success.
128 * return -1 if failure.
129 */
130int getfriendcon_id(const Messenger *m, int32_t friendnumber)
131{
132 if (friend_not_valid(m, friendnumber))
133 return -1;
134
135 return m->friendlist[friendnumber].friendcon_id;
136}
137
126/* TODO: Another checksum algorithm might be better. 138/* TODO: Another checksum algorithm might be better.
127 * 139 *
128 * return a uint16_t that represents the checksum of address of length len. 140 * return a uint16_t that represents the checksum of address of length len.
@@ -1595,6 +1607,9 @@ Messenger *new_messenger(Messenger_Options *options)
1595/* Run this before closing shop. */ 1607/* Run this before closing shop. */
1596void kill_messenger(Messenger *m) 1608void kill_messenger(Messenger *m)
1597{ 1609{
1610 if (!m)
1611 return;
1612
1598 uint32_t i; 1613 uint32_t i;
1599 1614
1600 kill_friend_connections(m->fr_c); 1615 kill_friend_connections(m->fr_c);