summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Paolone <marcopaolone@gmail.com>2009-11-26 01:01:31 +0100
committerMarco Paolone <marcopaolone@gmail.com>2009-11-26 01:01:31 +0100
commit5465fdfba8c862a9f3d25a956fd3a917a32579b9 (patch)
tree5f2236e5482e8509177f941217685d0a48c00a40 /src
parent56cc9b76cc445bceb4b7ddc109b05bc3b8e0e2cd (diff)
parentf8921025f6a285c9dc4003b0a500b7bd18e64a6a (diff)
downloadweechat-5465fdfba8c862a9f3d25a956fd3a917a32579b9.zip
Update italian translations
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-command.c102
-rw-r--r--src/plugins/irc/irc-protocol.c2
-rw-r--r--src/plugins/irc/irc-server.c58
-rw-r--r--src/plugins/irc/irc-server.h2
-rw-r--r--src/plugins/xfer/xfer.c13
5 files changed, 97 insertions, 80 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 0973a5cd5..18b6116e4 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -536,9 +536,8 @@ int
irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
- int i, nb_connect, connect_ok, all_servers, no_join, port, ipv6, ssl;
- char *name, *error;
- long number;
+ int i, nb_connect, connect_ok, all_servers, no_join;
+ char *name;
IRC_GET_SERVER(buffer);
@@ -548,9 +547,6 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
nb_connect = 0;
connect_ok = 1;
- port = IRC_SERVER_DEFAULT_PORT;
- ipv6 = 0;
- ssl = 0;
all_servers = 0;
no_join = 0;
@@ -560,26 +556,6 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
all_servers = 1;
if (weechat_strcasecmp (argv[i], "-nojoin") == 0)
no_join = 1;
- if (weechat_strcasecmp (argv[i], "-ipv6") == 0)
- ipv6 = 1;
- if (weechat_strcasecmp (argv[i], "-ssl") == 0)
- ssl = 1;
- if (weechat_strcasecmp (argv[i], "-port") == 0)
- {
- if (i == (argc - 1))
- {
- weechat_printf (NULL,
- _("%s%s: missing argument for \"%s\" "
- "option"),
- weechat_prefix ("error"), IRC_PLUGIN_NAME,
- "-port");
- return WEECHAT_RC_OK;
- }
- error = NULL;
- number = strtol (argv[++i], &error, 10);
- if (error && !error[0])
- port = number;
- }
}
if (all_servers)
@@ -625,16 +601,8 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc,
IRC_COLOR_CHAT_SERVER,
ptr_server->name,
IRC_COLOR_CHAT);
- if (ipv6)
- {
- weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_IPV6],
- "on", 1);
- }
- if (ssl)
- {
- weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_SSL],
- "on", 1);
- }
+ irc_server_apply_command_line_options (ptr_server,
+ argc, argv);
if (!irc_command_connect_one_server (ptr_server, 0))
connect_ok = 0;
}
@@ -3011,34 +2979,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc,
weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES],
argv[3], 1);
-
- /* parse arguments */
- for (i = 4; i < argc; i++)
- {
- if (argv[i][0] == '-')
- {
- if (weechat_strcasecmp (argv[i], "-auto") == 0)
- {
- weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT],
- "on", 1);
- }
- if (weechat_strcasecmp (argv[i], "-noauto") == 0)
- {
- weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT],
- "off", 1);
- }
- if (weechat_strcasecmp (argv[i], "-ipv6") == 0)
- {
- weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_IPV6],
- "on", 1);
- }
- if (weechat_strcasecmp (argv[i], "-ssl") == 0)
- {
- weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_SSL],
- "on", 1);
- }
- }
- }
+ irc_server_apply_command_line_options (new_server, argc, argv);
weechat_printf (NULL,
_("%s: server %s%s%s created"),
@@ -3870,8 +3811,8 @@ irc_command_init ()
weechat_hook_command ("connect",
N_("connect to IRC server(s)"),
N_("[-all [-nojoin] | servername [servername ...] "
- "[-nojoin] | hostname[/port] [-ipv6] "
- "[-ssl]]"),
+ "[-nojoin] | hostname[/port] [-option[=value]] "
+ "[-nooption]]"),
N_(" -all: connect to all servers\n"
"servername: internal server name to connect "
"(server must have been created by /server add)\n"
@@ -3879,8 +3820,16 @@ irc_command_init ()
"autojoin is enabled on server)\n"
" hostname: hostname (or IP) of a server\n"
" port: port for server (6667 by default)\n"
- " ipv6: use IPv6 protocol\n"
- " ssl: use SSL protocol"),
+ " option: set option for server (for boolean "
+ "option, value can be omitted)\n"
+ " nooption: set boolean option to 'off' (for "
+ "example: -nossl)\n\n"
+ "Examples:\n"
+ " /connect freenode\n"
+ " /connect irc.oftc.net/6667\n"
+ " /connect irc6.oftc.net/6667 -ipv6\n"
+ " /connect irc6.oftc.net/6697 -ipv6 -ssl\n"
+ " /connect my.server.org/6697 -ssl -password=test"),
"-all -nojoin"
" || %(irc_servers)|%*",
&irc_command_connect, NULL);
@@ -4224,8 +4173,8 @@ irc_command_init ()
weechat_hook_command ("server",
N_("list, add or remove IRC servers"),
N_("[list [servername]] | [listfull [servername]] | "
- "[add servername hostname[/port] "
- "[-auto | -noauto] [-ipv6] [-ssl]] | "
+ "[add servername hostname[/port] [-temp] "
+ "[-option[=value]] [-nooption]] | "
"[copy servername newservername] | "
"[rename servername newservername] | "
"[keep servername] | [del servername] | "
@@ -4239,12 +4188,11 @@ irc_command_init ()
"display use\n"
" hostname: name or IP address of server, with "
"optional port (default: 6667)\n"
- " auto: automatically connect to server "
- "when WeeChat starts\n"
- " noauto: do not connect to server when "
- "WeeChat starts (default)\n"
- " ipv6: use IPv6 protocol\n"
- " ssl: use SSL protocol\n"
+ " temp: create temporary server (not saved)\n"
+ " option: set option for server (for boolean "
+ "option, value can be omitted)\n"
+ " nooption: set boolean option to 'off' (for "
+ "example: -nossl)\n"
" copy: duplicate a server\n"
" rename: rename a server\n"
" keep: keep server in config file (for "
@@ -4257,7 +4205,7 @@ irc_command_init ()
" raw: open buffer with raw IRC data\n\n"
"Examples:\n"
" /server listfull\n"
- " /server add oftc irc.oftc.net/6697 -ssl\n"
+ " /server add oftc irc.oftc.net/6697 -ssl -autoconnect\n"
" /server add oftc6 irc6.oftc.net/6697 -ipv6 -ssl\n"
" /server add freenode2 chat.eu.freenode.net/6667,"
"chat.us.freenode.net/6667\n"
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index fe6d6413c..036469a62 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -841,7 +841,7 @@ irc_protocol_cmd_notice (struct t_irc_server *server, const char *command,
"notify_private"),
"%s%s",
irc_nick_as_prefix (NULL, nick,
- IRC_COLOR_CHAT_NICK_OTHER),
+ irc_nick_color_for_pv (ptr_channel, nick)),
pos_args);
}
else
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 2d3fbb14d..9bcba9a27 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -517,6 +517,64 @@ irc_server_alloc_with_url (const char *irc_url)
}
/*
+ * irc_server_apply_command_line_options: apply options on command line to a
+ * server
+ * for example:
+ * -ssl
+ * -nossl
+ * -password=test
+ * -proxy=myproxy
+ */
+
+void
+irc_server_apply_command_line_options (struct t_irc_server *server,
+ int argc, char **argv)
+{
+ int i, index_option;
+ char *pos, *option_name, *ptr_value, *value_boolean[2] = { "off", "on" };
+
+ for (i = 0; i < argc; i++)
+ {
+ if (argv[i][0] == '-')
+ {
+ pos = strchr (argv[i], '=');
+ ptr_value = value_boolean[0];
+ if (pos)
+ {
+ option_name = weechat_strndup (argv[i] + 1, pos - argv[i] - 1);
+ ptr_value = pos + 1;
+ }
+ else
+ {
+ option_name = strdup (argv[i] + 1);
+ ptr_value = value_boolean[1];
+ }
+ if (option_name)
+ {
+ index_option = irc_server_search_option (option_name);
+ if (index_option < 0)
+ {
+ /* look if option is negative, like "-noxxx" */
+ if (weechat_strncasecmp (argv[i], "-no", 3) == 0)
+ {
+ free (option_name);
+ option_name = strdup (argv[i] + 3);
+ index_option = irc_server_search_option (option_name);
+ ptr_value = value_boolean[0];
+ }
+ }
+ if (index_option >= 0)
+ {
+ weechat_config_option_set (server->options[index_option],
+ ptr_value, 1);
+ }
+ free (option_name);
+ }
+ }
+ }
+}
+
+/*
* irc_server_outqueue_add: add a message in out queue
*/
diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h
index c0214fd6b..4b456567a 100644
--- a/src/plugins/irc/irc-server.h
+++ b/src/plugins/irc/irc-server.h
@@ -173,6 +173,8 @@ extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks
extern void irc_server_set_nick (struct t_irc_server *server, const char *nick);
extern struct t_irc_server *irc_server_alloc (const char *name);
extern int irc_server_alloc_with_url (const char *irc_url);
+extern void irc_server_apply_command_line_options (struct t_irc_server *server,
+ int argc, char **argv);
extern void irc_server_free_all ();
extern struct t_irc_server *irc_server_copy (struct t_irc_server *server,
const char *new_name);
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 612e53646..5cadb2a58 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -630,13 +630,22 @@ xfer_new (const char *plugin_name, const char *plugin_id,
void
xfer_free (struct t_xfer *xfer)
{
- struct t_xfer *new_xfer_list;
+ struct t_xfer *new_xfer_list, *ptr_xfer;
+ struct t_gui_buffer *ptr_buffer;
if (!xfer)
return;
if (xfer->buffer)
- weechat_buffer_close (xfer->buffer);
+ {
+ ptr_buffer = xfer->buffer;
+ for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer)
+ {
+ if (ptr_xfer->buffer == ptr_buffer)
+ ptr_xfer->buffer = NULL;
+ }
+ weechat_buffer_close (ptr_buffer);
+ }
/* remove xfer from list */
if (last_xfer == xfer)