summaryrefslogtreecommitdiff
path: root/toxcore/group.c
diff options
context:
space:
mode:
authorDiadlo <polsha3@gmail.com>2018-02-02 15:00:06 +0300
committerDiadlo <polsha3@gmail.com>2018-02-02 15:00:43 +0300
commit99bfb9a4f2b15d3b5a9fe3878df2eb5e55c428aa (patch)
tree2954ae5e3b327d93343a082e869e9f159f2d0c08 /toxcore/group.c
parent83779a21eaf19bbf6aa5d61d8f59681a306e4f65 (diff)
Revert "Add correction message type"
This reverts commit e16d3894c5979fcfe1c57bf7dadc455ce690baf9 and commit c5976e37eaadf663dc3d0c18376ea023355048f3.
Diffstat (limited to 'toxcore/group.c')
-rw-r--r--toxcore/group.c40
1 files changed, 19 insertions, 21 deletions
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
1956 return ret; 1956 return ret;
1957} 1957}
1958 1958
1959/* send a group correction message
1960 * return 0 on success
1961 * see: send_message_group() for error codes.
1962 */
1963int group_correction_send(const Group_Chats *g_c, int groupnumber, const uint8_t *action, uint16_t length)
1964{
1965 int ret = send_message_group(g_c, groupnumber, PACKET_ID_CORRECTION, action, length);
1966
1967 if (ret > 0) {
1968 return 0;
1969 }
1970
1971 return ret;
1972}
1973
1974/* High level function to send custom lossy packets. 1959/* High level function to send custom lossy packets.
1975 * 1960 *
1976 * return -1 on failure. 1961 * return -1 on failure.
@@ -2098,9 +2083,24 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2098 } 2083 }
2099 break; 2084 break;
2100 2085
2101 case PACKET_ID_MESSAGE: 2086 case PACKET_ID_MESSAGE: {
2102 case PACKET_ID_ACTION: 2087 if (msg_data_len == 0) {
2103 case PACKET_ID_CORRECTION: { 2088 return;
2089 }
2090
2091 VLA(uint8_t, newmsg, msg_data_len + 1);
2092 memcpy(newmsg, msg_data, msg_data_len);
2093 newmsg[msg_data_len] = 0;
2094
2095 // TODO(irungentoo):
2096 if (g_c->message_callback) {
2097 g_c->message_callback(g_c->m, groupnumber, index, 0, newmsg, msg_data_len, userdata);
2098 }
2099
2100 break;
2101 }
2102
2103 case PACKET_ID_ACTION: {
2104 if (msg_data_len == 0) { 2104 if (msg_data_len == 0) {
2105 return; 2105 return;
2106 } 2106 }
@@ -2111,9 +2111,7 @@ static void handle_message_packet_group(Group_Chats *g_c, int groupnumber, const
2111 2111
2112 // TODO(irungentoo): 2112 // TODO(irungentoo):
2113 if (g_c->message_callback) { 2113 if (g_c->message_callback) {
2114 uint8_t chat_message_id = message_id - PACKET_ID_MESSAGE; 2114 g_c->message_callback(g_c->m, groupnumber, index, 1, newmsg, msg_data_len, userdata);
2115 g_c->message_callback(g_c->m, groupnumber, index, chat_message_id,
2116 newmsg, msg_data_len, userdata);
2117 } 2115 }
2118 2116
2119 break; 2117 break;