summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/command.c4
-rw-r--r--src/gui/curses/gui-display.c145
-rw-r--r--src/gui/curses/gui-input.c380
-rw-r--r--src/gui/gui-common.c29
-rw-r--r--src/gui/gui.h7
-rw-r--r--src/irc/irc-channel.c2
-rw-r--r--src/irc/irc-server.c2
-rw-r--r--weechat/src/common/command.c4
-rw-r--r--weechat/src/gui/curses/gui-display.c145
-rw-r--r--weechat/src/gui/curses/gui-input.c380
-rw-r--r--weechat/src/gui/gui-common.c29
-rw-r--r--weechat/src/gui/gui.h7
-rw-r--r--weechat/src/irc/irc-channel.c2
-rw-r--r--weechat/src/irc/irc-server.c2
14 files changed, 660 insertions, 478 deletions
diff --git a/src/common/command.c b/src/common/command.c
index d934e8ca5..a5abbb0d8 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -917,7 +917,7 @@ weechat_cmd_connect (int argc, char **argv)
}
if (!ptr_server->buffer)
{
- if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
+ if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1))
return -1;
}
if (server_connect (ptr_server))
@@ -1499,7 +1499,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
- (void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);
if (server_connect (new_server))
irc_login (new_server);
}
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 7885e7bf4..9ee926f71 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -325,12 +325,15 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
}
else
{
- /* TODO: change this copyright as title? */
- mvwprintw (ptr_win->win_title, 0, 0,
- "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
- mvwprintw (ptr_win->win_title, 0,
- ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
- "%s", WEECHAT_COPYRIGHT);
+ if (!buffer->dcc)
+ {
+ /* TODO: change this copyright as title? */
+ mvwprintw (ptr_win->win_title, 0, 0,
+ "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
+ mvwprintw (ptr_win->win_title, 0,
+ ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
+ "%s", WEECHAT_COPYRIGHT);
+ }
}
wrefresh (ptr_win->win_title);
refresh ();
@@ -572,49 +575,60 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
if (has_colors ())
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
- ptr_line = buffer->last_line;
- lines_used = 0;
- while (ptr_line
- && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
- {
- lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
- ptr_line = ptr_line->prev_line;
- }
- ptr_win->win_chat_cursor_x = 0;
- ptr_win->win_chat_cursor_y = 0;
- if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
+ if (buffer->dcc)
{
- /* screen will be full (we'll display only end of 1st line) */
- ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
- gui_display_end_of_line (ptr_win, ptr_line,
- gui_get_line_num_splits (ptr_win, ptr_line) -
- (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
- ptr_line = ptr_line->next_line;
- ptr_win->first_line_displayed = 0;
+ mvwprintw (ptr_win->win_chat, ptr_win->win_y, ptr_win->win_x,
+ "%s", _(" Type Status Filename / progress"));
+ for (i = 0; i < ptr_win->win_width; i++)
+ mvwprintw (ptr_win->win_chat, 1, i, "%c", '-');
+ move (ptr_win->win_y + 3, ptr_win->win_x);
}
else
{
- /* all lines are displayed */
- if (!ptr_line)
+ ptr_line = buffer->last_line;
+ lines_used = 0;
+ while (ptr_line
+ && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
{
- ptr_win->first_line_displayed = 1;
- ptr_line = buffer->lines;
+ lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
+ ptr_line = ptr_line->prev_line;
}
- else
+ ptr_win->win_chat_cursor_x = 0;
+ ptr_win->win_chat_cursor_y = 0;
+ if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
{
+ /* screen will be full (we'll display only end of 1st line) */
+ ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
+ gui_display_end_of_line (ptr_win, ptr_line,
+ gui_get_line_num_splits (ptr_win, ptr_line) -
+ (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
+ ptr_line = ptr_line->next_line;
ptr_win->first_line_displayed = 0;
+ }
+ else
+ {
+ /* all lines are displayed */
+ if (!ptr_line)
+ {
+ ptr_win->first_line_displayed = 1;
+ ptr_line = buffer->lines;
+ }
+ else
+ {
+ ptr_win->first_line_displayed = 0;
+ ptr_line = ptr_line->next_line;
+ }
+ }
+ while (ptr_line)
+ {
+ if (!gui_display_line (ptr_win, ptr_line, 1))
+ break;
+
ptr_line = ptr_line->next_line;
}
+ /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
+ buffer->sub_lines = 0;*/
}
- while (ptr_line)
- {
- if (!gui_display_line (ptr_win, ptr_line, 1))
- break;
-
- ptr_line = ptr_line->next_line;
- }
- /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
- buffer->sub_lines = 0;*/
wrefresh (ptr_win->win_chat);
refresh ();
}
@@ -893,8 +907,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
if (!SERVER(ptr_win->buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
- wprintw (ptr_win->win_status, _("%d:[not connected] "),
- ptr_win->buffer->number);
+ if (ptr_win->buffer->dcc)
+ wprintw (ptr_win->win_status, _("%d:<DCC> "),
+ ptr_win->buffer->number);
+ else
+ wprintw (ptr_win->win_status, _("%d:[not connected] "),
+ ptr_win->buffer->number);
}
/* display list of other active windows (if any) with numbers */
@@ -1089,26 +1107,11 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
}
else
{
- if (SERVER(buffer))
+ if (buffer->dcc)
{
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(buffer) && (SERVER(buffer)->is_connected))
- ptr_nickname = SERVER(buffer)->nick;
- else
- ptr_nickname = cfg_look_no_nickname;
- if (ptr_win == gui_current_window)
- mvwprintw (ptr_win->win_input, 0, 0, format,
- ptr_nickname,
- buffer->input_buffer + buffer->input_buffer_1st_display);
- else
- mvwprintw (ptr_win->win_input, 0, 0, format,
- ptr_nickname,
- "");
+ snprintf (format, 32, "%%-%ds", input_width);
+ mvwprintw (ptr_win->win_input, 0, 0, format, "");
wclrtoeol (ptr_win->win_input);
- if (ptr_win == gui_current_window)
- move (ptr_win->win_y + ptr_win->win_height - 1,
- ptr_win->win_x + strlen (ptr_nickname) + 2 +
- (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
}
else
{
@@ -1254,6 +1257,30 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
}
/*
+ * gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
+ */
+
+void
+gui_switch_to_dcc_buffer ()
+{
+ t_gui_buffer *ptr_buffer;
+
+ /* check if dcc buffer exists */
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (BUFFER_IS_DCC (ptr_buffer))
+ break;
+ }
+ if (ptr_buffer)
+ {
+ gui_switch_to_buffer (gui_current_window, ptr_buffer);
+ gui_redraw_buffer (ptr_buffer);
+ }
+ else
+ gui_buffer_new (gui_current_window, NULL, NULL, 1, 1);
+}
+
+/*
* gui_switch_to_previous_buffer: switch to previous buffer
*/
@@ -1621,7 +1648,7 @@ gui_init ()
if (gui_window_new (0, 0, COLS, LINES))
{
gui_current_window = gui_windows;
- gui_buffer_new (gui_windows, NULL, NULL, 1);
+ gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
signal (SIGWINCH, gui_curses_resize_handler);
diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c
index 1b78cb556..83cf74630 100644
--- a/src/gui/curses/gui-input.c
+++ b/src/gui/curses/gui-input.c
@@ -90,115 +90,139 @@ gui_read_keyb ()
break;
/* cursor up */
case KEY_UP:
- if (gui_current_window->buffer->ptr_history)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->ptr_history->next_history;
- if (!gui_current_window->buffer->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
+ {
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->ptr_history->next_history;
+ if (!gui_current_window->buffer->ptr_history)
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->history;
+ }
+ else
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
- }
- else
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->history;
- if (gui_current_window->buffer->ptr_history)
- {
- gui_current_window->buffer->input_buffer_size =
- strlen (gui_current_window->buffer->ptr_history->text);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- strcpy (gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->ptr_history->text);
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->ptr_history)
+ {
+ gui_current_window->buffer->input_buffer_size =
+ strlen (gui_current_window->buffer->ptr_history->text);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ strcpy (gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->ptr_history->text);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor down */
case KEY_DOWN:
- if (gui_current_window->buffer->ptr_history)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->ptr_history->prev_history;
if (gui_current_window->buffer->ptr_history)
- gui_current_window->buffer->input_buffer_size =
- strlen (gui_current_window->buffer->ptr_history->text);
- else
- gui_current_window->buffer->input_buffer_size = 0;
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- if (gui_current_window->buffer->ptr_history)
- strcpy (gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->ptr_history->text);
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ {
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->ptr_history->prev_history;
+ if (gui_current_window->buffer->ptr_history)
+ gui_current_window->buffer->input_buffer_size =
+ strlen (gui_current_window->buffer->ptr_history->text);
+ else
+ gui_current_window->buffer->input_buffer_size = 0;
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ if (gui_current_window->buffer->ptr_history)
+ strcpy (gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->ptr_history->text);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor left */
case KEY_LEFT:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos--;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos > 0)
+ {
+ gui_current_window->buffer->input_buffer_pos--;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor right */
case KEY_RIGHT:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos++;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
+ {
+ gui_current_window->buffer->input_buffer_pos++;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* home key */
case KEY_HOME:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos = 0;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos > 0)
+ {
+ gui_current_window->buffer->input_buffer_pos = 0;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* end key */
case KEY_END:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
+ {
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* page up */
case KEY_PPAGE:
- gui_move_page_up (gui_current_window);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_page_up (gui_current_window);
break;
/* page down */
case KEY_NPAGE:
- gui_move_page_down (gui_current_window);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_page_down (gui_current_window);
break;
/* erase before cursor and move cursor to the left */
case 127:
case KEY_BACKSPACE:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- i = gui_current_window->buffer->input_buffer_pos-1;
- while (gui_current_window->buffer->input_buffer[i])
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i+1];
- i++;
+ i = gui_current_window->buffer->input_buffer_pos-1;
+ while (gui_current_window->buffer->input_buffer[i])
+ {
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
+ i++;
+ }
+ gui_current_window->buffer->input_buffer_size--;
+ gui_current_window->buffer->input_buffer_pos--;
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->completion.position = -1;
}
- gui_current_window->buffer->input_buffer_size--;
- gui_current_window->buffer->input_buffer_pos--;
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->completion.position = -1;
}
break;
/* Control + Backspace */
case 0x08:
- gui_delete_previous_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_delete_previous_word (gui_current_window->buffer);
break;
/* Control + L */
case 0x0C:
@@ -206,87 +230,74 @@ gui_read_keyb ()
break;
/* erase char under cursor */
case KEY_DC:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- i = gui_current_window->buffer->input_buffer_pos;
- while (gui_current_window->buffer->input_buffer[i])
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i+1];
- i++;
+ i = gui_current_window->buffer->input_buffer_pos;
+ while (gui_current_window->buffer->input_buffer[i])
+ {
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
+ i++;
+ }
+ gui_current_window->buffer->input_buffer_size--;
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->completion.position = -1;
}
- gui_current_window->buffer->input_buffer_size--;
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->completion.position = -1;
}
break;
/* Tab : completion */
case '\t':
- completion_search (&(gui_current_window->buffer->completion),
- CHANNEL(gui_current_window->buffer),
- gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->input_buffer_size,
- gui_current_window->buffer->input_buffer_pos);
- if (gui_current_window->buffer->completion.word_found)
+ if (!gui_current_window->buffer->dcc)
{
- // replace word with new completed word into input buffer
- gui_current_window->buffer->input_buffer_size +=
- gui_current_window->buffer->completion.diff_size;
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
-
- if (gui_current_window->buffer->completion.diff_size > 0)
- {
- for (i = gui_current_window->buffer->input_buffer_size - 1;
- i >= gui_current_window->buffer->completion.position_replace +
- (int)strlen (gui_current_window->buffer->completion.word_found); i--)
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i -
- gui_current_window->buffer->completion.diff_size];
- }
- else
+ completion_search (&(gui_current_window->buffer->completion),
+ CHANNEL(gui_current_window->buffer),
+ gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->input_buffer_size,
+ gui_current_window->buffer->input_buffer_pos);
+ if (gui_current_window->buffer->completion.word_found)
{
- for (i = gui_current_window->buffer->completion.position_replace +
+ /* replace word with new completed word into input buffer */
+ gui_current_window->buffer->input_buffer_size +=
+ gui_current_window->buffer->completion.diff_size;
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+
+ if (gui_current_window->buffer->completion.diff_size > 0)
+ {
+ for (i = gui_current_window->buffer->input_buffer_size - 1;
+ i >= gui_current_window->buffer->completion.position_replace +
+ (int)strlen (gui_current_window->buffer->completion.word_found); i--)
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i -
+ gui_current_window->buffer->completion.diff_size];
+ }
+ else
+ {
+ for (i = gui_current_window->buffer->completion.position_replace +
+ strlen (gui_current_window->buffer->completion.word_found);
+ i < gui_current_window->buffer->input_buffer_size; i++)
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i -
+ gui_current_window->buffer->completion.diff_size];
+ }
+
+ strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
+ gui_current_window->buffer->completion.word_found,
+ strlen (gui_current_window->buffer->completion.word_found));
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
- i < gui_current_window->buffer->input_buffer_size; i++)
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i -
- gui_current_window->buffer->completion.diff_size];
- }
-
- strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
- gui_current_window->buffer->completion.word_found,
- strlen (gui_current_window->buffer->completion.word_found));
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->completion.position_replace +
- strlen (gui_current_window->buffer->completion.word_found);
- gui_current_window->buffer->completion.position =
- gui_current_window->buffer->input_buffer_pos;
-
- /* add space or completor to the end of completion, if needed */
- if (gui_current_window->buffer->completion.base_word[0] == '/')
- {
- if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
- gui_buffer_insert_string (gui_current_window->buffer,
- " ",
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->completion.position++;
- gui_current_window->buffer->input_buffer_pos++;
- }
- else
- {
- if (gui_current_window->buffer->completion.base_word_pos == 0)
+ gui_current_window->buffer->completion.position =
+ gui_current_window->buffer->input_buffer_pos;
+
+ /* add space or completor to the end of completion, if needed */
+ if (gui_current_window->buffer->completion.base_word[0] == '/')
{
- if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
- cfg_look_completor, strlen (cfg_look_completor)) != 0)
- gui_buffer_insert_string (gui_current_window->buffer,
- cfg_look_completor,
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
- gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
gui_buffer_insert_string (gui_current_window->buffer,
" ",
@@ -294,8 +305,27 @@ gui_read_keyb ()
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
+ else
+ {
+ if (gui_current_window->buffer->completion.base_word_pos == 0)
+ {
+ if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
+ cfg_look_completor, strlen (cfg_look_completor)) != 0)
+ gui_buffer_insert_string (gui_current_window->buffer,
+ cfg_look_completor,
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
+ gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
+ if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
+ gui_buffer_insert_string (gui_current_window->buffer,
+ " ",
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->completion.position++;
+ gui_current_window->buffer->input_buffer_pos++;
+ }
+ }
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
}
- gui_draw_buffer_input (gui_current_window->buffer, 0);
}
break;
/* escape code (for control-key) */
@@ -303,12 +333,14 @@ gui_read_keyb ()
if ((key = getch()) != ERR)
{
/*gui_printf (gui_current_window->buffer,
- "[Debug] key pressed = %d, as octal: %o\n", key, key);*/
+ "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
switch (key)
{
+ /* Alt + left arrow */
case KEY_LEFT:
gui_switch_to_previous_buffer (gui_current_window);
break;
+ /* Alt + right arrow */
case KEY_RIGHT:
gui_switch_to_next_buffer (gui_current_window);
break;
@@ -322,11 +354,13 @@ gui_read_keyb ()
{
/* Control + Right */
case 99:
- gui_move_next_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_next_word (gui_current_window->buffer);
break;
/* Control + Left */
case 100:
- gui_move_previous_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_previous_word (gui_current_window->buffer);
break;
}
}
@@ -365,6 +399,24 @@ gui_read_keyb ()
}
}
break;
+ /* Alt-D */
+ case 'd':
+ case 'D':
+ if (gui_current_window->buffer->dcc)
+ {
+ if (buffer_before_dcc)
+ {
+ gui_switch_to_buffer (gui_current_window,
+ buffer_before_dcc);
+ gui_redraw_buffer (gui_current_window->buffer);
+ }
+ }
+ else
+ {
+ buffer_before_dcc = gui_current_window->buffer;
+ gui_switch_to_dcc_buffer ();
+ }
+ break;
/* Alt-R */
case 'r':
case 'R':
@@ -380,36 +432,42 @@ gui_read_keyb ()
break;
/* send command/message */
case '\n':
- if (gui_current_window->buffer->input_buffer_size > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
- gui_current_window->buffer->input_buffer_size = 0;
- gui_current_window->buffer->input_buffer_pos = 0;
- gui_current_window->buffer->input_buffer_1st_display = 0;
- gui_current_window->buffer->completion.position = -1;
- gui_current_window->buffer->ptr_history = NULL;
- ptr_buffer = gui_current_window->buffer;
- user_command (SERVER(gui_current_window->buffer),
- gui_current_window->buffer->input_buffer);
- if (ptr_buffer == gui_current_window->buffer)
- gui_draw_buffer_input (ptr_buffer, 0);
- if (ptr_buffer)
- ptr_buffer->input_buffer[0] = '\0';
+ if (gui_current_window->buffer->input_buffer_size > 0)
+ {
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
+ gui_current_window->buffer->input_buffer_size = 0;
+ gui_current_window->buffer->input_buffer_pos = 0;
+ gui_current_window->buffer->input_buffer_1st_display = 0;
+ gui_current_window->buffer->completion.position = -1;
+ gui_current_window->buffer->ptr_history = NULL;
+ ptr_buffer = gui_current_window->buffer;
+ user_command (SERVER(gui_current_window->buffer),
+ gui_current_window->buffer->input_buffer);
+ if (ptr_buffer == gui_current_window->buffer)
+ gui_draw_buffer_input (ptr_buffer, 0);
+ if (ptr_buffer)
+ ptr_buffer->input_buffer[0] = '\0';
+ }
}
break;
/* other key => add to input buffer */
default:
- /*gui_printf (gui_current_window->buffer,
- "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
- new_char[0] = key;
- new_char[1] = '\0';
- gui_buffer_insert_string (gui_current_window->buffer,
- new_char,
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->input_buffer_pos++;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_current_window->buffer->completion.position = -1;
+ if (!gui_current_window->buffer->dcc)
+ {
+ /*gui_printf (gui_current_window->buffer,
+ "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
+ new_char[0] = key;
+ new_char[1] = '\0';
+ gui_buffer_insert_string (gui_current_window->buffer,
+ new_char,
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->input_buffer_pos++;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_current_window->buffer->completion.position = -1;
+ }
break;
}
}
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index 63d150bc7..7dc7fbdb4 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -47,6 +47,7 @@ t_gui_window *gui_current_window = NULL; /* pointer to current window */
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
+t_gui_buffer *buffer_before_dcc = NULL; /* buffer before dcc switch */
t_gui_infobar *gui_infobar; /* pointer to infobar content */
@@ -121,26 +122,25 @@ gui_window_new (int x, int y, int width, int height)
*/
t_gui_buffer *
-gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
+gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
+ int switch_to_buffer)
{
t_gui_buffer *new_buffer;
#ifdef DEBUG
wee_log_printf ("creating new buffer\n");
#endif
- if (gui_buffers)
+
+ /* use first buffer if no server was assigned to this buffer */
+ if (!dcc && gui_buffers && (!SERVER(gui_buffers)))
{
- /* use first buffer if no server was assigned to this buffer */
- if (!SERVER(gui_buffers))
- {
- if (server)
- ((t_irc_server *)(server))->buffer = gui_buffers;
- if (channel)
- ((t_irc_channel *)(channel))->buffer = gui_buffers;
- SERVER(gui_buffers) = server;
- CHANNEL(gui_buffers) = channel;
- return gui_buffers;
- }
+ if (server)
+ ((t_irc_server *)(server))->buffer = gui_buffers;
+ if (channel)
+ ((t_irc_channel *)(channel))->buffer = gui_buffers;
+ SERVER(gui_buffers) = server;
+ CHANNEL(gui_buffers) = channel;
+ return gui_buffers;
}
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
@@ -151,6 +151,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to
/* assign server and channel to buffer */
SERVER(new_buffer) = server;
CHANNEL(new_buffer) = channel;
+ new_buffer->dcc = dcc;
/* assign buffer to server and channel */
if (server && !channel)
SERVER(new_buffer)->buffer = new_buffer;
@@ -402,7 +403,7 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
/* always at least one buffer */
if (!gui_buffers && create_new && switch_to_another)
- (void) gui_buffer_new (gui_windows, NULL, NULL, 1);
+ (void) gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
}
/*
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 9b5ca6ad2..469980fc8 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -66,6 +66,7 @@
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
+#define BUFFER_IS_DCC(buffer) (!SERVER(buffer) && !CHANNEL(buffer))
#define MSG_TYPE_TIME 1
#define MSG_TYPE_NICK 2
@@ -135,6 +136,7 @@ struct t_gui_buffer
/* server/channel */
void *server; /* buffer's server */
void *channel; /* buffer's channel */
+ int dcc; /* buffer is dcc status */
/* chat content (lines, line is composed by many messages) */
t_gui_line *lines; /* lines of chat window */
@@ -219,13 +221,14 @@ extern t_gui_window *last_gui_window;
extern t_gui_window *gui_current_window;
extern t_gui_buffer *gui_buffers;
extern t_gui_buffer *last_gui_buffer;
+extern t_gui_buffer *buffer_before_dcc;
extern t_gui_infobar *gui_infobar;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (int, int, int, int);
-extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int);
+extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
extern void gui_buffer_clear (t_gui_buffer *);
extern void gui_buffer_clear_all ();
extern void gui_infobar_printf (int, int, char *, ...);
@@ -253,11 +256,13 @@ extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
extern void gui_draw_buffer_input (t_gui_buffer *, int);
extern void gui_redraw_buffer (t_gui_buffer *);
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
+extern void gui_switch_to_dcc_buffer ();
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_move_page_up ();
extern void gui_move_page_down ();
+extern void gui_curses_resize_handler ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_window_split_horiz (t_gui_window *);
extern void gui_window_split_vertic (t_gui_window *);
diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c
index b5e93038b..515635cb6 100644
--- a/src/irc/irc-channel.c
+++ b/src/irc/irc-channel.c
@@ -72,7 +72,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
server->channels = new_channel;
server->last_channel = new_channel;
- gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
+ gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
/* all is ok, return address of new channel */
return new_channel;
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 375770c25..bbb718970 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -706,7 +706,7 @@ server_auto_connect (int command_line)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
- (void) gui_buffer_new (gui_current_window, ptr_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
if (server_connect (ptr_server))
irc_login (ptr_server);
}
diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c
index d934e8ca5..a5abbb0d8 100644
--- a/weechat/src/common/command.c
+++ b/weechat/src/common/command.c
@@ -917,7 +917,7 @@ weechat_cmd_connect (int argc, char **argv)
}
if (!ptr_server->buffer)
{
- if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
+ if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1))
return -1;
}
if (server_connect (ptr_server))
@@ -1499,7 +1499,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
- (void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, new_server, NULL, 0, 1);
if (server_connect (new_server))
irc_login (new_server);
}
diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c
index 7885e7bf4..9ee926f71 100644
--- a/weechat/src/gui/curses/gui-display.c
+++ b/weechat/src/gui/curses/gui-display.c
@@ -325,12 +325,15 @@ gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
}
else
{
- /* TODO: change this copyright as title? */
- mvwprintw (ptr_win->win_title, 0, 0,
- "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
- mvwprintw (ptr_win->win_title, 0,
- ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
- "%s", WEECHAT_COPYRIGHT);
+ if (!buffer->dcc)
+ {
+ /* TODO: change this copyright as title? */
+ mvwprintw (ptr_win->win_title, 0, 0,
+ "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
+ mvwprintw (ptr_win->win_title, 0,
+ ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
+ "%s", WEECHAT_COPYRIGHT);
+ }
}
wrefresh (ptr_win->win_title);
refresh ();
@@ -572,49 +575,60 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
if (has_colors ())
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
- ptr_line = buffer->last_line;
- lines_used = 0;
- while (ptr_line
- && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
- {
- lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
- ptr_line = ptr_line->prev_line;
- }
- ptr_win->win_chat_cursor_x = 0;
- ptr_win->win_chat_cursor_y = 0;
- if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
+ if (buffer->dcc)
{
- /* screen will be full (we'll display only end of 1st line) */
- ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
- gui_display_end_of_line (ptr_win, ptr_line,
- gui_get_line_num_splits (ptr_win, ptr_line) -
- (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
- ptr_line = ptr_line->next_line;
- ptr_win->first_line_displayed = 0;
+ mvwprintw (ptr_win->win_chat, ptr_win->win_y, ptr_win->win_x,
+ "%s", _(" Type Status Filename / progress"));
+ for (i = 0; i < ptr_win->win_width; i++)
+ mvwprintw (ptr_win->win_chat, 1, i, "%c", '-');
+ move (ptr_win->win_y + 3, ptr_win->win_x);
}
else
{
- /* all lines are displayed */
- if (!ptr_line)
+ ptr_line = buffer->last_line;
+ lines_used = 0;
+ while (ptr_line
+ && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
{
- ptr_win->first_line_displayed = 1;
- ptr_line = buffer->lines;
+ lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
+ ptr_line = ptr_line->prev_line;
}
- else
+ ptr_win->win_chat_cursor_x = 0;
+ ptr_win->win_chat_cursor_y = 0;
+ if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
{
+ /* screen will be full (we'll display only end of 1st line) */
+ ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
+ gui_display_end_of_line (ptr_win, ptr_line,
+ gui_get_line_num_splits (ptr_win, ptr_line) -
+ (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
+ ptr_line = ptr_line->next_line;
ptr_win->first_line_displayed = 0;
+ }
+ else
+ {
+ /* all lines are displayed */
+ if (!ptr_line)
+ {
+ ptr_win->first_line_displayed = 1;
+ ptr_line = buffer->lines;
+ }
+ else
+ {
+ ptr_win->first_line_displayed = 0;
+ ptr_line = ptr_line->next_line;
+ }
+ }
+ while (ptr_line)
+ {
+ if (!gui_display_line (ptr_win, ptr_line, 1))
+ break;
+
ptr_line = ptr_line->next_line;
}
+ /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
+ buffer->sub_lines = 0;*/
}
- while (ptr_line)
- {
- if (!gui_display_line (ptr_win, ptr_line, 1))
- break;
-
- ptr_line = ptr_line->next_line;
- }
- /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
- buffer->sub_lines = 0;*/
wrefresh (ptr_win->win_chat);
refresh ();
}
@@ -893,8 +907,12 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
if (!SERVER(ptr_win->buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
- wprintw (ptr_win->win_status, _("%d:[not connected] "),
- ptr_win->buffer->number);
+ if (ptr_win->buffer->dcc)
+ wprintw (ptr_win->win_status, _("%d:<DCC> "),
+ ptr_win->buffer->number);
+ else
+ wprintw (ptr_win->win_status, _("%d:[not connected] "),
+ ptr_win->buffer->number);
}
/* display list of other active windows (if any) with numbers */
@@ -1089,26 +1107,11 @@ gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
}
else
{
- if (SERVER(buffer))
+ if (buffer->dcc)
{
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(buffer) && (SERVER(buffer)->is_connected))
- ptr_nickname = SERVER(buffer)->nick;
- else
- ptr_nickname = cfg_look_no_nickname;
- if (ptr_win == gui_current_window)
- mvwprintw (ptr_win->win_input, 0, 0, format,
- ptr_nickname,
- buffer->input_buffer + buffer->input_buffer_1st_display);
- else
- mvwprintw (ptr_win->win_input, 0, 0, format,
- ptr_nickname,
- "");
+ snprintf (format, 32, "%%-%ds", input_width);
+ mvwprintw (ptr_win->win_input, 0, 0, format, "");
wclrtoeol (ptr_win->win_input);
- if (ptr_win == gui_current_window)
- move (ptr_win->win_y + ptr_win->win_height - 1,
- ptr_win->win_x + strlen (ptr_nickname) + 2 +
- (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
}
else
{
@@ -1254,6 +1257,30 @@ gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
}
/*
+ * gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
+ */
+
+void
+gui_switch_to_dcc_buffer ()
+{
+ t_gui_buffer *ptr_buffer;
+
+ /* check if dcc buffer exists */
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (BUFFER_IS_DCC (ptr_buffer))
+ break;
+ }
+ if (ptr_buffer)
+ {
+ gui_switch_to_buffer (gui_current_window, ptr_buffer);
+ gui_redraw_buffer (ptr_buffer);
+ }
+ else
+ gui_buffer_new (gui_current_window, NULL, NULL, 1, 1);
+}
+
+/*
* gui_switch_to_previous_buffer: switch to previous buffer
*/
@@ -1621,7 +1648,7 @@ gui_init ()
if (gui_window_new (0, 0, COLS, LINES))
{
gui_current_window = gui_windows;
- gui_buffer_new (gui_windows, NULL, NULL, 1);
+ gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
signal (SIGWINCH, gui_curses_resize_handler);
diff --git a/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c
index 1b78cb556..83cf74630 100644
--- a/weechat/src/gui/curses/gui-input.c
+++ b/weechat/src/gui/curses/gui-input.c
@@ -90,115 +90,139 @@ gui_read_keyb ()
break;
/* cursor up */
case KEY_UP:
- if (gui_current_window->buffer->ptr_history)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->ptr_history->next_history;
- if (!gui_current_window->buffer->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
+ {
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->ptr_history->next_history;
+ if (!gui_current_window->buffer->ptr_history)
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->history;
+ }
+ else
gui_current_window->buffer->ptr_history =
gui_current_window->buffer->history;
- }
- else
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->history;
- if (gui_current_window->buffer->ptr_history)
- {
- gui_current_window->buffer->input_buffer_size =
- strlen (gui_current_window->buffer->ptr_history->text);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- strcpy (gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->ptr_history->text);
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->ptr_history)
+ {
+ gui_current_window->buffer->input_buffer_size =
+ strlen (gui_current_window->buffer->ptr_history->text);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ strcpy (gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->ptr_history->text);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor down */
case KEY_DOWN:
- if (gui_current_window->buffer->ptr_history)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->ptr_history =
- gui_current_window->buffer->ptr_history->prev_history;
if (gui_current_window->buffer->ptr_history)
- gui_current_window->buffer->input_buffer_size =
- strlen (gui_current_window->buffer->ptr_history->text);
- else
- gui_current_window->buffer->input_buffer_size = 0;
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- if (gui_current_window->buffer->ptr_history)
- strcpy (gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->ptr_history->text);
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ {
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->ptr_history->prev_history;
+ if (gui_current_window->buffer->ptr_history)
+ gui_current_window->buffer->input_buffer_size =
+ strlen (gui_current_window->buffer->ptr_history->text);
+ else
+ gui_current_window->buffer->input_buffer_size = 0;
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ if (gui_current_window->buffer->ptr_history)
+ strcpy (gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->ptr_history->text);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor left */
case KEY_LEFT:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos--;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos > 0)
+ {
+ gui_current_window->buffer->input_buffer_pos--;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* cursor right */
case KEY_RIGHT:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos++;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
+ {
+ gui_current_window->buffer->input_buffer_pos++;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* home key */
case KEY_HOME:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos = 0;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos > 0)
+ {
+ gui_current_window->buffer->input_buffer_pos = 0;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* end key */
case KEY_END:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->input_buffer_size;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
+ {
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->input_buffer_size;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ }
}
break;
/* page up */
case KEY_PPAGE:
- gui_move_page_up (gui_current_window);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_page_up (gui_current_window);
break;
/* page down */
case KEY_NPAGE:
- gui_move_page_down (gui_current_window);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_page_down (gui_current_window);
break;
/* erase before cursor and move cursor to the left */
case 127:
case KEY_BACKSPACE:
- if (gui_current_window->buffer->input_buffer_pos > 0)
+ if (!gui_current_window->buffer->dcc)
{
- i = gui_current_window->buffer->input_buffer_pos-1;
- while (gui_current_window->buffer->input_buffer[i])
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i+1];
- i++;
+ i = gui_current_window->buffer->input_buffer_pos-1;
+ while (gui_current_window->buffer->input_buffer[i])
+ {
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
+ i++;
+ }
+ gui_current_window->buffer->input_buffer_size--;
+ gui_current_window->buffer->input_buffer_pos--;
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->completion.position = -1;
}
- gui_current_window->buffer->input_buffer_size--;
- gui_current_window->buffer->input_buffer_pos--;
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->completion.position = -1;
}
break;
/* Control + Backspace */
case 0x08:
- gui_delete_previous_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_delete_previous_word (gui_current_window->buffer);
break;
/* Control + L */
case 0x0C:
@@ -206,87 +230,74 @@ gui_read_keyb ()
break;
/* erase char under cursor */
case KEY_DC:
- if (gui_current_window->buffer->input_buffer_pos <
- gui_current_window->buffer->input_buffer_size)
+ if (!gui_current_window->buffer->dcc)
{
- i = gui_current_window->buffer->input_buffer_pos;
- while (gui_current_window->buffer->input_buffer[i])
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i+1];
- i++;
+ i = gui_current_window->buffer->input_buffer_pos;
+ while (gui_current_window->buffer->input_buffer[i])
+ {
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
+ i++;
+ }
+ gui_current_window->buffer->input_buffer_size--;
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->completion.position = -1;
}
- gui_current_window->buffer->input_buffer_size--;
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->completion.position = -1;
}
break;
/* Tab : completion */
case '\t':
- completion_search (&(gui_current_window->buffer->completion),
- CHANNEL(gui_current_window->buffer),
- gui_current_window->buffer->input_buffer,
- gui_current_window->buffer->input_buffer_size,
- gui_current_window->buffer->input_buffer_pos);
- if (gui_current_window->buffer->completion.word_found)
+ if (!gui_current_window->buffer->dcc)
{
- // replace word with new completed word into input buffer
- gui_current_window->buffer->input_buffer_size +=
- gui_current_window->buffer->completion.diff_size;
- gui_optimize_input_buffer_size (gui_current_window->buffer);
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
-
- if (gui_current_window->buffer->completion.diff_size > 0)
- {
- for (i = gui_current_window->buffer->input_buffer_size - 1;
- i >= gui_current_window->buffer->completion.position_replace +
- (int)strlen (gui_current_window->buffer->completion.word_found); i--)
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i -
- gui_current_window->buffer->completion.diff_size];
- }
- else
+ completion_search (&(gui_current_window->buffer->completion),
+ CHANNEL(gui_current_window->buffer),
+ gui_current_window->buffer->input_buffer,
+ gui_current_window->buffer->input_buffer_size,
+ gui_current_window->buffer->input_buffer_pos);
+ if (gui_current_window->buffer->completion.word_found)
{
- for (i = gui_current_window->buffer->completion.position_replace +
+ /* replace word with new completed word into input buffer */
+ gui_current_window->buffer->input_buffer_size +=
+ gui_current_window->buffer->completion.diff_size;
+ gui_optimize_input_buffer_size (gui_current_window->buffer);
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+
+ if (gui_current_window->buffer->completion.diff_size > 0)
+ {
+ for (i = gui_current_window->buffer->input_buffer_size - 1;
+ i >= gui_current_window->buffer->completion.position_replace +
+ (int)strlen (gui_current_window->buffer->completion.word_found); i--)
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i -
+ gui_current_window->buffer->completion.diff_size];
+ }
+ else
+ {
+ for (i = gui_current_window->buffer->completion.position_replace +
+ strlen (gui_current_window->buffer->completion.word_found);
+ i < gui_current_window->buffer->input_buffer_size; i++)
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i -
+ gui_current_window->buffer->completion.diff_size];
+ }
+
+ strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
+ gui_current_window->buffer->completion.word_found,
+ strlen (gui_current_window->buffer->completion.word_found));
+ gui_current_window->buffer->input_buffer_pos =
+ gui_current_window->buffer->completion.position_replace +
strlen (gui_current_window->buffer->completion.word_found);
- i < gui_current_window->buffer->input_buffer_size; i++)
- gui_current_window->buffer->input_buffer[i] =
- gui_current_window->buffer->input_buffer[i -
- gui_current_window->buffer->completion.diff_size];
- }
-
- strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
- gui_current_window->buffer->completion.word_found,
- strlen (gui_current_window->buffer->completion.word_found));
- gui_current_window->buffer->input_buffer_pos =
- gui_current_window->buffer->completion.position_replace +
- strlen (gui_current_window->buffer->completion.word_found);
- gui_current_window->buffer->completion.position =
- gui_current_window->buffer->input_buffer_pos;
-
- /* add space or completor to the end of completion, if needed */
- if (gui_current_window->buffer->completion.base_word[0] == '/')
- {
- if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
- gui_buffer_insert_string (gui_current_window->buffer,
- " ",
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->completion.position++;
- gui_current_window->buffer->input_buffer_pos++;
- }
- else
- {
- if (gui_current_window->buffer->completion.base_word_pos == 0)
+ gui_current_window->buffer->completion.position =
+ gui_current_window->buffer->input_buffer_pos;
+
+ /* add space or completor to the end of completion, if needed */
+ if (gui_current_window->buffer->completion.base_word[0] == '/')
{
- if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
- cfg_look_completor, strlen (cfg_look_completor)) != 0)
- gui_buffer_insert_string (gui_current_window->buffer,
- cfg_look_completor,
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
- gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
gui_buffer_insert_string (gui_current_window->buffer,
" ",
@@ -294,8 +305,27 @@ gui_read_keyb ()
gui_current_window->buffer->completion.position++;
gui_current_window->buffer->input_buffer_pos++;
}
+ else
+ {
+ if (gui_current_window->buffer->completion.base_word_pos == 0)
+ {
+ if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
+ cfg_look_completor, strlen (cfg_look_completor)) != 0)
+ gui_buffer_insert_string (gui_current_window->buffer,
+ cfg_look_completor,
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
+ gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
+ if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
+ gui_buffer_insert_string (gui_current_window->buffer,
+ " ",
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->completion.position++;
+ gui_current_window->buffer->input_buffer_pos++;
+ }
+ }
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
}
- gui_draw_buffer_input (gui_current_window->buffer, 0);
}
break;
/* escape code (for control-key) */
@@ -303,12 +333,14 @@ gui_read_keyb ()
if ((key = getch()) != ERR)
{
/*gui_printf (gui_current_window->buffer,
- "[Debug] key pressed = %d, as octal: %o\n", key, key);*/
+ "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
switch (key)
{
+ /* Alt + left arrow */
case KEY_LEFT:
gui_switch_to_previous_buffer (gui_current_window);
break;
+ /* Alt + right arrow */
case KEY_RIGHT:
gui_switch_to_next_buffer (gui_current_window);
break;
@@ -322,11 +354,13 @@ gui_read_keyb ()
{
/* Control + Right */
case 99:
- gui_move_next_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_next_word (gui_current_window->buffer);
break;
/* Control + Left */
case 100:
- gui_move_previous_word (gui_current_window->buffer);
+ if (!gui_current_window->buffer->dcc)
+ gui_move_previous_word (gui_current_window->buffer);
break;
}
}
@@ -365,6 +399,24 @@ gui_read_keyb ()
}
}
break;
+ /* Alt-D */
+ case 'd':
+ case 'D':
+ if (gui_current_window->buffer->dcc)
+ {
+ if (buffer_before_dcc)
+ {
+ gui_switch_to_buffer (gui_current_window,
+ buffer_before_dcc);
+ gui_redraw_buffer (gui_current_window->buffer);
+ }
+ }
+ else
+ {
+ buffer_before_dcc = gui_current_window->buffer;
+ gui_switch_to_dcc_buffer ();
+ }
+ break;
/* Alt-R */
case 'r':
case 'R':
@@ -380,36 +432,42 @@ gui_read_keyb ()
break;
/* send command/message */
case '\n':
- if (gui_current_window->buffer->input_buffer_size > 0)
+ if (!gui_current_window->buffer->dcc)
{
- gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
- history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
- gui_current_window->buffer->input_buffer_size = 0;
- gui_current_window->buffer->input_buffer_pos = 0;
- gui_current_window->buffer->input_buffer_1st_display = 0;
- gui_current_window->buffer->completion.position = -1;
- gui_current_window->buffer->ptr_history = NULL;
- ptr_buffer = gui_current_window->buffer;
- user_command (SERVER(gui_current_window->buffer),
- gui_current_window->buffer->input_buffer);
- if (ptr_buffer == gui_current_window->buffer)
- gui_draw_buffer_input (ptr_buffer, 0);
- if (ptr_buffer)
- ptr_buffer->input_buffer[0] = '\0';
+ if (gui_current_window->buffer->input_buffer_size > 0)
+ {
+ gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
+ history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
+ gui_current_window->buffer->input_buffer_size = 0;
+ gui_current_window->buffer->input_buffer_pos = 0;
+ gui_current_window->buffer->input_buffer_1st_display = 0;
+ gui_current_window->buffer->completion.position = -1;
+ gui_current_window->buffer->ptr_history = NULL;
+ ptr_buffer = gui_current_window->buffer;
+ user_command (SERVER(gui_current_window->buffer),
+ gui_current_window->buffer->input_buffer);
+ if (ptr_buffer == gui_current_window->buffer)
+ gui_draw_buffer_input (ptr_buffer, 0);
+ if (ptr_buffer)
+ ptr_buffer->input_buffer[0] = '\0';
+ }
}
break;
/* other key => add to input buffer */
default:
- /*gui_printf (gui_current_window->buffer,
- "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
- new_char[0] = key;
- new_char[1] = '\0';
- gui_buffer_insert_string (gui_current_window->buffer,
- new_char,
- gui_current_window->buffer->input_buffer_pos);
- gui_current_window->buffer->input_buffer_pos++;
- gui_draw_buffer_input (gui_current_window->buffer, 0);
- gui_current_window->buffer->completion.position = -1;
+ if (!gui_current_window->buffer->dcc)
+ {
+ /*gui_printf (gui_current_window->buffer,
+ "[Debug] key pressed = %d, hex = %02X, octal = %o\n", key, key, key);*/
+ new_char[0] = key;
+ new_char[1] = '\0';
+ gui_buffer_insert_string (gui_current_window->buffer,
+ new_char,
+ gui_current_window->buffer->input_buffer_pos);
+ gui_current_window->buffer->input_buffer_pos++;
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
+ gui_current_window->buffer->completion.position = -1;
+ }
break;
}
}
diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c
index 63d150bc7..7dc7fbdb4 100644
--- a/weechat/src/gui/gui-common.c
+++ b/weechat/src/gui/gui-common.c
@@ -47,6 +47,7 @@ t_gui_window *gui_current_window = NULL; /* pointer to current window */
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
+t_gui_buffer *buffer_before_dcc = NULL; /* buffer before dcc switch */
t_gui_infobar *gui_infobar; /* pointer to infobar content */
@@ -121,26 +122,25 @@ gui_window_new (int x, int y, int width, int height)
*/
t_gui_buffer *
-gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
+gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
+ int switch_to_buffer)
{
t_gui_buffer *new_buffer;
#ifdef DEBUG
wee_log_printf ("creating new buffer\n");
#endif
- if (gui_buffers)
+
+ /* use first buffer if no server was assigned to this buffer */
+ if (!dcc && gui_buffers && (!SERVER(gui_buffers)))
{
- /* use first buffer if no server was assigned to this buffer */
- if (!SERVER(gui_buffers))
- {
- if (server)
- ((t_irc_server *)(server))->buffer = gui_buffers;
- if (channel)
- ((t_irc_channel *)(channel))->buffer = gui_buffers;
- SERVER(gui_buffers) = server;
- CHANNEL(gui_buffers) = channel;
- return gui_buffers;
- }
+ if (server)
+ ((t_irc_server *)(server))->buffer = gui_buffers;
+ if (channel)
+ ((t_irc_channel *)(channel))->buffer = gui_buffers;
+ SERVER(gui_buffers) = server;
+ CHANNEL(gui_buffers) = channel;
+ return gui_buffers;
}
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
@@ -151,6 +151,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to
/* assign server and channel to buffer */
SERVER(new_buffer) = server;
CHANNEL(new_buffer) = channel;
+ new_buffer->dcc = dcc;
/* assign buffer to server and channel */
if (server && !channel)
SERVER(new_buffer)->buffer = new_buffer;
@@ -402,7 +403,7 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
/* always at least one buffer */
if (!gui_buffers && create_new && switch_to_another)
- (void) gui_buffer_new (gui_windows, NULL, NULL, 1);
+ (void) gui_buffer_new (gui_windows, NULL, NULL, 0, 1);
}
/*
diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h
index 9b5ca6ad2..469980fc8 100644
--- a/weechat/src/gui/gui.h
+++ b/weechat/src/gui/gui.h
@@ -66,6 +66,7 @@
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
+#define BUFFER_IS_DCC(buffer) (!SERVER(buffer) && !CHANNEL(buffer))
#define MSG_TYPE_TIME 1
#define MSG_TYPE_NICK 2
@@ -135,6 +136,7 @@ struct t_gui_buffer
/* server/channel */
void *server; /* buffer's server */
void *channel; /* buffer's channel */
+ int dcc; /* buffer is dcc status */
/* chat content (lines, line is composed by many messages) */
t_gui_line *lines; /* lines of chat window */
@@ -219,13 +221,14 @@ extern t_gui_window *last_gui_window;
extern t_gui_window *gui_current_window;
extern t_gui_buffer *gui_buffers;
extern t_gui_buffer *last_gui_buffer;
+extern t_gui_buffer *buffer_before_dcc;
extern t_gui_infobar *gui_infobar;
/* prototypes */
/* GUI independent functions */
extern t_gui_window *gui_window_new (int, int, int, int);
-extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int);
+extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
extern void gui_buffer_clear (t_gui_buffer *);
extern void gui_buffer_clear_all ();
extern void gui_infobar_printf (int, int, char *, ...);
@@ -253,11 +256,13 @@ extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
extern void gui_draw_buffer_input (t_gui_buffer *, int);
extern void gui_redraw_buffer (t_gui_buffer *);
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
+extern void gui_switch_to_dcc_buffer ();
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_move_page_up ();
extern void gui_move_page_down ();
+extern void gui_curses_resize_handler ();
extern void gui_window_init_subwindows (t_gui_window *);
extern void gui_window_split_horiz (t_gui_window *);
extern void gui_window_split_vertic (t_gui_window *);
diff --git a/weechat/src/irc/irc-channel.c b/weechat/src/irc/irc-channel.c
index b5e93038b..515635cb6 100644
--- a/weechat/src/irc/irc-channel.c
+++ b/weechat/src/irc/irc-channel.c
@@ -72,7 +72,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
server->channels = new_channel;
server->last_channel = new_channel;
- gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
+ gui_buffer_new (gui_current_window, server, new_channel, 0, switch_to_buffer);
/* all is ok, return address of new channel */
return new_channel;
diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c
index 375770c25..bbb718970 100644
--- a/weechat/src/irc/irc-server.c
+++ b/weechat/src/irc/irc-server.c
@@ -706,7 +706,7 @@ server_auto_connect (int command_line)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
- (void) gui_buffer_new (gui_current_window, ptr_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, ptr_server, NULL, 0, 1);
if (server_connect (ptr_server))
irc_login (ptr_server);
}