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

Fixed /connect and /disconnect commands, improved output of some commands

This commit is contained in:
Sebastien Helleu
2005-02-21 20:29:55 +00:00
parent 6199f9b629
commit 559b651669
12 changed files with 330 additions and 390 deletions
+18 -36
View File
@@ -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, "] (");
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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"
+1 -13
View File
@@ -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]) ?