* old version of the SILC client dating back to 1997.
*/
/* XXX: Input line handling is really buggy! */
-/*
- * $Id$
- * $Log$
- * Revision 1.1 2000/06/27 11:36:56 priikone
- * Initial revision
- *
- *
- */
+/* $Id$ */
#include "clientincludes.h"
{
SilcScreen new;
- new = silc_malloc(sizeof(*new));
- if (new == NULL) {
- SILC_LOG_ERROR(("Could not create new screen object"));
- return NULL;
- }
-
- new->output_win_count = 0;
- new->input_pos = 0;
- new->cursor_pos = 0;
- new->virtual_window = 0;
+ new = silc_calloc(1, sizeof(*new));
new->insert = TRUE;
initscr();
{
assert(screen != NULL);
- screen->output_win = silc_malloc(sizeof(*screen->output_win) * 1);
+ screen->output_win = silc_calloc(1, sizeof(*screen->output_win));
screen->output_win_count = 1;
screen->output_win[0] = newwin(LINES - 3, COLS, 1, 0);
scrollok(screen->output_win[0], TRUE);
void silc_screen_init_upper_status_line(SilcScreen screen)
{
- int i;
- int justify;
-
assert(screen != NULL);
/* Create upper status line */
screen->upper_stat_line = newwin(0, COLS, 0, 0);
scrollok(screen->upper_stat_line, FALSE);
wattrset(screen->upper_stat_line, A_REVERSE);
+
+ silc_screen_print_upper_stat_line(screen);
+}
+
+void silc_screen_print_upper_stat_line(SilcScreen screen)
+{
+ int i;
+ int justify;
/* Print empty line */
for (i = 0; i < COLS - 1; i++)
mvwprintw(screen->upper_stat_line, 0, 1, "%s %s",
screen->u_stat_line.program_name,
screen->u_stat_line.program_version);
- /*
- mvwprintw(screen->upper_stat_line, 0, justify, "[Your Connection: %s]",
- stat.uconnect_status[stat.uconnect]);
- mvwprintw(screen->upper_stat_line, 0,
- (justify + justify + justify), "[SILC: %s]",
- stat.silc_status[stat.silc]);
- */
/* Prints clock on upper stat line */
silc_screen_print_clock(screen);
SILC_SCREEN_MAX_CHANNEL_LEN : len);
}
+ if (line->channel_mode) {
+ len = strlen(line->channel_mode);
+ strncat(buf, " (+", 3);
+ strncat(buf, line->channel_mode, len > SILC_SCREEN_MAX_CHANNEL_LEN ?
+ SILC_SCREEN_MAX_CHANNEL_LEN : len);
+ strncat(buf, ")", 2);
+ }
+
+ if (line->umode) {
+ len = strlen(line->umode);
+ strncat(buf, " [", 2);
+ strncat(buf, line->umode, len > SILC_SCREEN_MAX_UMODE_LEN ?
+ SILC_SCREEN_MAX_UMODE_LEN : len);
+ strncat(buf, "]", 2);
+ }
+
+ if (line->away)
+ strncat(buf, " (away)", 8);
+
wattrset(screen->output_stat_line[win_index], A_REVERSE);
for (i = 0; i < COLS - 10; i++)
assert(screen != NULL);
- redrawwin(screen->upper_stat_line);
+ wclear(screen->upper_stat_line);
+ silc_screen_print_upper_stat_line(screen);
+
+ wclear(screen->output_stat_line[0]);
+ silc_screen_print_bottom_line(screen, 0);
+ silc_screen_print_coordinates(screen, 0);
for (i = 0; i < screen->output_win_count; i++) {
+ wclear(screen->output_win[i]);
wrefresh(screen->output_win[i]);
- redrawwin(screen->output_win[i]);
}
+ wclear(screen->input_win);
wrefresh(screen->input_win);
- redrawwin(screen->input_win);
}
/* Refreshes a window */
screen->virtual_window--;
waddnstr(win, &buffer[screen->virtual_window * (COLS - 5)], COLS);
- screen->input_pos = ((screen->virtual_window + 1) * (COLS - 5)) + 1;
- screen->input_end = ((screen->virtual_window + 1) * (COLS - 5)) + 1;
- screen->cursor_pos = (COLS - 5) + 1;
+ screen->input_pos = ((screen->virtual_window + 1) * (COLS - 5));
+ screen->input_end = ((screen->virtual_window + 1) * (COLS - 5));
+ screen->cursor_pos = (COLS - 5);
wrefresh(win);
}
}
screen->virtual_window--;
waddnstr(win, &buffer[screen->virtual_window * (COLS - 5)], COLS);
- screen->input_pos = ((screen->virtual_window + 1) * (COLS - 5)) + 1;
- screen->cursor_pos = (COLS - 5) + 1;
+ screen->input_pos = ((screen->virtual_window + 1) * (COLS - 5));
+ screen->cursor_pos = (COLS - 5);
wrefresh(win);
}
}