nTox fixes.

Added TOX_MAX_MESSAGE_LENGTH to tox.h
This commit is contained in:
irungentoo 2014-03-18 20:45:03 -04:00
parent e2b235e296
commit f7beb70fe9
2 changed files with 6 additions and 10 deletions

View File

@ -1255,13 +1255,7 @@ int main(int argc, char *argv[])
time_t timestamp0 = time(NULL); time_t timestamp0 = time(NULL);
uint8_t pollok = 0; uint8_t pollok = 0;
uint16_t len = 0; uint16_t len = tox_wait_data_size();
if (!tox_wait_prepare(m, NULL, &len))
pollok = 1;
else
new_lines("[i] failed to setup for low cpu consumption");
uint8_t data[len]; uint8_t data[len];
while (1) { while (1) {
@ -1283,10 +1277,10 @@ int main(int argc, char *argv[])
// during file transfer wasting cpu cycles is almost unavoidable // during file transfer wasting cpu cycles is almost unavoidable
c_sleep(1); c_sleep(1);
else { else {
if (pollok && (tox_wait_prepare(m, data, &len) == 1)) { if (pollok && (tox_wait_prepare(m, data) == 1)) {
/* 250ms is more than fast enough in "regular" mode */ /* 250ms is more than fast enough in "regular" mode */
tox_wait_execute(m, data, len, 100); tox_wait_execute(data, 0, 100000);
tox_wait_cleanup(m, data, len); tox_wait_cleanup(m, data);
} else } else
c_sleep(25); c_sleep(25);
} }

View File

@ -56,6 +56,8 @@ extern "C" {
#endif #endif
#define TOX_MAX_NAME_LENGTH 128 #define TOX_MAX_NAME_LENGTH 128
/* Maximum message and action length that can be sent. */
#define TOX_MAX_MESSAGE_LENGTH 1003
#define TOX_MAX_STATUSMESSAGE_LENGTH 1007 #define TOX_MAX_STATUSMESSAGE_LENGTH 1007
#define TOX_CLIENT_ID_SIZE 32 #define TOX_CLIENT_ID_SIZE 32