1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

New gtk features

This commit is contained in:
Sebastien Helleu
2003-10-13 21:51:34 +00:00
parent ecd92ae24d
commit 13716a5228
12 changed files with 464 additions and 522 deletions
+2 -1
View File
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
Features
--------
* IRC chat client with multi-server connection
* many GUI (curses, text, Gtk, QT) (1)
* many GUI (curses, Gtk, QT) (1)
* small, fast and very light
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
* compliant with RFC 1459,2810,2811,2812,2813
* developed from scratch (not based on any other IRC client, except for look ;)
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
* 100% GPL & free
+22 -7
View File
@@ -1041,7 +1041,7 @@ gui_switch_to_window (t_gui_window *window)
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
@@ -1055,6 +1055,7 @@ gui_switch_to_window (t_gui_window *window)
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
@@ -1115,6 +1116,7 @@ gui_switch_to_window (t_gui_window *window)
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -1229,6 +1231,20 @@ gui_curses_resize_handler ()
}
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->win_title = NULL;
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_input = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -1348,7 +1364,7 @@ gui_init ()
gui_init_colors ();
/* create windows */
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1507,11 +1523,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
wrefresh (window->win_chat);
+89 -134
View File
@@ -63,6 +63,15 @@ char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
int color_attr[NUM_COLORS];
GtkWidget *gtk_main_window;
GtkWidget *vbox1;
GtkWidget *entry_topic;
GtkWidget *notebook1;
GtkWidget *vbox2;
GtkWidget *hbox1;
GtkWidget *scrolledwindow_chat;
GtkWidget *scrolledwindow_nick;
GtkWidget *entry_input;
GtkWidget *label1;
/*
@@ -277,46 +286,11 @@ gui_redraw_window_chat (t_gui_window *window)
void
gui_draw_window_nick (t_gui_window *window)
{
int i, x, y, column, max_length;
char format[32];
t_irc_nick *ptr_nick;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
if (CHANNEL(window) && CHANNEL(window)->nicks)
{
max_length = nick_get_max_length (CHANNEL(window));
if ((window == gui_current_window) &&
((max_length + 2) != window->win_nick_width))
{
/* TODO: auto resize nicklist and chat windows */
}
sprintf (format, "%%-%ds", max_length);
switch (cfg_look_nicklist_position)
{
case CFG_LOOK_NICKLIST_LEFT:
/* TODO: init nicklist (left) */
break;
case CFG_LOOK_NICKLIST_RIGHT:
/* TODO: init nicklist (right) */
break;
case CFG_LOOK_NICKLIST_TOP:
/* TODO: init nicklist (top) */
break;
case CFG_LOOK_NICKLIST_BOTTOM:
/* TODO: init nicklist (bottom) */
break;
}
/* TODO: draw nicklist! */
(void) i;
(void) x;
(void) y;
(void) column;
(void) ptr_nick;
}
/* TODO: display nicklist for Gtk GUI */
}
/*
@@ -405,7 +379,7 @@ gui_redraw_window (t_gui_window *window)
gui_redraw_window_title (window);
gui_redraw_window_chat (window);
if (window->win_nick)
if (WIN_HAS_NICKLIST(window))
gui_redraw_window_nick (window);
gui_redraw_window_status (window);
gui_redraw_window_input (window);
@@ -418,56 +392,54 @@ gui_redraw_window (t_gui_window *window)
void
gui_switch_to_window (t_gui_window *window)
{
int another_window;
t_gui_window *ptr_win;
GtkTextIter start, end;
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
window->win_title = ptr_win->win_title;
window->win_chat = ptr_win->win_chat;
window->win_nick = ptr_win->win_nick;
window->win_status = ptr_win->win_status;
window->win_input = ptr_win->win_input;
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
gui_calculate_pos_size (window);
/* first time creation for windows */
if (!another_window)
if (!window->textview_chat)
{
/* create new windows */
/* TODO: create title, chat, nick, status and input windows */
window->textview_chat = gtk_text_view_new ();
gtk_widget_show (window->textview_chat);
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), window->textview_chat);
gtk_widget_set_size_request (window->textview_chat, 300, -1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_chat), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_chat), FALSE);
window->textbuffer_chat = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_chat), window->textbuffer_chat);
window->texttag_chat = gtk_text_buffer_create_tag(window->textbuffer_chat, "courier", "font_family", "lucida");
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
}
else
if (WIN_IS_CHANNEL (window) && !window->textbuffer_nicklist)
{
/* create chat & nick windows */
if (WIN_IS_CHANNEL(window))
{
/* (re)create nicklist window */
/* TODO: delete nick/chat windows and create them */
}
if (!(WIN_IS_CHANNEL(window)))
{
/* remove nick list window */
/* TODO: remove nicklist window and create full chat window */
}
window->textview_nicklist = gtk_text_view_new ();
gtk_widget_show (window->textview_nicklist);
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), window->textview_nicklist);
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
window->textbuffer_nicklist = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_nicklist), window->textbuffer_nicklist);
}
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -551,6 +523,20 @@ gui_gtk_resize_handler ()
/* TODO: write resize handler for Gtk */
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->textview_chat = NULL;
window->textbuffer_chat = NULL;
window->texttag_chat = NULL;
window->textview_nicklist = NULL;
window->textbuffer_nicklist = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -568,18 +554,6 @@ gui_init_colors ()
void
gui_init ()
{
GtkWidget *vbox1;
GtkWidget *entry_topic;
GtkWidget *notebook1;
GtkWidget *vbox2;
GtkWidget *hbox1;
GtkWidget *scrolledwindow_chat;
GtkWidget *textview_chat;
GtkWidget *scrolledwindow_nick;
GtkWidget *textview_nick;
GtkWidget *entry_input;
GtkWidget *label1;
gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (gtk_main_window), WEECHAT_NAME_AND_VERSION);
@@ -609,24 +583,11 @@ gui_init ()
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_chat, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_chat), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
textview_chat = gtk_text_view_new ();
gtk_widget_show (textview_chat);
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), textview_chat);
gtk_widget_set_size_request (textview_chat, 300, -1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_chat), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview_chat), FALSE);
scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow_nick);
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_nick, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_nick), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
textview_nick = gtk_text_view_new ();
gtk_widget_show (textview_nick);
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), textview_nick);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_nick), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview_nick), FALSE);
entry_input = gtk_entry_new ();
gtk_widget_show (entry_input);
gtk_box_pack_start (GTK_BOX (vbox2), entry_input, FALSE, FALSE, 0);
@@ -638,8 +599,11 @@ gui_init ()
gtk_widget_show_all (gtk_main_window);
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
/* TODO: set gui_ready to 1 when Gtk display functions will be ok */
gui_ready = 0;
gui_ready = 1;
}
/*
@@ -668,50 +632,28 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
{
char *pos;
int length;
GtkTextIter start, end;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (window->line_complete)
{
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, "\n", -1);
window->line_complete = 0;
if (!gui_new_line (window))
return;
}
if (!gui_new_message (window))
return;
window->last_line->last_message->type = type;
window->last_line->last_message->color = color;
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
window->line_complete = 1;
}
window->last_line->last_message->message = strdup (message);
length = strlen (message);
window->last_line->length += length;
if (type == MSG_TYPE_MSG)
window->last_line->line_with_message = 1;
if ((type == MSG_TYPE_TIME) || (type == MSG_TYPE_NICK))
window->last_line->length_align += length;
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, message, -1);
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
if (pos)
{
pos[0] = '\n';
if ((window == gui_current_window) && (window->sub_lines == 0))
{
if ((window->win_chat_cursor_y
+ gui_get_line_num_splits (window, window->last_line)) >
(window->win_chat_height - 1))
gui_draw_window_chat (window);
else
gui_display_line (window, window->last_line, 1);
}
if ((window != gui_current_window) || (window->sub_lines > 0))
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
}
}
}
/*
@@ -727,12 +669,26 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
/* make gcc hapy */
(void) window;
(void) type;
(void) color;
(void) message;
if (gui_ready)
{
if (color == -1)
color = COLOR_WIN_CHAT;
if (window == NULL)
{
if (SERVER(gui_current_window))
window = SERVER(gui_current_window)->window;
else
window = gui_current_window;
}
if (window == NULL)
{
log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
return;
}
}
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
@@ -747,7 +703,7 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
while (pos)
{
/* TODO: read timestamp format from config! */
if ((!window->last_line) || (window->line_complete))
if (window->line_complete)
{
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
sprintf (timestamp, "%02d", date_tmp->tm_hour);
@@ -760,11 +716,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
}
else
+88 -90
View File
@@ -43,6 +43,94 @@ t_gui_window *last_gui_window = NULL; /* pointer to last window */
t_gui_window *gui_current_window = NULL; /* pointer to current window */
/*
* gui_window_new: create a new window
* (TODO: add coordinates and size, for splited windows)
*/
t_gui_window *
gui_window_new (void *server, void *channel
/*int x, int y, int width, int height*/)
{
t_gui_window *new_window;
if (gui_windows)
{
/* use first window if no server was assigned to this window */
if (!SERVER(gui_windows))
{
if (server)
((t_irc_server *)(server))->window = gui_windows;
if (channel)
((t_irc_channel *)(channel))->window = gui_windows;
SERVER(gui_windows) = server;
CHANNEL(gui_windows) = channel;
return gui_windows;
}
}
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
{
new_window->is_displayed = 0;
/* assign server and channel to window */
SERVER(new_window) = server;
CHANNEL(new_window) = channel;
/* assign window to server and channel */
if (server && !channel)
SERVER(new_window)->window = new_window;
if (channel)
CHANNEL(new_window)->window = new_window;
gui_calculate_pos_size (new_window);
/* init windows */
gui_window_init_subwindows(new_window);
/* init lines */
new_window->lines = NULL;
new_window->last_line = NULL;
new_window->first_line_displayed = 1;
new_window->sub_lines = 0;
new_window->line_complete = 1;
new_window->unread_data = 0;
/* init input buffer */
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
new_window->input_buffer[0] = '\0';
new_window->input_buffer_size = 0;
new_window->input_buffer_pos = 0;
new_window->input_buffer_1st_display = 0;
/* init completion */
completion_init (&(new_window->completion));
/* init history */
new_window->history = NULL;
new_window->ptr_history = NULL;
/* switch to new window */
gui_switch_to_window (new_window);
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
last_gui_window->next_window = new_window;
else
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
/* redraw whole screen */
gui_redraw_window (new_window);
}
else
return NULL;
return new_window;
}
/*
* gui_window_clear: clear window content
*/
@@ -92,96 +180,6 @@ gui_window_clear_all ()
gui_window_clear (ptr_win);
}
/*
* gui_window_new: create a new window
* (TODO: add coordinates and size, for splited windows)
*/
t_gui_window *
gui_window_new (void *server, void *channel
/*int x, int y, int width, int height*/)
{
t_gui_window *new_window;
if (gui_windows)
{
/* use first window if no server was assigned to this window */
if (!SERVER(gui_windows))
{
if (server)
((t_irc_server *)(server))->window = gui_windows;
if (channel)
((t_irc_channel *)(channel))->window = gui_windows;
SERVER(gui_windows) = server;
CHANNEL(gui_windows) = channel;
return gui_windows;
}
}
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
{
/* assign server and channel to window */
SERVER(new_window) = server;
CHANNEL(new_window) = channel;
/* assign window to server and channel */
if (server && !channel)
SERVER(new_window)->window = new_window;
if (channel)
CHANNEL(new_window)->window = new_window;
gui_calculate_pos_size (new_window);
/* init windows */
new_window->win_title = NULL;
new_window->win_chat = NULL;
new_window->win_nick = NULL;
new_window->win_status = NULL;
new_window->win_input = NULL;
/* init lines */
new_window->lines = NULL;
new_window->last_line = NULL;
new_window->first_line_displayed = 1;
new_window->sub_lines = 0;
new_window->line_complete = 1;
new_window->unread_data = 0;
/* init input buffer */
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
new_window->input_buffer[0] = '\0';
new_window->input_buffer_size = 0;
new_window->input_buffer_pos = 0;
new_window->input_buffer_1st_display = 0;
/* init completion */
completion_init (&(new_window->completion));
/* init history */
new_window->history = NULL;
new_window->ptr_history = NULL;
/* switch to new window */
gui_switch_to_window (new_window);
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
last_gui_window->next_window = new_window;
else
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
/* redraw whole screen */
gui_redraw_window (new_window);
}
else
return NULL;
return new_window;
}
/*
* gui_window_free: delete a window
*/
+28 -26
View File
@@ -76,6 +76,13 @@
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
#ifdef WEE_CURSES
#define WIN_HAS_NICKLIST(window) (window->win_nick)
#endif
#ifdef WEE_GTK
#define WIN_HAS_NICKLIST(window) (window->textbuffer_nicklist)
#endif
#define MSG_TYPE_TIME 0
#define MSG_TYPE_NICK 1
#define MSG_TYPE_INFO 2
@@ -123,6 +130,8 @@ typedef struct t_gui_window t_gui_window;
struct t_gui_window
{
int is_displayed; /* = 1 if window is displayed */
/* server/channel */
void *server; /* window's server */
void *channel; /* window's channel */
@@ -152,11 +161,11 @@ struct t_gui_window
WINDOW *win_input; /* input window */
#endif
#ifdef WEE_GTK
GtkWidget *win_title; /* title window */
GtkWidget *win_chat; /* chat window (exemple: channel) */
GtkWidget *win_nick; /* nick window */
GtkWidget *win_status; /* status window */
GtkWidget *win_input; /* input window */
GtkWidget *textview_chat; /* textview widget for chat */
GtkTextBuffer *textbuffer_chat; /* textbuffer widget for chat */
GtkTextTag *texttag_chat; /* texttag widget for chat */
GtkWidget *textview_nicklist; /* textview widget for nicklist */
GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */
#endif
#ifdef WEE_QT
/* TODO: declare Qt window */
@@ -198,12 +207,22 @@ extern t_gui_window *gui_current_window;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
/* GUI dependant functions */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_window_title (t_gui_window *);
extern void gui_redraw_window_title (t_gui_window *);
extern void gui_draw_window_chat (t_gui_window *);
@@ -215,34 +234,17 @@ extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
extern t_gui_window *gui_window_new (void *, void *);
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_switch_to_window (t_gui_window *);
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_init_colors ();
extern void gui_init ();
/* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
extern void gui_main_loop ();
#endif /* gui.h */
+3 -3
View File
@@ -501,7 +501,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -692,7 +692,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
gui_printf (ptr_channel->window, "\n");
/* redraw nick list if this is current window */
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -978,7 +978,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
if ((ptr_channel->window == gui_current_window) &&
(ptr_channel->window->win_nick))
(WIN_HAS_NICKLIST(ptr_channel->window)))
gui_redraw_window_nick (ptr_channel->window);
}
}
+2 -1
View File
@@ -10,10 +10,11 @@ It is customizable and extensible with scripts.
Features
--------
* IRC chat client with multi-server connection
* many GUI (curses, text, Gtk, QT) (1)
* many GUI (curses, Gtk, QT) (1)
* small, fast and very light
* customizable and extensible with scripts (Perl, Python, Ruby) (2)
* compliant with RFC 1459,2810,2811,2812,2813
* developed from scratch (not based on any other IRC client, except for look ;)
* multi-platform (GNU/Linux, *BSD, Windows & other) (3)
* 100% GPL & free
+22 -7
View File
@@ -1041,7 +1041,7 @@ gui_switch_to_window (t_gui_window *window)
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
@@ -1055,6 +1055,7 @@ gui_switch_to_window (t_gui_window *window)
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
@@ -1115,6 +1116,7 @@ gui_switch_to_window (t_gui_window *window)
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -1229,6 +1231,20 @@ gui_curses_resize_handler ()
}
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->win_title = NULL;
window->win_chat = NULL;
window->win_nick = NULL;
window->win_status = NULL;
window->win_input = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -1348,7 +1364,7 @@ gui_init ()
gui_init_colors ();
/* create windows */
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1507,11 +1523,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
wrefresh (window->win_chat);
+89 -134
View File
@@ -63,6 +63,15 @@ char *nicks_colors[COLOR_WIN_NICK_NUMBER] =
int color_attr[NUM_COLORS];
GtkWidget *gtk_main_window;
GtkWidget *vbox1;
GtkWidget *entry_topic;
GtkWidget *notebook1;
GtkWidget *vbox2;
GtkWidget *hbox1;
GtkWidget *scrolledwindow_chat;
GtkWidget *scrolledwindow_nick;
GtkWidget *entry_input;
GtkWidget *label1;
/*
@@ -277,46 +286,11 @@ gui_redraw_window_chat (t_gui_window *window)
void
gui_draw_window_nick (t_gui_window *window)
{
int i, x, y, column, max_length;
char format[32];
t_irc_nick *ptr_nick;
/* TODO: manage splitted windows! */
if (window != gui_current_window)
return;
if (CHANNEL(window) && CHANNEL(window)->nicks)
{
max_length = nick_get_max_length (CHANNEL(window));
if ((window == gui_current_window) &&
((max_length + 2) != window->win_nick_width))
{
/* TODO: auto resize nicklist and chat windows */
}
sprintf (format, "%%-%ds", max_length);
switch (cfg_look_nicklist_position)
{
case CFG_LOOK_NICKLIST_LEFT:
/* TODO: init nicklist (left) */
break;
case CFG_LOOK_NICKLIST_RIGHT:
/* TODO: init nicklist (right) */
break;
case CFG_LOOK_NICKLIST_TOP:
/* TODO: init nicklist (top) */
break;
case CFG_LOOK_NICKLIST_BOTTOM:
/* TODO: init nicklist (bottom) */
break;
}
/* TODO: draw nicklist! */
(void) i;
(void) x;
(void) y;
(void) column;
(void) ptr_nick;
}
/* TODO: display nicklist for Gtk GUI */
}
/*
@@ -405,7 +379,7 @@ gui_redraw_window (t_gui_window *window)
gui_redraw_window_title (window);
gui_redraw_window_chat (window);
if (window->win_nick)
if (WIN_HAS_NICKLIST(window))
gui_redraw_window_nick (window);
gui_redraw_window_status (window);
gui_redraw_window_input (window);
@@ -418,56 +392,54 @@ gui_redraw_window (t_gui_window *window)
void
gui_switch_to_window (t_gui_window *window)
{
int another_window;
t_gui_window *ptr_win;
GtkTextIter start, end;
another_window = 0;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->win_title)
if (ptr_win->is_displayed)
{
/* TODO: manage splitted windows */
another_window = 1;
window->win_title = ptr_win->win_title;
window->win_chat = ptr_win->win_chat;
window->win_nick = ptr_win->win_nick;
window->win_status = ptr_win->win_status;
window->win_input = ptr_win->win_input;
ptr_win->win_title = NULL;
ptr_win->win_chat = NULL;
ptr_win->win_nick = NULL;
ptr_win->win_status = NULL;
ptr_win->win_input = NULL;
ptr_win->is_displayed = 0;
break;
}
}
gui_calculate_pos_size (window);
/* first time creation for windows */
if (!another_window)
if (!window->textview_chat)
{
/* create new windows */
/* TODO: create title, chat, nick, status and input windows */
window->textview_chat = gtk_text_view_new ();
gtk_widget_show (window->textview_chat);
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), window->textview_chat);
gtk_widget_set_size_request (window->textview_chat, 300, -1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_chat), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_chat), FALSE);
window->textbuffer_chat = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_chat), window->textbuffer_chat);
window->texttag_chat = gtk_text_buffer_create_tag(window->textbuffer_chat, "courier", "font_family", "lucida");
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
}
else
if (WIN_IS_CHANNEL (window) && !window->textbuffer_nicklist)
{
/* create chat & nick windows */
if (WIN_IS_CHANNEL(window))
{
/* (re)create nicklist window */
/* TODO: delete nick/chat windows and create them */
}
if (!(WIN_IS_CHANNEL(window)))
{
/* remove nick list window */
/* TODO: remove nicklist window and create full chat window */
}
window->textview_nicklist = gtk_text_view_new ();
gtk_widget_show (window->textview_nicklist);
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), window->textview_nicklist);
gtk_text_view_set_editable (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (window->textview_nicklist), FALSE);
window->textbuffer_nicklist = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (window->textview_nicklist), window->textbuffer_nicklist);
}
/* change current window to the new window */
gui_current_window = window;
window->is_displayed = 1;
window->unread_data = 0;
}
@@ -551,6 +523,20 @@ gui_gtk_resize_handler ()
/* TODO: write resize handler for Gtk */
}
/*
* gui_window_init_subwindows: init subwindows for a WeeChat window
*/
void
gui_window_init_subwindows (t_gui_window *window)
{
window->textview_chat = NULL;
window->textbuffer_chat = NULL;
window->texttag_chat = NULL;
window->textview_nicklist = NULL;
window->textbuffer_nicklist = NULL;
}
/*
* gui_init_colors: init GUI colors
*/
@@ -568,18 +554,6 @@ gui_init_colors ()
void
gui_init ()
{
GtkWidget *vbox1;
GtkWidget *entry_topic;
GtkWidget *notebook1;
GtkWidget *vbox2;
GtkWidget *hbox1;
GtkWidget *scrolledwindow_chat;
GtkWidget *textview_chat;
GtkWidget *scrolledwindow_nick;
GtkWidget *textview_nick;
GtkWidget *entry_input;
GtkWidget *label1;
gtk_main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (gtk_main_window), WEECHAT_NAME_AND_VERSION);
@@ -609,24 +583,11 @@ gui_init ()
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_chat, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_chat), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
textview_chat = gtk_text_view_new ();
gtk_widget_show (textview_chat);
gtk_container_add (GTK_CONTAINER (scrolledwindow_chat), textview_chat);
gtk_widget_set_size_request (textview_chat, 300, -1);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_chat), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview_chat), FALSE);
scrolledwindow_nick = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolledwindow_nick);
gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow_nick, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_nick), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
textview_nick = gtk_text_view_new ();
gtk_widget_show (textview_nick);
gtk_container_add (GTK_CONTAINER (scrolledwindow_nick), textview_nick);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_nick), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview_nick), FALSE);
entry_input = gtk_entry_new ();
gtk_widget_show (entry_input);
gtk_box_pack_start (GTK_BOX (vbox2), entry_input, FALSE, FALSE, 0);
@@ -638,8 +599,11 @@ gui_init ()
gtk_widget_show_all (gtk_main_window);
/* create a new window */
gui_current_window = gui_window_new (NULL, NULL /*0, 0, COLS, LINES*/);
/* TODO: set gui_ready to 1 when Gtk display functions will be ok */
gui_ready = 0;
gui_ready = 1;
}
/*
@@ -668,50 +632,28 @@ gui_add_message (t_gui_window *window, int type, int color, char *message)
{
char *pos;
int length;
GtkTextIter start, end;
/* create new line if previous was ending by '\n' (or if 1st line) */
if (window->line_complete)
{
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, "\n", -1);
window->line_complete = 0;
if (!gui_new_line (window))
return;
}
if (!gui_new_message (window))
return;
window->last_line->last_message->type = type;
window->last_line->last_message->color = color;
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
window->line_complete = 1;
}
window->last_line->last_message->message = strdup (message);
length = strlen (message);
window->last_line->length += length;
if (type == MSG_TYPE_MSG)
window->last_line->line_with_message = 1;
if ((type == MSG_TYPE_TIME) || (type == MSG_TYPE_NICK))
window->last_line->length_align += length;
gtk_text_buffer_insert_at_cursor (window->textbuffer_chat, message, -1);
gtk_text_buffer_get_bounds (window->textbuffer_chat, &start, &end);
gtk_text_buffer_apply_tag (window->textbuffer_chat, window->texttag_chat, &start, &end);
if (pos)
{
pos[0] = '\n';
if ((window == gui_current_window) && (window->sub_lines == 0))
{
if ((window->win_chat_cursor_y
+ gui_get_line_num_splits (window, window->last_line)) >
(window->win_chat_height - 1))
gui_draw_window_chat (window);
else
gui_display_line (window, window->last_line, 1);
}
if ((window != gui_current_window) || (window->sub_lines > 0))
{
window->unread_data = 1 + window->last_line->line_with_message;
gui_redraw_window_status (gui_current_window);
}
}
}
/*
@@ -727,12 +669,26 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
/* make gcc hapy */
(void) window;
(void) type;
(void) color;
(void) message;
if (gui_ready)
{
if (color == -1)
color = COLOR_WIN_CHAT;
if (window == NULL)
{
if (SERVER(gui_current_window))
window = SERVER(gui_current_window)->window;
else
window = gui_current_window;
}
if (window == NULL)
{
log_printf ("gui_printf without window! this is a bug, please send to developers - thanks\n");
return;
}
}
va_start (argptr, message);
vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
@@ -747,7 +703,7 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
while (pos)
{
/* TODO: read timestamp format from config! */
if ((!window->last_line) || (window->line_complete))
if (window->line_complete)
{
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
sprintf (timestamp, "%02d", date_tmp->tm_hour);
@@ -760,11 +716,10 @@ gui_printf_color_type (t_gui_window *window, int type, int color, char *message,
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
gui_add_message (window, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
gui_add_message (window, type, color, pos+1);
pos = strchr (pos+1, '\n');
if (pos)
if (pos[1] == '\0')
pos = NULL;
gui_add_message (window, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
}
else
+88 -90
View File
@@ -43,6 +43,94 @@ t_gui_window *last_gui_window = NULL; /* pointer to last window */
t_gui_window *gui_current_window = NULL; /* pointer to current window */
/*
* gui_window_new: create a new window
* (TODO: add coordinates and size, for splited windows)
*/
t_gui_window *
gui_window_new (void *server, void *channel
/*int x, int y, int width, int height*/)
{
t_gui_window *new_window;
if (gui_windows)
{
/* use first window if no server was assigned to this window */
if (!SERVER(gui_windows))
{
if (server)
((t_irc_server *)(server))->window = gui_windows;
if (channel)
((t_irc_channel *)(channel))->window = gui_windows;
SERVER(gui_windows) = server;
CHANNEL(gui_windows) = channel;
return gui_windows;
}
}
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
{
new_window->is_displayed = 0;
/* assign server and channel to window */
SERVER(new_window) = server;
CHANNEL(new_window) = channel;
/* assign window to server and channel */
if (server && !channel)
SERVER(new_window)->window = new_window;
if (channel)
CHANNEL(new_window)->window = new_window;
gui_calculate_pos_size (new_window);
/* init windows */
gui_window_init_subwindows(new_window);
/* init lines */
new_window->lines = NULL;
new_window->last_line = NULL;
new_window->first_line_displayed = 1;
new_window->sub_lines = 0;
new_window->line_complete = 1;
new_window->unread_data = 0;
/* init input buffer */
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
new_window->input_buffer[0] = '\0';
new_window->input_buffer_size = 0;
new_window->input_buffer_pos = 0;
new_window->input_buffer_1st_display = 0;
/* init completion */
completion_init (&(new_window->completion));
/* init history */
new_window->history = NULL;
new_window->ptr_history = NULL;
/* switch to new window */
gui_switch_to_window (new_window);
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
last_gui_window->next_window = new_window;
else
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
/* redraw whole screen */
gui_redraw_window (new_window);
}
else
return NULL;
return new_window;
}
/*
* gui_window_clear: clear window content
*/
@@ -92,96 +180,6 @@ gui_window_clear_all ()
gui_window_clear (ptr_win);
}
/*
* gui_window_new: create a new window
* (TODO: add coordinates and size, for splited windows)
*/
t_gui_window *
gui_window_new (void *server, void *channel
/*int x, int y, int width, int height*/)
{
t_gui_window *new_window;
if (gui_windows)
{
/* use first window if no server was assigned to this window */
if (!SERVER(gui_windows))
{
if (server)
((t_irc_server *)(server))->window = gui_windows;
if (channel)
((t_irc_channel *)(channel))->window = gui_windows;
SERVER(gui_windows) = server;
CHANNEL(gui_windows) = channel;
return gui_windows;
}
}
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
{
/* assign server and channel to window */
SERVER(new_window) = server;
CHANNEL(new_window) = channel;
/* assign window to server and channel */
if (server && !channel)
SERVER(new_window)->window = new_window;
if (channel)
CHANNEL(new_window)->window = new_window;
gui_calculate_pos_size (new_window);
/* init windows */
new_window->win_title = NULL;
new_window->win_chat = NULL;
new_window->win_nick = NULL;
new_window->win_status = NULL;
new_window->win_input = NULL;
/* init lines */
new_window->lines = NULL;
new_window->last_line = NULL;
new_window->first_line_displayed = 1;
new_window->sub_lines = 0;
new_window->line_complete = 1;
new_window->unread_data = 0;
/* init input buffer */
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
new_window->input_buffer[0] = '\0';
new_window->input_buffer_size = 0;
new_window->input_buffer_pos = 0;
new_window->input_buffer_1st_display = 0;
/* init completion */
completion_init (&(new_window->completion));
/* init history */
new_window->history = NULL;
new_window->ptr_history = NULL;
/* switch to new window */
gui_switch_to_window (new_window);
/* add window to windows queue */
new_window->prev_window = last_gui_window;
if (gui_windows)
last_gui_window->next_window = new_window;
else
gui_windows = new_window;
last_gui_window = new_window;
new_window->next_window = NULL;
/* redraw whole screen */
gui_redraw_window (new_window);
}
else
return NULL;
return new_window;
}
/*
* gui_window_free: delete a window
*/
+28 -26
View File
@@ -76,6 +76,13 @@
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
#ifdef WEE_CURSES
#define WIN_HAS_NICKLIST(window) (window->win_nick)
#endif
#ifdef WEE_GTK
#define WIN_HAS_NICKLIST(window) (window->textbuffer_nicklist)
#endif
#define MSG_TYPE_TIME 0
#define MSG_TYPE_NICK 1
#define MSG_TYPE_INFO 2
@@ -123,6 +130,8 @@ typedef struct t_gui_window t_gui_window;
struct t_gui_window
{
int is_displayed; /* = 1 if window is displayed */
/* server/channel */
void *server; /* window's server */
void *channel; /* window's channel */
@@ -152,11 +161,11 @@ struct t_gui_window
WINDOW *win_input; /* input window */
#endif
#ifdef WEE_GTK
GtkWidget *win_title; /* title window */
GtkWidget *win_chat; /* chat window (exemple: channel) */
GtkWidget *win_nick; /* nick window */
GtkWidget *win_status; /* status window */
GtkWidget *win_input; /* input window */
GtkWidget *textview_chat; /* textview widget for chat */
GtkTextBuffer *textbuffer_chat; /* textbuffer widget for chat */
GtkTextTag *texttag_chat; /* texttag widget for chat */
GtkWidget *textview_nicklist; /* textview widget for nicklist */
GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */
#endif
#ifdef WEE_QT
/* TODO: declare Qt window */
@@ -198,12 +207,22 @@ extern t_gui_window *gui_current_window;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/); /* TODO: add coordinates and size */
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
/* GUI dependant functions */
extern int gui_assign_color (int *, char *);
extern int gui_get_color_by_name (char *);
extern char *gui_get_color_by_value (int);
extern void gui_calculate_pos_size (t_gui_window *);
extern void gui_draw_window_title (t_gui_window *);
extern void gui_redraw_window_title (t_gui_window *);
extern void gui_draw_window_chat (t_gui_window *);
@@ -215,34 +234,17 @@ extern void gui_redraw_window_status (t_gui_window *);
extern void gui_draw_window_input (t_gui_window *);
extern void gui_redraw_window_input (t_gui_window *);
extern void gui_redraw_window (t_gui_window *);
extern t_gui_window *gui_window_new (void *, void *);
extern void gui_window_clear (t_gui_window *);
extern void gui_window_clear_all ();
extern void gui_switch_to_window (t_gui_window *);
extern void gui_switch_to_previous_window ();
extern void gui_switch_to_next_window ();
extern void gui_move_page_up ();
extern void gui_move_page_down ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_init_colors ();
extern void gui_init ();
/* TODO: add coordinates and size */
extern t_gui_window *gui_window_new (void *, void * /*int, int, int, int*/);
extern void gui_window_free (t_gui_window *);
extern void gui_end ();
extern t_gui_line *gui_new_line (t_gui_window *);
extern t_gui_message *gui_new_message (t_gui_window *);
extern void gui_printf_color_type (t_gui_window *, int, int, char *, ...);
extern void gui_optimize_input_buffer_size (t_gui_window *);
extern void gui_delete_previous_word ();
extern void gui_move_previous_word ();
extern void gui_move_next_word ();
extern void gui_buffer_insert_string (char *, int);
extern void gui_main_loop ();
#endif /* gui.h */
+3 -3
View File
@@ -501,7 +501,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -692,7 +692,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
gui_printf (ptr_channel->window, "\n");
/* redraw nick list if this is current window */
if (ptr_channel->window->win_nick)
if (WIN_HAS_NICKLIST(ptr_channel->window))
gui_redraw_window_nick (ptr_channel->window);
}
}
@@ -978,7 +978,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
gui_printf_color (ptr_channel->window,
COLOR_WIN_CHAT_DARK, ")\n");
if ((ptr_channel->window == gui_current_window) &&
(ptr_channel->window->win_nick))
(WIN_HAS_NICKLIST(ptr_channel->window)))
gui_redraw_window_nick (ptr_channel->window);
}
}