mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-23 01:23:03 +01:00
don't delete groups on client exit
This commit is contained in:
parent
02a0cac85a
commit
6cc8fdf215
@ -167,10 +167,8 @@ static void kill_groupchat_window(ToxWindow *self)
|
||||
}
|
||||
|
||||
/* Closes groupchat window and cleans up. */
|
||||
void close_groupchat(ToxWindow *self, Tox *m, int groupnum, const char *partmessage, int length)
|
||||
void close_groupchat(ToxWindow *self, Tox *m, int groupnum)
|
||||
{
|
||||
tox_group_delete(m, groupnum, (uint8_t *) partmessage, (uint16_t) length);
|
||||
|
||||
free(groupchats[groupnum].peer_names);
|
||||
free(groupchats[groupnum].peer_name_lengths);
|
||||
memset(&groupchats[groupnum], 0, sizeof(GroupChat));
|
||||
@ -186,6 +184,12 @@ void close_groupchat(ToxWindow *self, Tox *m, int groupnum, const char *partmess
|
||||
kill_groupchat_window(self);
|
||||
}
|
||||
|
||||
static void exit_groupchat(ToxWindow *self, Tox *m, int groupnum, const char *partmessage, int length)
|
||||
{
|
||||
tox_group_delete(m, groupnum, (uint8_t *) partmessage, (uint16_t) length);
|
||||
close_groupchat(self, m, groupnum);
|
||||
}
|
||||
|
||||
/* Note: the arguments to these functions are validated in the caller functions */
|
||||
void set_nick_all_groups(Tox *m, const char *nick, uint16_t length)
|
||||
{
|
||||
@ -744,7 +748,7 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key, bool ltr)
|
||||
if (line[offset] != '\0')
|
||||
++offset;
|
||||
|
||||
close_groupchat(self, m, self->num, line + offset, ctx->len - offset);
|
||||
exit_groupchat(self, m, self->num, line + offset, ctx->len - offset);
|
||||
return;
|
||||
} else if (strncmp(line, "/me ", 4) == 0) {
|
||||
send_group_action(self, m, self->num, line + 4);
|
||||
|
@ -72,7 +72,7 @@ typedef struct {
|
||||
#endif
|
||||
} GroupChat;
|
||||
|
||||
void close_groupchat(ToxWindow *self, Tox *m, int groupnum, const char *partmessage, int length);
|
||||
void close_groupchat(ToxWindow *self, Tox *m, int groupnum);
|
||||
int init_groupchat_win(Tox *m, int groupnum, const char *groupname, int length);
|
||||
void set_nick_all_groups(Tox *m, const char *nick, uint16_t length);
|
||||
void set_status_all_groups(Tox *m, uint8_t status);
|
||||
|
@ -661,7 +661,7 @@ void kill_all_windows(Tox *m)
|
||||
if (windows[i].is_chat)
|
||||
kill_chat_window(&windows[i], m);
|
||||
else if (windows[i].is_groupchat)
|
||||
close_groupchat(&windows[i], m, windows[i].num, "Quit", 4);
|
||||
close_groupchat(&windows[i], m, windows[i].num);
|
||||
}
|
||||
|
||||
kill_prompt_window(prompt);
|
||||
|
Loading…
Reference in New Issue
Block a user