summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-main.c18
-rw-r--r--src/gui/curses/gui-curses-nicklist.c2
-rw-r--r--src/gui/curses/gui-curses-status.c6
-rw-r--r--src/gui/curses/gui-curses-window.c6
-rw-r--r--src/gui/gui-buffer.c54
-rw-r--r--src/gui/gui-common.c8
-rw-r--r--src/gui/gui.h2
7 files changed, 73 insertions, 23 deletions
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index 2a6bf58a7..915f92971 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -139,7 +139,7 @@ gui_main_loop ()
{
if (ptr_server->is_connected)
{
- server_outqueue_send (ptr_server);
+ irc_server_outqueue_send (ptr_server);
}
}
@@ -170,7 +170,7 @@ gui_main_loop ()
if (check_away >= (cfg_irc_away_check * 60))
{
check_away = 0;
- server_check_away ();
+ irc_server_check_away ();
}
}
@@ -223,7 +223,7 @@ gui_main_loop ()
if ((!ptr_server->is_connected)
&& (ptr_server->reconnect_start > 0)
&& (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay)))
- server_reconnect (ptr_server);
+ irc_server_reconnect (ptr_server);
else
{
if (ptr_server->is_connected)
@@ -232,7 +232,7 @@ gui_main_loop ()
if ((ptr_server->lag_check_time.tv_sec == 0)
&& (new_time >= ptr_server->lag_next_check))
{
- server_sendf (ptr_server, "PING %s", ptr_server->address);
+ irc_server_sendf (ptr_server, "PING %s", ptr_server->address);
gettimeofday (&(ptr_server->lag_check_time), NULL);
}
@@ -248,7 +248,7 @@ gui_main_loop ()
gui_printf (ptr_server->buffer,
_("%s lag is high, disconnecting from server...\n"),
WEECHAT_WARNING);
- server_disconnect (ptr_server, 1);
+ irc_server_disconnect (ptr_server, 1);
continue;
}
}
@@ -282,22 +282,22 @@ gui_main_loop ()
if (!ptr_server->is_connected && (ptr_server->child_pid > 0))
{
if (FD_ISSET (ptr_server->child_read, &read_fd))
- server_child_read (ptr_server);
+ irc_server_child_read (ptr_server);
}
else
{
if ((ptr_server->sock >= 0) &&
(FD_ISSET (ptr_server->sock, &read_fd)))
- server_recv (ptr_server);
+ irc_server_recv (ptr_server);
}
}
}
/* manages active DCC */
- dcc_handle ();
+ irc_dcc_handle ();
}
if (send_irc_quit)
- irc_cmd_send_quit (NULL, NULL, NULL);
+ irc_send_cmd_quit (NULL, NULL, NULL);
}
/*
diff --git a/src/gui/curses/gui-curses-nicklist.c b/src/gui/curses/gui-curses-nicklist.c
index ca2585d96..bbcfff451 100644
--- a/src/gui/curses/gui-curses-nicklist.c
+++ b/src/gui/curses/gui-curses-nicklist.c
@@ -54,7 +54,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
{
if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0))
{
- max_length = nick_get_max_length (CHANNEL(buffer));
+ max_length = irc_nick_get_max_length (CHANNEL(buffer));
if (calculate_size && (gui_window_calculate_pos_size (ptr_win, 0)))
{
diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c
index a6b93462b..26d3aaa9a 100644
--- a/src/gui/curses/gui-curses-status.c
+++ b/src/gui/curses/gui-curses-status.c
@@ -127,9 +127,9 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
SERVER(ptr_win->buffer)->name);
if (ptr_win->buffer->all_servers)
{
- server_get_number_buffer (SERVER(ptr_win->buffer),
- &server_pos,
- &server_total);
+ irc_server_get_number_buffer (SERVER(ptr_win->buffer),
+ &server_pos,
+ &server_total);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status,
COLOR_WIN_STATUS_DELIMITERS);
wprintw (GUI_CURSES(ptr_win)->win_status, "(");
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 5aa28fc56..67432b6ab 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -206,7 +206,7 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
/* init chat & nicklist settings */
if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer))
{
- max_length = nick_get_max_length (CHANNEL(window->buffer));
+ max_length = irc_nick_get_max_length (CHANNEL(window->buffer));
lines = 0;
@@ -224,8 +224,8 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
}
else
{
- nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
- &num_halfop, &num_voice, &num_normal);
+ irc_nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
+ &num_halfop, &num_voice, &num_normal);
width_used = (window->win_width - add_left - add_right)
- ((window->win_width - add_left - add_right) % (max_length + 2));
if (((max_length + 2) * num_nicks) % width_used == 0)
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index eb266379b..1b29f3f03 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -168,7 +168,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int type,
new_buffer->line_complete = 1;
/* notify level */
- new_buffer->notify_level = channel_get_notify_level (server, channel);
+ new_buffer->notify_level = irc_channel_get_notify_level (server, channel);
/* create/append to log file */
new_buffer->log_filename = NULL;
@@ -274,7 +274,7 @@ gui_buffer_search (char *server, char *channel)
{
if (server && server[0])
{
- ptr_server = server_search (server);
+ ptr_server = irc_server_search (server);
if (!ptr_server)
return NULL;
}
@@ -283,7 +283,7 @@ gui_buffer_search (char *server, char *channel)
{
if (ptr_server)
{
- ptr_channel = channel_search_any (ptr_server, channel);
+ ptr_channel = irc_channel_search_any (ptr_server, channel);
if (ptr_channel)
ptr_buffer = ptr_channel->buffer;
}
@@ -368,6 +368,54 @@ gui_buffer_find_window (t_gui_buffer *buffer)
}
/*
+ * gui_buffer_find_context: find window/buffer for a server/channel
+ */
+
+void
+gui_buffer_find_context (void *server, void *channel,
+ t_gui_window **window, t_gui_buffer **buffer)
+{
+ t_gui_window *ptr_win;
+
+ if (!buffer)
+ return;
+
+ /* first find buffer */
+ *buffer = NULL;
+ if ((t_irc_channel *)channel && ((t_irc_channel *)channel)->buffer)
+ *buffer = ((t_irc_channel *)channel)->buffer;
+ else
+ {
+ if ((t_irc_server *)server && ((t_irc_server *)server)->buffer)
+ *buffer = ((t_irc_server *)server)->buffer;
+ else
+ *buffer = gui_current_window->buffer;
+ }
+
+ /* then find first window displaying this buffer */
+ if (window)
+ {
+ *window = NULL;
+ if (gui_current_window->buffer == *buffer)
+ *window = gui_current_window;
+ else
+ {
+ for (ptr_win = gui_windows; ptr_win;
+ ptr_win = ptr_win->next_window)
+ {
+ if (ptr_win->buffer == *buffer)
+ {
+ *window = ptr_win;
+ break;
+ }
+ }
+ if (!*window)
+ *window = gui_current_window;
+ }
+ }
+}
+
+/*
* gui_buffer_is_scrolled: return 1 if all windows displaying buffer are scrolled
* (user doesn't see end of buffer)
* return 0 if at least one window is NOT scrolled
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index f7b6cba80..60ccfcebb 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -672,7 +672,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions)
&& (DCC_IS_RECV(dcc_selected->status))
&& (dcc_selected->status == DCC_WAITING))
{
- dcc_accept (dcc_selected);
+ irc_dcc_accept (dcc_selected);
}
break;
/* cancel DCC */
@@ -681,7 +681,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions)
if (dcc_selected
&& (!DCC_ENDED(dcc_selected->status)))
{
- dcc_close (dcc_selected, DCC_ABORTED);
+ irc_dcc_close (dcc_selected, DCC_ABORTED);
gui_window_redraw_buffer (window->buffer);
}
break;
@@ -696,7 +696,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions)
{
ptr_dcc_next = ptr_dcc->next_dcc;
if (DCC_ENDED(ptr_dcc->status))
- dcc_free (ptr_dcc);
+ irc_dcc_free (ptr_dcc);
ptr_dcc = ptr_dcc_next;
}
gui_window_redraw_buffer (window->buffer);
@@ -731,7 +731,7 @@ gui_exec_action_dcc (t_gui_window *window, char *actions)
window->dcc_selected = dcc_selected->next_dcc;
else
window->dcc_selected = NULL;
- dcc_free (dcc_selected);
+ irc_dcc_free (dcc_selected);
gui_window_redraw_buffer (window->buffer);
}
break;
diff --git a/src/gui/gui.h b/src/gui/gui.h
index c3e56e08e..ef010d592 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -85,6 +85,8 @@ extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int, int);
extern t_gui_buffer *gui_buffer_search (char *, char *);
extern t_gui_buffer *gui_buffer_search_by_number (int);
extern t_gui_window *gui_buffer_find_window (t_gui_buffer *);
+extern void gui_buffer_find_context (void *, void *,
+ t_gui_window **, t_gui_buffer **);
extern int gui_buffer_is_scrolled (t_gui_buffer *);
extern t_gui_buffer *gui_buffer_get_dcc (t_gui_window *);
extern void gui_buffer_clear (t_gui_buffer *);