diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 9f75f89f..e3dcf2a1 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -533,6 +533,19 @@ int getname(Messenger *m, int32_t friendnumber, uint8_t *name) | |||
533 | return m->friendlist[friendnumber].name_length; | 533 | return m->friendlist[friendnumber].name_length; |
534 | } | 534 | } |
535 | 535 | ||
536 | int m_get_name_size(Messenger *m, int32_t friendnumber) | ||
537 | { | ||
538 | if (friend_not_valid(m, friendnumber)) | ||
539 | return -1; | ||
540 | |||
541 | return m->friendlist[friendnumber].name_length; | ||
542 | } | ||
543 | |||
544 | int m_get_self_name_size(Messenger *m) | ||
545 | { | ||
546 | return m->name_length; | ||
547 | } | ||
548 | |||
536 | int m_set_statusmessage(Messenger *m, uint8_t *status, uint16_t length) | 549 | int m_set_statusmessage(Messenger *m, uint8_t *status, uint16_t length) |
537 | { | 550 | { |
538 | if (length > MAX_STATUSMESSAGE_LENGTH) | 551 | if (length > MAX_STATUSMESSAGE_LENGTH) |
@@ -588,6 +601,14 @@ int m_copy_statusmessage(Messenger *m, int32_t friendnumber, uint8_t *buf, uint3 | |||
588 | return MIN(maxlen, m->friendlist[friendnumber].statusmessage_length); | 601 | return MIN(maxlen, m->friendlist[friendnumber].statusmessage_length); |
589 | } | 602 | } |
590 | 603 | ||
604 | /* return the size of friendnumber's user status. | ||
605 | * Guaranteed to be at most MAX_STATUSMESSAGE_LENGTH. | ||
606 | */ | ||
607 | int m_get_self_statusmessage_size(Messenger *m) | ||
608 | { | ||
609 | return m->statusmessage_length; | ||
610 | } | ||
611 | |||
591 | int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen) | 612 | int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen) |
592 | { | 613 | { |
593 | memset(buf, 0, maxlen); | 614 | memset(buf, 0, maxlen); |