From bdf31fc6b55646fd798f5d39aeb5751f4a5319e7 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 7 Sep 2013 13:27:44 -0400 Subject: [PATCH] Added TODO list and made m_copy*_statusmessage functions return length of copied buffer on success. --- docs/TODO | 23 +++++++++++++++++++++++ toxcore/Messenger.c | 8 ++++---- toxcore/Messenger.h | 3 +++ toxcore/tox.h | 3 +++ 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 docs/TODO diff --git a/docs/TODO b/docs/TODO new file mode 100644 index 00000000..53ecbf00 --- /dev/null +++ b/docs/TODO @@ -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.) + + diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 846bed6d..a1abce41 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -462,15 +462,15 @@ int m_copy_statusmessage(Messenger *m, int friendnumber, uint8_t *buf, uint32_t return -1; memset(buf, 0, maxlen); - memcpy(buf, m->friendlist[friendnumber].statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1); - return 0; + memcpy(buf, m->friendlist[friendnumber].statusmessage, MIN(maxlen, m->friendlist[friendnumber].statusmessage_length)); + return MIN(maxlen, m->friendlist[friendnumber].statusmessage_length); } int m_copy_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen) { memset(buf, 0, maxlen); - memcpy(buf, m->statusmessage, MIN(maxlen, MAX_STATUSMESSAGE_LENGTH) - 1); - return 0; + memcpy(buf, m->statusmessage, MIN(maxlen, m->statusmessage_length)); + return MIN(maxlen, m->statusmessage_length); } USERSTATUS m_get_userstatus(Messenger *m, int friendnumber) diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 9d7f17dc..a4c6114b 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h @@ -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. * Get the size you need to allocate from m_get_statusmessage_size. * 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_self_statusmessage(Messenger *m, uint8_t *buf, uint32_t maxlen); diff --git a/toxcore/tox.h b/toxcore/tox.h index e6cf0322..718f817b 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -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. * Get the size you need to allocate from m_get_statusmessage_size. * 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_self_statusmessage(Tox *tox, uint8_t *buf, uint32_t maxlen);