diff options
author | irungentoo <irungentoo@tox.im> | 2014-02-21 21:00:55 -0500 |
---|---|---|
committer | irungentoo <irungentoo@tox.im> | 2014-02-21 21:00:55 -0500 |
commit | 6992e8c75986e7c32b795cb854a5c73d00e9a8f4 (patch) | |
tree | aae758d3bc439fcc9a86b3ad994cd87dbea9e894 /toxcore/Messenger.h | |
parent | 554afe11d7c3e286b6f286405a1a1857b9f55c81 (diff) | |
parent | 36adc48b781105e55790d0049fec1b190104e480 (diff) |
Merge pull request #757 from nurupo/api-fix-1
Added size functions for names and status messages
Diffstat (limited to 'toxcore/Messenger.h')
-rw-r--r-- | toxcore/Messenger.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 8474bbe7..88e5e19d 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -370,6 +370,12 @@ uint16_t getself_name(Messenger *m, uint8_t *name); | |||
370 | */ | 370 | */ |
371 | int getname(Messenger *m, int32_t friendnumber, uint8_t *name); | 371 | int getname(Messenger *m, int32_t friendnumber, uint8_t *name); |
372 | 372 | ||
373 | /* return the length of name, including null on success. | ||
374 | * return -1 on failure. | ||
375 | */ | ||
376 | int m_get_name_size(Messenger *m, int32_t friendnumber); | ||
377 | int m_get_self_name_size(Messenger *m); | ||
378 | |||
373 | /* returns valid ip port of connected friend on success | 379 | /* returns valid ip port of connected friend on success |
374 | * returns zeroed out IP_Port on failure | 380 | * returns zeroed out IP_Port on failure |
375 | */ | 381 | */ |
@@ -384,10 +390,11 @@ IP_Port get_friend_ipport(Messenger *m, int32_t friendnumber); | |||
384 | int m_set_statusmessage(Messenger *m, uint8_t *status, uint16_t length); | 390 | int m_set_statusmessage(Messenger *m, uint8_t *status, uint16_t length); |
385 | int m_set_userstatus(Messenger *m, USERSTATUS status); | 391 | int m_set_userstatus(Messenger *m, USERSTATUS status); |
386 | 392 | ||
387 | /* return the length of friendnumber's status message, including null. | 393 | /* return the length of friendnumber's status message, including null on success. |
388 | * Pass it into malloc. | 394 | * return -1 on failure. |
389 | */ | 395 | */ |
390 | int m_get_statusmessage_size(Messenger *m, int32_t friendnumber); | 396 | int m_get_statusmessage_size(Messenger *m, int32_t friendnumber); |
397 | int m_get_self_statusmessage_size(Messenger *m); | ||
391 | 398 | ||
392 | /* Copy friendnumber's status message into buf, truncating if size is over maxlen. | 399 | /* Copy friendnumber's status message into buf, truncating if size is over maxlen. |
393 | * Get the size you need to allocate from m_get_statusmessage_size. | 400 | * Get the size you need to allocate from m_get_statusmessage_size. |