mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 19:53:28 +01:00
close chatwindow if its associated contact is blocked/deleted
This commit is contained in:
parent
b243f7aa62
commit
a223545853
@ -450,11 +450,20 @@ static void select_friend(ToxWindow *self, wint_t key, int *selected, int num)
|
|||||||
|
|
||||||
static void delete_friend(Tox *m, int32_t f_num)
|
static void delete_friend(Tox *m, int32_t f_num)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (friends[f_num].chatwin >= 0) {
|
||||||
|
ToxWindow *toxwin = get_window_ptr(friends[f_num].chatwin);
|
||||||
|
|
||||||
|
if (toxwin != NULL) {
|
||||||
|
kill_chat_window(toxwin);
|
||||||
|
set_active_window(1); /* keep friendlist focused */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tox_del_friend(m, f_num);
|
tox_del_friend(m, f_num);
|
||||||
memset(&friends[f_num], 0, sizeof(ToxicFriend));
|
memset(&friends[f_num], 0, sizeof(ToxicFriend));
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = max_friends_index; i > 0; --i) {
|
for (i = max_friends_index; i > 0; --i) {
|
||||||
if (friends[i - 1].active)
|
if (friends[i - 1].active)
|
||||||
break;
|
break;
|
||||||
|
@ -480,6 +480,17 @@ void refresh_inactive_windows(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns a pointer to the ToxWindow in the ith index. Returns NULL if no ToxWindow exists */
|
||||||
|
ToxWindow *get_window_ptr(int i)
|
||||||
|
{
|
||||||
|
ToxWindow *toxwin = NULL;
|
||||||
|
|
||||||
|
if (windows[i].active)
|
||||||
|
toxwin = &windows[i];
|
||||||
|
|
||||||
|
return toxwin;
|
||||||
|
}
|
||||||
|
|
||||||
int get_num_active_windows(void)
|
int get_num_active_windows(void)
|
||||||
{
|
{
|
||||||
return num_active_windows;
|
return num_active_windows;
|
||||||
|
@ -225,6 +225,7 @@ void set_active_window(int ch);
|
|||||||
int get_num_active_windows(void);
|
int get_num_active_windows(void);
|
||||||
void kill_all_windows(void); /* should only be called on shutdown */
|
void kill_all_windows(void); /* should only be called on shutdown */
|
||||||
void on_window_resize(void);
|
void on_window_resize(void);
|
||||||
|
ToxWindow *get_window_ptr(int i);
|
||||||
|
|
||||||
/* refresh inactive windows to prevent scrolling bugs.
|
/* refresh inactive windows to prevent scrolling bugs.
|
||||||
call at least once per second */
|
call at least once per second */
|
||||||
|
Loading…
Reference in New Issue
Block a user