1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 18:53:12 +02:00

Version 0.0.7-pre2 - window management

This commit is contained in:
Sebastien Helleu
2004-06-22 22:21:22 +00:00
parent 095f296529
commit 66ff97166f
42 changed files with 3214 additions and 2998 deletions
+2 -2
View File
@@ -41,7 +41,7 @@ char *channel_modes = "iklmnst";
t_irc_channel *
channel_new (t_irc_server *server, int channel_type, char *channel_name,
int switch_to_window)
int switch_to_view)
{
t_irc_channel *new_channel;
@@ -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_window_new (server, new_channel, switch_to_window);
gui_view_new (gui_current_view->window, server, new_channel, switch_to_view);
/* all is ok, return address of new channel */
return new_channel;
+25 -25
View File
@@ -41,16 +41,16 @@
*/
void
irc_display_prefix (t_gui_window *window, char *prefix)
irc_display_prefix (t_gui_view *view, char *prefix)
{
if (prefix[0] == prefix[2])
{
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
gui_printf_color (view, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
gui_printf_color (view, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
gui_printf_color (view, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
}
else
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
gui_printf_color (view, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
}
/*
@@ -59,45 +59,45 @@ irc_display_prefix (t_gui_window *window, char *prefix)
*/
void
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
irc_display_nick (t_gui_view *view, t_irc_nick *nick, int message_type,
int display_around, int color_nick, int no_nickmode)
{
if (display_around)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type, COLOR_WIN_CHAT_DARK, "<");
if (cfg_look_nickmode)
{
if (nick->is_op)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
COLOR_WIN_NICK_OP, "@");
else
{
if (nick->is_halfop)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
else
{
if (nick->has_voice)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
COLOR_WIN_NICK_VOICE, "+");
else
if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
COLOR_WIN_CHAT, " ");
}
}
}
if (color_nick < 0)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", nick->nick);
else
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type,
(color_nick) ?
((cfg_look_color_nicks) ?
@@ -106,7 +106,7 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
"%s", nick->nick);
if (display_around)
gui_printf_color_type (window,
gui_printf_color_type (view,
message_type, COLOR_WIN_CHAT_DARK, "> ");
}
@@ -115,21 +115,21 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
*/
void
irc_display_mode (t_gui_window *window, char *channel_name, char set_flag,
irc_display_mode (t_gui_view *view, char *channel_name, char set_flag,
char *symbol, char *nick_host, char *message, char *param)
{
irc_display_prefix (window, PREFIX_INFO);
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "[");
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
gui_printf_color (window, COLOR_WIN_CHAT, "/");
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s", nick_host);
irc_display_prefix (view, PREFIX_INFO);
gui_printf_color (view, COLOR_WIN_CHAT_DARK, "[");
gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
gui_printf_color (view, COLOR_WIN_CHAT, "/");
gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
gui_printf_color (view, COLOR_WIN_CHAT_DARK, "] ");
gui_printf_color (view, COLOR_WIN_CHAT_NICK, "%s", nick_host);
if (param)
{
gui_printf_color (window, COLOR_WIN_CHAT, " %s ", message);
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s\n", param);
gui_printf_color (view, COLOR_WIN_CHAT, " %s ", message);
gui_printf_color (view, COLOR_WIN_CHAT_NICK, "%s\n", param);
}
else
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
gui_printf_color (view, COLOR_WIN_CHAT, " %s\n", message);
}
+2 -2
View File
@@ -182,7 +182,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
/* alloc memory for new nick */
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
{
gui_printf (channel->window,
gui_printf (channel->view,
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
return NULL;
}
@@ -192,7 +192,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
new_nick->is_op = is_op;
new_nick->is_halfop = is_halfop;
new_nick->has_voice = has_voice;
if (strcasecmp (new_nick->nick, SERVER(channel->window)->nick) == 0)
if (strcasecmp (new_nick->nick, SERVER(channel->view)->nick) == 0)
new_nick->color = COLOR_WIN_NICK_SELF;
else
new_nick->color = nick_find_color (channel);
+307 -307
View File
File diff suppressed because it is too large Load Diff
+65 -65
View File
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
hostname[sizeof (hostname) - 1] = '\0';
if (!hostname[0])
strcpy (hostname, _("unknown"));
gui_printf (server->window,
gui_printf (server->view,
_("%s: using local hostname \"%s\"\n"),
PACKAGE_NAME, hostname);
server_sendf (server,
@@ -198,15 +198,15 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
{
int i;
if (WIN_IS_CHANNEL(gui_current_window))
if (VIEW_IS_CHANNEL(gui_current_view))
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s -o %s\r\n",
CHANNEL(gui_current_window)->name,
CHANNEL(gui_current_view)->name,
argv[i]);
}
else
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "deop");
return 0;
@@ -221,16 +221,16 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
{
int i;
if (WIN_IS_CHANNEL(gui_current_window))
if (VIEW_IS_CHANNEL(gui_current_view))
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s -v %s\r\n",
CHANNEL(gui_current_window)->name,
CHANNEL(gui_current_view)->name,
argv[i]);
}
else
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "devoice");
return -1;
@@ -310,15 +310,15 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
server_sendf (server, "KICK %s\r\n", arguments);
else
{
if (WIN_IS_CHANNEL (gui_current_window))
if (VIEW_IS_CHANNEL (gui_current_view))
{
server_sendf (server,
"KICK %s %s\r\n",
CHANNEL(gui_current_window)->name, arguments);
CHANNEL(gui_current_view)->name, arguments);
}
else
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "kick");
return -1;
@@ -388,19 +388,19 @@ irc_cmd_send_lusers (t_irc_server *server, char *arguments)
int
irc_cmd_send_me (t_irc_server *server, char *arguments)
{
if (WIN_IS_SERVER(gui_current_window))
if (VIEW_IS_SERVER(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "me");
return -1;
}
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
CHANNEL(gui_current_window)->name, arguments);
irc_display_prefix (gui_current_window, PREFIX_ACTION_ME);
gui_printf_color (gui_current_window,
CHANNEL(gui_current_view)->name, arguments);
irc_display_prefix (gui_current_view, PREFIX_ACTION_ME);
gui_printf_color (gui_current_view,
COLOR_WIN_CHAT_NICK, "%s", server->nick);
gui_printf_color (gui_current_window,
gui_printf_color (gui_current_view,
COLOR_WIN_CHAT, " %s\n", arguments);
return 0;
}
@@ -459,25 +459,25 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
if (strcmp (arguments, "*") == 0)
{
if (WIN_IS_SERVER(gui_current_window))
if (VIEW_IS_SERVER(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "msg *");
return -1;
}
ptr_channel = CHANNEL(gui_current_window);
ptr_channel = CHANNEL(gui_current_view);
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
irc_display_nick (ptr_channel->window, ptr_nick,
irc_display_nick (ptr_channel->view, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
gui_printf (server->window,
gui_printf (server->view,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
@@ -492,14 +492,14 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
irc_display_nick (ptr_channel->window, ptr_nick,
irc_display_nick (ptr_channel->view, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
gui_printf (server->window,
gui_printf (server->view,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
}
@@ -513,26 +513,26 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
gui_redraw_window_title (ptr_channel->window);
gui_redraw_view_title (ptr_channel->view);
}
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
@@ -543,7 +543,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
else
{
gui_printf (server->window,
gui_printf (server->view,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
return -1;
@@ -562,16 +562,16 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
server_sendf (server, "NAMES %s\r\n", arguments);
else
{
if (!WIN_IS_CHANNEL(gui_current_window))
if (!VIEW_IS_CHANNEL(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "names");
return -1;
}
else
server_sendf (server, "NAMES %s\r\n",
CHANNEL(gui_current_window)->name);
CHANNEL(gui_current_view)->name);
}
return 0;
}
@@ -609,16 +609,16 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
{
int i;
if (WIN_IS_CHANNEL(gui_current_window))
if (VIEW_IS_CHANNEL(gui_current_view))
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s +o %s\r\n",
CHANNEL(gui_current_window)->name,
CHANNEL(gui_current_view)->name,
argv[i]);
}
else
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "op");
return -1;
@@ -663,36 +663,36 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
}
else
{
if (WIN_IS_SERVER(gui_current_window))
if (VIEW_IS_SERVER(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
return -1;
}
channel_name = CHANNEL(gui_current_window)->name;
channel_name = CHANNEL(gui_current_view)->name;
pos_args = arguments;
}
}
else
{
if (WIN_IS_SERVER(gui_current_window))
if (VIEW_IS_SERVER(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
return -1;
}
if (WIN_IS_PRIVATE(gui_current_window))
if (VIEW_IS_PRIVATE(gui_current_view))
{
ptr_channel = CHANNEL(gui_current_window);
gui_window_free (ptr_channel->window);
ptr_channel = CHANNEL(gui_current_view);
gui_view_free (ptr_channel->view);
channel_free (server, ptr_channel);
gui_redraw_window_status (gui_current_window);
gui_redraw_window_input (gui_current_window);
gui_redraw_view_status (gui_current_view);
gui_redraw_view_input (gui_current_view);
return 0;
}
channel_name = CHANNEL(gui_current_window)->name;
channel_name = CHANNEL(gui_current_view)->name;
pos_args = NULL;
}
@@ -753,29 +753,29 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
gui_redraw_window_title (ptr_channel->window);
gui_redraw_view_title (ptr_channel->view);
}
/* display text if given */
if (pos)
{
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
gui_printf_color_type (ptr_channel->window,
gui_printf_color_type (ptr_channel->view,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
@@ -970,14 +970,14 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
/* look for current channel if not specified */
if (!channel_name)
{
if (WIN_IS_SERVER(gui_current_window))
if (VIEW_IS_SERVER(gui_current_view))
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "topic");
return -1;
}
channel_name = CHANNEL(gui_current_window)->name;
channel_name = CHANNEL(gui_current_view)->name;
}
if (new_topic)
@@ -1040,8 +1040,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
{
if (arguments)
{
if (WIN_IS_CHANNEL(gui_current_window) &&
nick_search (CHANNEL(gui_current_window), arguments))
if (VIEW_IS_CHANNEL(gui_current_view) &&
nick_search (CHANNEL(gui_current_view), arguments))
server_sendf (server, "PRIVMSG %s :\01VERSION\01\r\n",
arguments);
else
@@ -1050,8 +1050,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
}
else
{
irc_display_prefix (server->window, PREFIX_INFO);
gui_printf (server->window, _("%s, compiled on %s %s\n"),
irc_display_prefix (server->view, PREFIX_INFO);
gui_printf (server->view, _("%s, compiled on %s %s\n"),
PACKAGE_STRING,
__DATE__, __TIME__);
server_sendf (server, "VERSION\r\n");
@@ -1068,16 +1068,16 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
{
int i;
if (WIN_IS_CHANNEL(gui_current_window))
if (VIEW_IS_CHANNEL(gui_current_view))
{
for (i = 0; i < argc; i++)
server_sendf (server, "MODE %s +v %s\r\n",
CHANNEL(gui_current_window)->name,
CHANNEL(gui_current_view)->name,
argv[i]);
}
else
{
gui_printf (server->window,
gui_printf (server->view,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "voice");
return -1;
+26 -26
View File
@@ -78,7 +78,7 @@ server_init (t_irc_server *server)
server->is_away = 0;
server->server_read = -1;
server->server_write = -1;
server->window = NULL;
server->view = NULL;
server->channels = NULL;
server->last_channel = NULL;
}
@@ -270,8 +270,8 @@ server_free (t_irc_server *server)
(server->next_server)->prev_server = server->prev_server;
server_destroy (server);
if (server->window)
gui_window_free (server->window);
if (server->view)
gui_view_free (server->view);
free (server);
irc_servers = new_irc_servers;
}
@@ -377,11 +377,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
size_buf = strlen (buffer);
buffer[size_buf - 2] = '\0';
#ifdef DEBUG
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
gui_printf (server->view, "[DEBUG] Sending to server >>> %s\n", buffer);
#endif
buffer[size_buf - 2] = '\r';
if (server_send (server, buffer, size_buf) <= 0)
gui_printf (server->window, _("%s error sending data to IRC server\n"),
gui_printf (server->view, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
}
@@ -397,7 +397,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
message = (t_irc_message *) malloc (sizeof (t_irc_message));
if (!message)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
return;
@@ -408,7 +408,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
message->data = (char *) malloc (strlen (unterminated_message) +
strlen (msg) + 1);
if (!message->data)
gui_printf (server->window,
gui_printf (server->view,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
@@ -462,14 +462,14 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
if (!unterminated_message)
gui_printf (server->window,
gui_printf (server->view,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
strcpy (unterminated_message, buffer);
return;
}
gui_printf (server->window,
gui_printf (server->view,
_("%s unable to explode received buffer\n"),
WEECHAT_ERROR);
}
@@ -493,7 +493,7 @@ server_msgq_flush ()
if (recv_msgq->data)
{
#ifdef DEBUG
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
gui_printf (gui_current_view, "[DEBUG] %s\n", recv_msgq->data);
#endif
ptr_data = recv_msgq->data;
@@ -542,15 +542,15 @@ server_msgq_flush ()
command, args))
{
case -1:
gui_printf (recv_msgq->server->window,
gui_printf (recv_msgq->server->view,
_("Command '%s' failed!\n"), command);
break;
case -2:
gui_printf (recv_msgq->server->window,
gui_printf (recv_msgq->server->view,
_("No command to execute!\n"));
break;
case -3:
gui_printf (recv_msgq->server->window,
gui_printf (recv_msgq->server->view,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
@@ -602,7 +602,7 @@ server_connect (t_irc_server *server)
int error;
int server_pipe[2];
gui_printf (server->window,
gui_printf (server->view,
_("%s: connecting to %s:%d...\n"),
PACKAGE_NAME, server->address, server->port);
wee_log_printf (_("connecting to server %s:%d...\n"),
@@ -612,7 +612,7 @@ server_connect (t_irc_server *server)
/* create pipe */
if (pipe (server_pipe) < 0)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot create pipe\n"), WEECHAT_ERROR);
server_free (server);
return 0;
@@ -626,14 +626,14 @@ server_connect (t_irc_server *server)
if (setsockopt
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
sizeof (set)) == -1)
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
WEECHAT_ERROR);
set = 1;
if (setsockopt
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
sizeof (set)) == -1)
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_ERROR);
@@ -641,7 +641,7 @@ server_connect (t_irc_server *server)
ip4_hostent = gethostbyname (server->address);
if (!ip4_hostent)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s address \"%s\" not found\n"),
WEECHAT_ERROR, server->address);
close (server->server_read);
@@ -657,14 +657,14 @@ server_connect (t_irc_server *server)
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
if (error != 0)
{
gui_printf (server->window,
gui_printf (server->view,
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
return 0;
} */
ip_address = inet_ntoa (addr.sin_addr);
if (!ip_address)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s IP address not found\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -674,13 +674,13 @@ server_connect (t_irc_server *server)
}
/* connection to server */
gui_printf (server->window,
gui_printf (server->view,
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
if (error != 0)
{
gui_printf (server->window,
gui_printf (server->view,
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -708,7 +708,7 @@ server_auto_connect (int command_line)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
(void) gui_window_new (ptr_server, NULL, 1);
(void) gui_view_new (gui_current_view->window, ptr_server, NULL, 1);
if (server_connect (ptr_server))
irc_login (ptr_server);
}
@@ -726,12 +726,12 @@ server_disconnect (t_irc_server *server)
if (server->is_connected)
{
/* write disconnection message on each channel/private window */
/* write disconnection message on each channel/private view */
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
gui_printf (ptr_channel->window, _("Disconnected from server!\n"));
irc_display_prefix (ptr_channel->view, PREFIX_INFO);
gui_printf (ptr_channel->view, _("Disconnected from server!\n"));
}
/* close communication with server */
+5 -5
View File
@@ -83,7 +83,7 @@ struct t_irc_channel
char *key; /* channel key (NULL if no key is set) */
t_irc_nick *nicks; /* nicks on the channel */
t_irc_nick *last_nick; /* last nick on the channel */
t_gui_window *window; /* GUI window allocated for channel */
t_gui_view *view; /* GUI view allocated for channel */
t_irc_channel *prev_channel; /* link to previous channel */
t_irc_channel *next_channel; /* link to next channel */
};
@@ -116,7 +116,7 @@ struct t_irc_server
int is_away; /* 1 is user is marker as away */
int server_read; /* pipe for reading server data */
int server_write; /* pipe for sending data to server */
t_gui_window *window; /* GUI window allocated for server */
t_gui_view *view; /* GUI view allocated for server */
t_irc_channel *channels; /* opened channels on server */
t_irc_channel *last_channel; /* last opened channal on server */
t_irc_server *prev_server; /* link to previous server */
@@ -204,9 +204,9 @@ extern void dcc_send ();
/* IRC display (irc-diplay.c) */
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
extern void irc_display_prefix (/*@null@*/ t_gui_view *, char *);
extern void irc_display_nick (t_gui_view *, t_irc_nick *, int, int, int, int);
extern void irc_display_mode (t_gui_view *, char *, char, char *, char *,
char *, char *);
/* IRC protocol (irc-commands.c) */