summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-config.c9
-rw-r--r--src/plugins/irc/irc-config.h1
-rw-r--r--src/plugins/irc/irc-server.c11
3 files changed, 17 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 650a5264a..72d31f44f 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -120,6 +120,7 @@ struct t_config_option *irc_config_color_topic_new;
/* IRC config, network section */
+struct t_config_option *irc_config_network_alternate_nick;
struct t_config_option *irc_config_network_autoreconnect_delay_growing;
struct t_config_option *irc_config_network_autoreconnect_delay_max;
struct t_config_option *irc_config_network_colors_receive;
@@ -2471,6 +2472,14 @@ irc_config_init ()
return 0;
}
+ irc_config_network_alternate_nick = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "alternate_nick", "boolean",
+ N_("get an alternate nick when the nick is already used on server: add "
+ "some \"_\" until the nick has a length of 9, and then replace last "
+ "char (or the two last chars) by a number from 1 to 99, until we "
+ "find a nick not used on server"),
+ NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_network_autoreconnect_delay_growing = weechat_config_new_option (
irc_config_file, ptr_section,
"autoreconnect_delay_growing", "integer",
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 447d366bd..085ae3aa5 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -149,6 +149,7 @@ extern struct t_config_option *irc_config_color_reason_quit;
extern struct t_config_option *irc_config_color_topic_old;
extern struct t_config_option *irc_config_color_topic_new;
+extern struct t_config_option *irc_config_network_alternate_nick;
extern struct t_config_option *irc_config_network_autoreconnect_delay_growing;
extern struct t_config_option *irc_config_network_autoreconnect_delay_max;
extern struct t_config_option *irc_config_network_colors_receive;
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 6ef24337a..018cb59b9 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -551,10 +551,13 @@ irc_server_get_alternate_nick (struct t_irc_server *server)
return nick;
}
- /*
- * we have tried all nicks in list, then use main nick
- * and we will add "_" and then number if needed
- */
+ /* now we have tried all nicks in list */
+
+ /* if alternate nick is disabled, just return NULL */
+ if (!weechat_config_boolean (irc_config_network_alternate_nick))
+ return NULL;
+
+ /* use main nick and we will add "_" and then number if needed */
server->nick_alternate_number = 0;
snprintf (nick, sizeof (nick), "%s", server->nicks_array[0]);
}