1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-12-08 04:56:35 +01:00

implement group status/nick changes, various fixes

This commit is contained in:
Jfreegman
2015-01-11 16:48:40 -05:00
parent b3ab0bde05
commit ff3da5f657
8 changed files with 113 additions and 49 deletions

View File

@@ -295,13 +295,19 @@ int get_group_nick_truncate(Tox *m, char *buf, int peernum, int groupnum)
}
/* copies data to msg buffer.
returns length of msg, which will be no larger than size-1 */
returns length of msg.
returns 0 and nulls msg if length is too big for buffer size */
uint16_t copy_tox_str(char *msg, size_t size, const char *data, uint16_t length)
{
int len = MIN(length, size - 1);
memcpy(msg, data, len);
msg[len] = '\0';
return len;
if (length > size - 1) {
length = 0;
msg[0] = '\0';
return length;
}
memcpy(msg, data, length);
msg[length] = '\0';
return length;
}
/* returns index of the first instance of ch in s starting at idx.