summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-display.c73
-rw-r--r--src/irc/irc-recv.c41
-rw-r--r--src/irc/irc-send.c28
-rw-r--r--src/irc/irc-server.c43
-rw-r--r--src/irc/irc.h1
5 files changed, 178 insertions, 8 deletions
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 88ca46b01..78378198c 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -133,3 +133,76 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
else
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
}
+
+/*
+ * irc_display_server: display server description
+ */
+
+void
+irc_display_server (t_irc_server *server)
+{
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT, _("Server: "));
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s", server->name);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " [");
+ gui_printf_color (NULL, COLOR_WIN_CHAT, "%s",
+ (server->is_connected) ?
+ _("connected") : _("not connected"));
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_autoconnect : %s%s\n",
+ (server->autoconnect) ? _("yes") : _("no"),
+ (server->command_line) ?
+ _(" (temporary server, will not be saved)") : "");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_autoreconnect . . .: %s\n",
+ (server->autoreconnect) ? _("yes") : _("no"));
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_autoreconnect_delay: %d seconds\n",
+ server->autoreconnect_delay);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_address . . . . . .: %s\n",
+ server->address);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_port . . . . . . .: %d\n",
+ server->port);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_password . . . . .: %s\n",
+ (server->password && server->password[0]) ?
+ _("(hidden)") : "");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_nick1/2/3 . . . . .: %s", server->nick1);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
+ gui_printf_color (NULL, COLOR_WIN_CHAT, "%s", server->nick2);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, " / ");
+ gui_printf_color (NULL, COLOR_WIN_CHAT, "%s\n", server->nick3);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_username . . . . .: %s\n",
+ server->username);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_realname . . . . .: %s\n",
+ server->realname);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_command . . . . . .: %s\n",
+ (server->command && server->command[0]) ?
+ server->command : "");
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_command_delay . . .: %d seconds\n",
+ server->command_delay);
+ irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf_color (NULL, COLOR_WIN_CHAT,
+ " server_autojoin . . . . .: %s\n",
+ (server->autojoin && server->autojoin[0]) ?
+ server->autojoin : "");
+}
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 74400fbf0..8b193ca99 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -159,6 +159,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
if (!ptr_channel)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create new channel \"%s\"\n"),
WEECHAT_ERROR, arguments);
@@ -225,6 +226,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
@@ -257,6 +259,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
@@ -546,6 +549,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "mode");
@@ -560,6 +564,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (!pos)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without channel or nickname\n"),
WEECHAT_ERROR, "mode");
@@ -589,6 +594,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "mode");
@@ -598,6 +604,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
else
{
/* nickname modes */
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "[");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "/");
@@ -626,6 +633,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "nick");
@@ -734,6 +742,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s nickname not found for \"%s\" command\n"),
WEECHAT_ERROR, "notice");
@@ -791,6 +800,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
if (host)
{
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", host);
@@ -825,6 +835,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (!host || !arguments)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without host or channel\n"),
WEECHAT_ERROR, "part");
@@ -899,6 +910,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "part");
@@ -941,6 +953,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "privmsg");
@@ -1030,6 +1043,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1039,6 +1053,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1123,6 +1138,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (!pos2)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1137,6 +1153,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1152,6 +1169,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1167,6 +1185,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1190,6 +1209,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
@@ -1261,6 +1281,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
@@ -1284,6 +1305,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "quit");
@@ -1406,7 +1428,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
pos2[0] = '\0';
gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
- "%s%s",
+ "%s%s\n",
(first) ? "" : " ", pos);
first = 0;
pos = pos2 + 1;
@@ -1436,6 +1458,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
if (!string_is_channel (arguments))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command received without channel\n"),
WEECHAT_ERROR, "topic");
@@ -2398,6 +2421,7 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (pos)
pos[0] = '\0';
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, _("No topic set for "));
gui_printf_color (gui_current_window->buffer,
@@ -2451,6 +2475,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "332");
@@ -2460,6 +2485,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "332");
@@ -2516,6 +2542,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "333");
@@ -2524,6 +2551,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot identify date/time for \"%s\" command\n"),
WEECHAT_ERROR, "333");
@@ -2532,6 +2560,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot identify nickname for \"%s\" command\n"),
WEECHAT_ERROR, "333");
@@ -2540,6 +2569,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "333");
@@ -2737,6 +2767,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
if (pos[0] != ':')
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
@@ -2768,15 +2799,19 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
}
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create nick \"%s\" for channel \"%s\"\n"),
WEECHAT_ERROR, pos_nick, ptr_channel->name);
+ }
}
}
gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
@@ -2920,6 +2955,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick1) == 0)
{
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 2nd nickname \"%s\"\n"),
@@ -2931,6 +2967,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick2) == 0)
{
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 3rd nickname \"%s\"\n"),
@@ -2942,6 +2979,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick3) == 0)
{
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: all declared nicknames are already in use, "
"closing connection with server!\n"),
@@ -2951,6 +2989,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 1st nickname \"%s\"\n"),
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 6f6e72ac7..e2a9fc402 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -56,6 +56,7 @@ irc_login (t_irc_server *server)
hostname[sizeof (hostname) - 1] = '\0';
if (!hostname[0])
strcpy (hostname, _("unknown"));
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf (server->buffer,
_("%s: using local hostname \"%s\"\n"),
PACKAGE_NAME, hostname);
@@ -266,9 +267,12 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
argv[i]);
}
else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "deop");
+ }
return 0;
}
@@ -290,6 +294,7 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "devoice");
@@ -390,6 +395,7 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "kick");
@@ -497,6 +503,7 @@ irc_cmd_send_me (t_irc_server *server, char *arguments)
{
if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "me");
@@ -563,6 +570,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
{
if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "msg *");
@@ -579,9 +587,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
COLOR_WIN_CHAT, "%s\n", pos);
}
else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
+ }
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
}
else
@@ -601,9 +612,12 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
COLOR_WIN_CHAT, "%s\n", pos);
}
else
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
+ }
}
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
}
@@ -628,6 +642,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
}
}
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color_type (server->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "-");
@@ -650,6 +665,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
@@ -680,6 +696,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "msg");
@@ -701,6 +718,7 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
{
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "names");
@@ -742,15 +760,17 @@ irc_cmd_send_notice (t_irc_server *server, char *arguments)
pos++;
while (pos[0] == ' ')
pos++;
- server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
gui_printf_color (server->buffer, COLOR_WIN_CHAT, "notice");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, "(");
gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, "%s", arguments);
gui_printf_color (server->buffer, COLOR_WIN_CHAT_DARK, ")");
gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
+ server_sendf (server, "NOTICE %s :%s\r\n", arguments, pos);
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s wrong argument count for \"%s\" command\n"),
WEECHAT_ERROR, "notice");
@@ -777,6 +797,7 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "op");
@@ -824,6 +845,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
{
if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
@@ -837,6 +859,7 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
{
if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
@@ -913,6 +936,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
if (!ptr_channel)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
@@ -1144,6 +1168,7 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
{
if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "topic");
@@ -1249,6 +1274,7 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "voice");
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 3fa6e745a..6ad7ea13d 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -394,8 +394,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
#endif
buf2 = weechat_convert_encoding (local_charset, cfg_look_charset_encode, buffer);
if (server_send (server, buf2, strlen (buf2)) <= 0)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
+ }
free (buf2);
}
@@ -411,6 +414,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
message = (t_irc_message *) malloc (sizeof (t_irc_message));
if (!message)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
@@ -422,9 +426,12 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
message->data = (char *) malloc (strlen (unterminated_message) +
strlen (msg) + 1);
if (!message->data)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
+ }
else
{
strcpy (message->data, unterminated_message);
@@ -485,13 +492,17 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
if (!unterminated_message)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
+ }
else
strcpy (unterminated_message, buffer);
return;
}
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s unable to explode received buffer\n"),
WEECHAT_ERROR);
@@ -566,17 +577,20 @@ server_msgq_flush ()
command, args))
{
case -1:
+ irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
- _("Command '%s' failed!\n"), command);
+ _("%s Command '%s' failed!\n"), WEECHAT_ERROR, command);
break;
case -2:
+ irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
- _("No command to execute!\n"));
+ _("%s No command to execute!\n"), WEECHAT_ERROR);
break;
case -3:
+ irc_display_prefix (recv_msgq->server->buffer, PREFIX_ERROR);
gui_printf (recv_msgq->server->buffer,
- _("Unknown command: cmd=%s, args=%s\n"),
- command, args);
+ _("%s Unknown command: cmd=%s, args=%s\n"),
+ WEECHAT_ERROR, command, args);
break;
}
}
@@ -612,6 +626,7 @@ server_recv (t_irc_server *server)
}
else
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot read data from socket, disconnecting from server...\n"),
WEECHAT_ERROR);
@@ -633,6 +648,7 @@ server_connect (t_irc_server *server)
int error;
int server_pipe[2];
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: connecting to %s:%d...\n"),
PACKAGE_NAME, server->address, server->port);
@@ -643,6 +659,7 @@ server_connect (t_irc_server *server)
/* create pipe */
if (pipe (server_pipe) < 0)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot create pipe\n"), WEECHAT_ERROR);
server_free (server);
@@ -657,21 +674,28 @@ server_connect (t_irc_server *server)
if (setsockopt
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
sizeof (set)) == -1)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%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)
+ {
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_ERROR);
+ }
/* bind to hostname */
ip4_hostent = gethostbyname (server->address);
if (!ip4_hostent)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s address \"%s\" not found\n"),
WEECHAT_ERROR, server->address);
@@ -688,13 +712,15 @@ server_connect (t_irc_server *server)
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
if (error != 0)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
- WEECHAT_ERORR "server_connect: can't bind to hostname\n");
+ _("%s can't bind to hostname\n"), WEECHAT_ERROR);
return 0;
- } */
+ }*/
ip_address = inet_ntoa (addr.sin_addr);
if (!ip_address)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s IP address not found\n"), WEECHAT_ERROR);
close (server->server_read);
@@ -705,12 +731,14 @@ server_connect (t_irc_server *server)
}
/* connection to server */
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer,
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
if (error != 0)
{
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
close (server->server_read);
@@ -730,6 +758,7 @@ server_connect (t_irc_server *server)
void
server_reconnect (t_irc_server *server)
{
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("%s: Reconnecting to server...\n"),
PACKAGE_NAME);
server->reconnect_start = 0;
@@ -742,6 +771,7 @@ server_reconnect (t_irc_server *server)
else
{
server->reconnect_start = time (NULL);
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
PACKAGE_NAME, server->autoreconnect_delay);
}
@@ -813,6 +843,7 @@ server_disconnect (t_irc_server *server, int reconnect)
if ((reconnect) && (server->autoreconnect))
{
server->reconnect_start = time (NULL);
+ irc_display_prefix (server->buffer, PREFIX_INFO);
gui_printf (server->buffer, _("%s: Reconnecting to server in %d seconds\n"),
PACKAGE_NAME, server->autoreconnect_delay);
}
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 007e9ebb0..dce8ae936 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -269,6 +269,7 @@ extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
char *, char *);
+extern void irc_display_server (t_irc_server *ptr_server);
/* IRC protocol (irc-commands.c) */