summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-02-21 20:29:55 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-02-21 20:29:55 +0000
commit559b651669b17ed8015cefc0e25a4ff52f9cdb45 (patch)
tree63a0aff6c3151da85f613423454c9df50f738fc5 /src
parent6199f9b629e406f90a17a998e80f37854ca27e60 (diff)
downloadweechat-559b651669b17ed8015cefc0e25a4ff52f9cdb45.zip
Fixed /connect and /disconnect commands, improved output of some commands
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c54
-rw-r--r--src/gui/curses/gui-display.c4
-rw-r--r--src/irc/irc-commands.c4
-rw-r--r--src/irc/irc-display.c14
4 files changed, 23 insertions, 53 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 74d4af84c..c706139a3 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -767,12 +767,11 @@ weechat_cmd_alias (char *arguments)
/* List all aliases */
if (weechat_alias)
{
- irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("List of aliases:\n"));
for (ptr_alias = weechat_alias; ptr_alias;
ptr_alias = ptr_alias->next_alias)
{
- irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, " %s => %s\n",
ptr_alias->alias_name,
ptr_alias->alias_command + 1);
@@ -841,12 +840,11 @@ weechat_cmd_buffer (int argc, char **argv)
{
/* list opened buffers */
- irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened buffers:\n"));
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
- irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", ptr_buffer->number);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] ");
@@ -948,7 +946,7 @@ weechat_cmd_buffer (int argc, char **argv)
if (argc < 2)
{
/* display notify level for all buffers */
- irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Notify levels: "));
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1057,13 +1055,11 @@ weechat_cmd_connect (int argc, char **argv)
{
t_irc_server *ptr_server;
- /* make gcc happy */
- (void) argc;
-
if (argc == 1)
ptr_server = server_search (argv[0]);
else
ptr_server = SERVER(gui_current_window->buffer);
+
if (ptr_server)
{
if (ptr_server->is_connected)
@@ -1071,7 +1067,7 @@ weechat_cmd_connect (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s already connected to server \"%s\"!\n"),
- WEECHAT_ERROR, argv[0]);
+ WEECHAT_ERROR, ptr_server->name);
return -1;
}
if (ptr_server->child_pid > 0)
@@ -1079,7 +1075,7 @@ weechat_cmd_connect (int argc, char **argv)
irc_display_prefix (NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s currently connecting to server \"%s\"!\n"),
- WEECHAT_ERROR, argv[0]);
+ WEECHAT_ERROR, ptr_server->name);
return -1;
}
if (!ptr_server->buffer)
@@ -1111,13 +1107,11 @@ weechat_cmd_disconnect (int argc, char **argv)
{
t_irc_server *ptr_server;
- /* make gcc happy */
- (void) argc;
-
if (argc == 1)
ptr_server = server_search (argv[0]);
else
ptr_server = SERVER(gui_current_window->buffer);
+
if (ptr_server)
{
if ((!ptr_server->is_connected) && (ptr_server->child_pid == 0)
@@ -1126,7 +1120,7 @@ weechat_cmd_disconnect (int argc, char **argv)
irc_display_prefix (ptr_server->buffer, PREFIX_ERROR);
gui_printf (ptr_server->buffer,
_("%s not connected to server \"%s\"!\n"),
- WEECHAT_ERROR, argv[0]);
+ WEECHAT_ERROR, ptr_server->name);
return -1;
}
if (ptr_server->reconnect_start > 0)
@@ -1159,10 +1153,7 @@ weechat_cmd_help (int argc, char **argv)
if (argc == 0)
{
gui_printf (NULL, "\n");
- gui_printf (NULL,
- _("%s internal commands:\n"),
- PACKAGE_NAME);
- gui_printf (NULL, "\n");
+ gui_printf (NULL, _("%s internal commands:\n"), PACKAGE_NAME);
for (i = 0; weechat_commands[i].command_name; i++)
{
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, " %s",
@@ -1172,7 +1163,6 @@ weechat_cmd_help (int argc, char **argv)
}
gui_printf (NULL, "\n");
gui_printf (NULL, _("IRC commands:\n"));
- gui_printf (NULL, "\n");
for (i = 0; irc_commands[i].command_name; i++)
{
if (irc_commands[i].cmd_function_args || irc_commands[i].cmd_function_1arg)
@@ -1255,7 +1245,7 @@ weechat_cmd_perl (int argc, char **argv)
{
case 0:
/* list registered Perl scripts */
- irc_display_prefix (NULL, PREFIX_PLUGIN);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Registered Perl scripts:\n"));
if (perl_scripts)
{
@@ -1277,7 +1267,7 @@ weechat_cmd_perl (int argc, char **argv)
}
/* list Perl message handlers */
- irc_display_prefix (NULL, PREFIX_PLUGIN);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Perl message handlers:\n"));
handler_found = 0;
for (ptr_plugin_handler = plugin_msg_handlers; ptr_plugin_handler;
@@ -1299,7 +1289,7 @@ weechat_cmd_perl (int argc, char **argv)
}
/* list Perl command handlers */
- irc_display_prefix (NULL, PREFIX_PLUGIN);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Perl command handlers:\n"));
handler_found = 0;
for (ptr_plugin_handler = plugin_cmd_handlers; ptr_plugin_handler;
@@ -1672,7 +1662,6 @@ weechat_set_cmd_display_option (t_config_option *option, char *prefix, void *val
{
char *color_name, *pos_nickserv, *pos_pwd, *value2;
- irc_display_prefix (NULL, PREFIX_INFO);
gui_printf (NULL, " %s%s%s",
(prefix) ? prefix : "",
(prefix) ? "." : "",
@@ -1797,8 +1786,7 @@ weechat_cmd_set (char *arguments)
switch (config_set_server_value (ptr_server, pos + 1, value))
{
case 0:
- irc_display_prefix (NULL, PREFIX_INFO);
- gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
config_sections[CONFIG_SECTION_SERVER].section_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
@@ -1850,8 +1838,7 @@ weechat_cmd_set (char *arguments)
if (config_option_set_value (ptr_option, value) == 0)
{
(void) (ptr_option->handler_change());
- irc_display_prefix (NULL, PREFIX_INFO);
- gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s", config_get_section (ptr_option));
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "]\n");
@@ -1890,8 +1877,7 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
- irc_display_prefix (NULL, PREFIX_INFO);
- gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL,
"%s",
config_sections[i].section_name);
@@ -1919,8 +1905,7 @@ weechat_cmd_set (char *arguments)
{
if (!section_displayed)
{
- irc_display_prefix (NULL, PREFIX_INFO);
- gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "\n[");
gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%s",
config_sections[CONFIG_SECTION_SERVER].section_name);
gui_printf_color (NULL, COLOR_WIN_CHAT_NICK, " %s",
@@ -1942,7 +1927,6 @@ weechat_cmd_set (char *arguments)
}
if (number_found == 0)
{
- irc_display_prefix (NULL, PREFIX_INFO);
if (option)
gui_printf (NULL, _("No config option found with \"%s\"\n"),
option);
@@ -1951,8 +1935,7 @@ weechat_cmd_set (char *arguments)
}
else
{
- irc_display_prefix (NULL, PREFIX_INFO);
- gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "%d ", number_found);
+ gui_printf_color (NULL, COLOR_WIN_CHAT_CHANNEL, "\n%d ", number_found);
if (option)
gui_printf (NULL, _("config option(s) found with \"%s\"\n"),
option);
@@ -2006,13 +1989,12 @@ weechat_cmd_window (int argc, char **argv)
{
/* list opened windows */
- irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened windows:\n"));
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- irc_display_prefix (NULL, PREFIX_INFO);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "[");
gui_printf (NULL, "%d", i);
gui_printf_color (NULL, COLOR_WIN_CHAT_DARK, "] (");
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 346335e19..714becff1 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -639,7 +639,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
(ptr_dcc == dcc_selected) ?
COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
mvwprintw (ptr_win->win_chat, i, 0, "%s %-16s %s",
- (ptr_dcc == dcc_selected) ? "**" : " ",
+ (ptr_dcc == dcc_selected) ? "***" : " ",
ptr_dcc->nick, ptr_dcc->filename);
if (ptr_dcc->filename_suffix > 0)
wprintw (ptr_win->win_chat, " (.%d)",
@@ -648,7 +648,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
(ptr_dcc == dcc_selected) ?
COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
mvwprintw (ptr_win->win_chat, i + 1, 0, "%s %s ",
- (ptr_dcc == dcc_selected) ? "**" : " ",
+ (ptr_dcc == dcc_selected) ? "***" : " ",
(ptr_dcc->type == DCC_FILE_RECV) ? "-->>" : "<<--");
gui_window_set_color (ptr_win->win_chat,
COLOR_DCC_WAITING + ptr_dcc->status);
diff --git a/src/irc/irc-commands.c b/src/irc/irc-commands.c
index f6bd3de77..88cc8065b 100644
--- a/src/irc/irc-commands.c
+++ b/src/irc/irc-commands.c
@@ -123,7 +123,7 @@ t_irc_command irc_commands[] =
" i: mark a user as invisible\n"
" s: mark a user for receive server notices\n"
" w: user receives wallops\n"
- " o: operator flag\n"),
+ " o: operator flag"),
1, MAX_ARGS, 1, NULL, irc_cmd_send_mode, irc_cmd_recv_mode },
{ "motd", N_("get the \"Message Of The Day\""),
N_("[target]"),
@@ -236,7 +236,7 @@ t_irc_command irc_commands[] =
1, MAX_ARGS, 1, NULL, irc_cmd_send_wallops, NULL },
{ "who", N_("generate a query which returns a list of information"),
N_("[mask [\"o\"]]"), N_("mask: only information which match this mask\n"
- "o: only operators are returned according to the mask supplied\n"),
+ "o: only operators are returned according to the mask supplied"),
0, 2, 1, NULL, irc_cmd_send_who, NULL },
{ "whois", N_("query information about user(s)"),
N_("[server] nickname[,nickname]"), N_("server: server name\n"
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index e231027f7..6bcd216b8 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -149,7 +149,7 @@ irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
void
irc_display_server (t_irc_server *server)
{
- irc_display_prefix (NULL, PREFIX_INFO);
+ gui_printf (NULL, "\n");
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, " [");
@@ -157,58 +157,46 @@ irc_display_server (t_irc_server *server)
(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]) ?