summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index ae824697..f91879ea 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -210,6 +210,21 @@ int tox_get_name(Tox *tox, int32_t friendnumber, uint8_t *name)
210 return getname(m, friendnumber, name); 210 return getname(m, friendnumber, name);
211} 211}
212 212
213/* returns the length of name on success.
214 * returns -1 on failure.
215 */
216int tox_get_name_size(Tox *tox, int32_t friendnumber)
217{
218 Messenger *m = tox;
219 return m_get_name_size(m, friendnumber);
220}
221
222int tox_get_self_name_size(Tox *tox)
223{
224 Messenger *m = tox;
225 return m_get_self_name_size(m);
226}
227
213/* Set our user status; 228/* Set our user status;
214 * you are responsible for freeing status after. 229 * you are responsible for freeing status after.
215 * 230 *
@@ -227,8 +242,8 @@ int tox_set_user_status(Tox *tox, TOX_USERSTATUS status)
227 return m_set_userstatus(m, status); 242 return m_set_userstatus(m, status);
228} 243}
229 244
230/* return the length of friendnumber's status message, including null. 245/* returns the length of status message on success.
231 * Pass it into malloc. 246 * returns -1 on failure.
232 */ 247 */
233int tox_get_status_message_size(Tox *tox, int32_t friendnumber) 248int tox_get_status_message_size(Tox *tox, int32_t friendnumber)
234{ 249{
@@ -236,6 +251,12 @@ int tox_get_status_message_size(Tox *tox, int32_t friendnumber)
236 return m_get_statusmessage_size(m, friendnumber); 251 return m_get_statusmessage_size(m, friendnumber);
237} 252}
238 253
254int tox_get_self_status_message_size(Tox *tox)
255{
256 Messenger *m = tox;
257 return m_get_self_statusmessage_size(m, friendnumber);
258}
259
239/* Copy friendnumber's status message into buf, truncating if size is over maxlen. 260/* Copy friendnumber's status message into buf, truncating if size is over maxlen.
240 * Get the size you need to allocate from m_get_statusmessage_size. 261 * Get the size you need to allocate from m_get_statusmessage_size.
241 * The self variant will copy our own status message. 262 * The self variant will copy our own status message.