Skip to content

Commit c05490f

Browse files
crazycatdevsflashcode
authored andcommitted
mnick.pl 0.2: send nick change only on connected servers
1 parent 84369c7 commit c05490f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

perl/mnick.pl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copyright (C) 2014 CrazyCat <[email protected]>
2-
#
31
# This program is free software; you can redistribute it and/or modify
42
# it under the terms of the GNU General Public License as published by
53
# the Free Software Foundation; either version 3 of the License, or
@@ -44,10 +42,13 @@
4442
# => CrazyCat on net1 and net3, GatoLoco on net2
4543
#
4644
# History:
45+
# 2015-01-09, CrazyCat <[email protected]>:
46+
# version 0.2 : corrected a stupid bug. Nick change is now only sent
47+
# to connected networks
4748
# 2014-04-01, CrazyCat <[email protected]>:
4849
# version 0.1 : first official version
4950

50-
weechat::register("mnick", "CrazyCat", "0.1", "GPL", "Multi Nick Changer", "", "");
51+
weechat::register("mnick", "CrazyCat", "0.2", "GPL", "Multi Nick Changer", "", "");
5152
weechat::hook_command(
5253
"mnick",
5354
"Multi Nick Changer",
@@ -58,9 +59,6 @@
5859
""
5960
);
6061

61-
# Unused yet
62-
#weechat::hook_config("plugins.var.perl.mnick.*", "mnick_setup", "");
63-
6462
sub mnick_setup
6563
{
6664
$infolist = weechat::infolist_get("irc_server", "", "");
@@ -91,7 +89,8 @@ sub mnick_change
9189
my $name = weechat::infolist_string($infolist, "name");
9290
my $nick = weechat::info_get('irc_nick', $name);
9391
if (weechat::config_is_set_plugin($name."_enabled")
94-
&& weechat::config_get_plugin($name."_enabled") eq "on")
92+
&& weechat::config_get_plugin($name."_enabled") eq "on"
93+
&& weechat::infolist_integer($infolist, "is_connected")==1)
9594
{
9695
$newnick = sprintf($nick . weechat::config_get_plugin($name."_mask"), $text);
9796
weechat::config_set_plugin($name."_backnick", $nick);
@@ -104,7 +103,8 @@ sub mnick_change
104103
my $name = weechat::infolist_string($infolist, "name");
105104
my $nick = weechat::info_get('irc_nick', $name);
106105
if (weechat::config_is_set_plugin($name."_enabled")
107-
&& weechat::config_get_plugin($name."_enabled") eq "on")
106+
&& weechat::config_get_plugin($name."_enabled") eq "on"
107+
&& weechat::infolist_integer($infolist, "is_connected")==1)
108108
{
109109
if (weechat::config_is_set_plugin($name."_backnick")
110110
&& weechat::config_get_plugin($name."_backnick") ne "") {

0 commit comments

Comments
 (0)