summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJfreegman <Jfreegman@gmail.com>2014-07-05 19:47:13 -0400
committerJfreegman <Jfreegman@gmail.com>2014-07-05 19:47:13 -0400
commitd8406db1133a66d9183c2eade9e4fe0f9f22dd73 (patch)
tree6b3febd3b09648b341721466ad2b6fc07287f457
parent9d154029cb0141d78cdfca74fa2a1177b88bc677 (diff)
delete groupchat when join fails
-rw-r--r--toxcore/Messenger.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 2adbd870..b65f09ae 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1206,8 +1206,10 @@ int join_groupchat(Messenger *m, int32_t friendnumber, const uint8_t *friend_gro
1206 1206
1207 IP_Port friend_ip = get_friend_ipport(m, friendnumber); 1207 IP_Port friend_ip = get_friend_ipport(m, friendnumber);
1208 1208
1209 if (friend_ip.ip.family == 0) 1209 if (friend_ip.ip.family == 0) {
1210 del_groupchat(m, groupnum);
1210 return -1; 1211 return -1;
1212 }
1211 1213
1212 id_copy(data, friend_group_public_key); 1214 id_copy(data, friend_group_public_key);
1213 id_copy(data + crypto_box_PUBLICKEYBYTES, m->chats[groupnum]->self_public_key); 1215 id_copy(data + crypto_box_PUBLICKEYBYTES, m->chats[groupnum]->self_public_key);
@@ -1218,6 +1220,7 @@ int join_groupchat(Messenger *m, int32_t friendnumber, const uint8_t *friend_gro
1218 return groupnum; 1220 return groupnum;
1219 } 1221 }
1220 1222
1223 del_groupchat(m, groupnum);
1221 return -1; 1224 return -1;
1222} 1225}
1223 1226