mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Messages not lost when run out of windows
Incoming messages are shown in the console when all windows are full
This commit is contained in:
parent
a20c0569a6
commit
66d3e6ee02
@ -144,7 +144,7 @@ status_bar_active(const int win)
|
|||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
|
|
||||||
wattron(status_bar, COLOUR_STATUS_ACTIVE);
|
wattron(status_bar, COLOUR_STATUS_ACTIVE);
|
||||||
if (win < 10)
|
if (win+1 < 10)
|
||||||
mvwprintw(status_bar, 0, cols - 31 + active_pos, "%d", win+1);
|
mvwprintw(status_bar, 0, cols - 31 + active_pos, "%d", win+1);
|
||||||
else
|
else
|
||||||
mvwprintw(status_bar, 0, cols - 31 + active_pos, "0");
|
mvwprintw(status_bar, 0, cols - 31 + active_pos, "0");
|
||||||
@ -165,7 +165,7 @@ status_bar_new(const int win)
|
|||||||
|
|
||||||
wattron(status_bar, COLOUR_STATUS_NEW);
|
wattron(status_bar, COLOUR_STATUS_NEW);
|
||||||
wattron(status_bar, A_BLINK);
|
wattron(status_bar, A_BLINK);
|
||||||
if (win < 10)
|
if (win+1 < 10)
|
||||||
mvwprintw(status_bar, 0, cols - 31 + active_pos, "%d", win+1);
|
mvwprintw(status_bar, 0, cols - 31 + active_pos, "%d", win+1);
|
||||||
else
|
else
|
||||||
mvwprintw(status_bar, 0, cols - 31 + active_pos, "0");
|
mvwprintw(status_bar, 0, cols - 31 + active_pos, "0");
|
||||||
|
@ -377,6 +377,41 @@ win_show_incomming_msg(const char * const from, const char * const message,
|
|||||||
if (win_index == NUM_WINS)
|
if (win_index == NUM_WINS)
|
||||||
win_index = _new_prof_win(from, win_type);
|
win_index = _new_prof_win(from, win_type);
|
||||||
|
|
||||||
|
// no spare windows left
|
||||||
|
if (win_index == 0) {
|
||||||
|
if (tv_stamp == NULL) {
|
||||||
|
_win_show_time(console->win);
|
||||||
|
} else {
|
||||||
|
GDateTime *time = g_date_time_new_from_timeval_utc(tv_stamp);
|
||||||
|
gchar *date_fmt = g_date_time_format(time, "%H:%M:%S");
|
||||||
|
wattron(console->win, COLOUR_TIME);
|
||||||
|
wprintw(console->win, "%s - ", date_fmt);
|
||||||
|
wattroff(console->win, COLOUR_TIME);
|
||||||
|
g_date_time_unref(time);
|
||||||
|
g_free(date_fmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(message, "/me ", 4) == 0) {
|
||||||
|
wattron(console->win, COLOUR_THEM);
|
||||||
|
wprintw(console->win, "*%s ", from);
|
||||||
|
wprintw(console->win, message + 4);
|
||||||
|
wprintw(console->win, "\n");
|
||||||
|
wattroff(console->win, COLOUR_THEM);
|
||||||
|
} else {
|
||||||
|
_win_show_user(console->win, from, 1);
|
||||||
|
_win_show_message(console->win, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
cons_bad_show("Windows all used, close a window to respond.");
|
||||||
|
|
||||||
|
if (current_index == 0) {
|
||||||
|
dirty = TRUE;
|
||||||
|
} else {
|
||||||
|
status_bar_new(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// window found or created
|
||||||
|
} else {
|
||||||
WINDOW *win = windows[win_index]->win;
|
WINDOW *win = windows[win_index]->win;
|
||||||
|
|
||||||
// currently viewing chat window with sender
|
// currently viewing chat window with sender
|
||||||
@ -443,6 +478,7 @@ win_show_incomming_msg(const char * const from, const char * const message,
|
|||||||
_win_show_message(win, message);
|
_win_show_message(win, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (prefs_get_beep())
|
if (prefs_get_beep())
|
||||||
beep();
|
beep();
|
||||||
@ -1497,10 +1533,13 @@ _new_prof_win(const char * const contact, win_type_t type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i != NUM_WINS) {
|
||||||
int cols = getmaxx(stdscr);
|
int cols = getmaxx(stdscr);
|
||||||
windows[i] = window_create(contact, cols, type);
|
windows[i] = window_create(contact, cols, type);
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user