Added TODO list and made m_copy*_statusmessage functions return length of copied buffer on success.

This commit is contained in:
irungentoo 2013-09-07 13:27:44 -04:00
parent 64570a1b12
commit bdf31fc6b5
4 changed files with 33 additions and 4 deletions

23
docs/TODO Normal file
View File

@ -0,0 +1,23 @@
TODO list.
[IN PROGRESS] Add what is left to do to the TODO list.
DHT:
[IN PROGRESS] Metadata collection prevention.
[IN PROGRESS] Hardening against attacks.
[IN PROGRESS] Optimizing the code.
Lossless UDP:
[TODO] Increase data send/receive rates.
[IN PROGRESS] Massive IRC like group chats (text only)
[IN PROGRESS] Audio/Video
[DONE] Capture/encoding/streaming/decoding/displaying
[IN PROGRESS] Call initiation
[NOT STARTED] Encryption
[NOT STARTED] Offline messaging
[NOT STARTED] Friends list syncing
[NOT STARTED] Small group chats (group audio/video chats.)

View File

@ -462,15 +462,15 @@ int m_copy_statusmessage(Messenger *m, int friendnumber, uint8_t *buf, uint32_t
return -1; return -1;
memset(buf, 0, maxlen); memset(buf, 0, maxlen);
memcpy(buf, m->friendlist[friendnumber].statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1); memcpy(buf, m->friendlist[friendnumber].statusmessage, MIN(maxlen, m->friendlist[friendnumber].statusmessage_length));
return 0; return MIN(maxlen, m->friendlist[friendnumber].statusmessage_length);
} }
int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen) int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen)
{ {
memset(buf, 0, maxlen); memset(buf, 0, maxlen);
memcpy(buf, m->statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1); memcpy(buf, m->statusmessage, MIN(maxlen, m->statusmessage_length));
return 0; return MIN(maxlen, m->statusmessage_length);
} }
USERSTATUS m_get_userstatus(Messenger *m, int friendnumber) USERSTATUS m_get_userstatus(Messenger *m, int friendnumber)

View File

@ -276,6 +276,9 @@ int m_get_statusmessage_size(Messenger *m, int friendnumber);
/* Copy friendnumber's status message into buf, truncating if size is over maxlen. /* Copy friendnumber's status message into buf, truncating if size is over maxlen.
* Get the size you need to allocate from m_get_statusmessage_size. * Get the size you need to allocate from m_get_statusmessage_size.
* The self variant will copy our own status message. * The self variant will copy our own status message.
*
* returns the length of the copied data on success
* retruns -1 on failure.
*/ */
int m_copy_statusmessage(Messenger *m, int friendnumber, uint8_t *buf, uint32_t maxlen); int m_copy_statusmessage(Messenger *m, int friendnumber, uint8_t *buf, uint32_t maxlen);
int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen); int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen);

View File

@ -204,6 +204,9 @@ int tox_get_statusmessage_size(Tox *tox, int friendnumber);
/* Copy friendnumber's status message into buf, truncating if size is over maxlen. /* Copy friendnumber's status message into buf, truncating if size is over maxlen.
* Get the size you need to allocate from m_get_statusmessage_size. * Get the size you need to allocate from m_get_statusmessage_size.
* The self variant will copy our own status message. * The self variant will copy our own status message.
*
* returns the length of the copied data on success
* retruns -1 on failure.
*/ */
int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen); int tox_copy_statusmessage(Tox *tox, int friendnumber, uint8_t *buf, uint32_t maxlen);
int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen); int tox_copy_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen);