From 99bfb9a4f2b15d3b5a9fe3878df2eb5e55c428aa Mon Sep 17 00:00:00 2001 From: Diadlo Date: Fri, 2 Feb 2018 15:00:06 +0300 Subject: Revert "Add correction message type" This reverts commit e16d3894c5979fcfe1c57bf7dadc455ce690baf9 and commit c5976e37eaadf663dc3d0c18376ea023355048f3. --- toxcore/group.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'toxcore/group.c') diff --git a/toxcore/group.c b/toxcore/group.c index c929d995..3f14e8ce 100644 --- a/toxcore/group.c +++ b/toxcore/group.c @@ -1956,21 +1956,6 @@ int group_action_send(const Group_Chats *g_c, int groupnumber, const uint8_t *ac return ret; } -/* send a group correction message - * return 0 on success - * see: send_message_group() for error codes. - */ -int group_correction_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint16_t length) -{ - int ret = send_message_group(g_c, groupnumber, PACKET_ID_CORRECTION, action, length); - - if (ret > 0) { - return 0; - } - - return ret; -} - /* High level function to send custom lossy packets. * * return -1 on failure. @@ -2098,9 +2083,24 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const } break; - case PACKET_ID_MESSAGE: - case PACKET_ID_ACTION: - case PACKET_ID_CORRECTION: { + case PACKET_ID_MESSAGE: { + if (msg_data_len == 0) { + return; + } + + VLA(uint8_t, newmsg, msg_data_len + 1); + memcpy(newmsg, msg_data, msg_data_len); + newmsg[msg_data_len] = 0; + + // TODO(irungentoo): + if (g_c->message_callback) { + g_c->message_callback(g_c->m, groupnumber, index, 0, newmsg, msg_data_len, userdata); + } + + break; + } + + case PACKET_ID_ACTION: { if (msg_data_len == 0) { return; } @@ -2111,9 +2111,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const // TODO(irungentoo): if (g_c->message_callback) { - uint8_t chat_message_id = message_id - PACKET_ID_MESSAGE; - g_c->message_callback(g_c->m, groupnumber, index, chat_message_id, - newmsg, msg_data_len, userdata); + g_c->message_callback(g_c->m, groupnumber, index, 1, newmsg, msg_data_len, userdata); } break; -- cgit v1.2.3