/* send a text chat message to an online friend return the message id if packet was successfully put into the send queue return 0 if it was not */ uint32_t m_sendmessage(int friendnumber, uint8_t *message, uint32_t length) { if (friendnumber < 0 || friendnumber >= numfriends) return 0; uint32_t msgid = ++friendlist[friendnumber].message_id; if (msgid == 0) msgid = 1; /* otherwise, false error */ if(m_sendmessage_withid(friendnumber, msgid, message, length)) { return msgid; } return 0; }
uint32_t tox_sendmessage_withid(void *tox, int friendnumber, uint32_t theid, uint8_t *message, uint32_t length) { Messenger *m = tox; return m_sendmessage_withid(m, friendnumber, theid, message, length); }
size_t tox_send_message_withid(Tox *tox, int friendnumber, size_t theid, size_t *message, size_t length) { Messenger *m = tox; return m_sendmessage_withid(m, friendnumber, theid, message, length); }