1
- # Copyright (C) 2014 CrazyCat <[email protected] >
2
- #
3
1
# This program is free software; you can redistribute it and/or modify
4
2
# it under the terms of the GNU General Public License as published by
5
3
# the Free Software Foundation; either version 3 of the License, or
44
42
# => CrazyCat on net1 and net3, GatoLoco on net2
45
43
#
46
44
# 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
47
48
# 2014-04-01, CrazyCat <[email protected] >:
48
49
# version 0.1 : first official version
49
50
50
- weechat::register(" mnick" , " CrazyCat" , " 0.1 " , " GPL" , " Multi Nick Changer" , " " , " " );
51
+ weechat::register(" mnick" , " CrazyCat" , " 0.2 " , " GPL" , " Multi Nick Changer" , " " , " " );
51
52
weechat::hook_command(
52
53
" mnick" ,
53
54
" Multi Nick Changer" ,
58
59
" "
59
60
);
60
61
61
- # Unused yet
62
- # weechat::hook_config("plugins.var.perl.mnick.*", "mnick_setup", "");
63
-
64
62
sub mnick_setup
65
63
{
66
64
$ infolist = weechat::infolist_get(" irc_server" , " " , " " );
@@ -91,7 +89,8 @@ sub mnick_change
91
89
my $ name = weechat::infolist_string($ infolist , " name" );
92
90
my $ nick = weechat::info_get(' irc_nick' , $ name );
93
91
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 )
95
94
{
96
95
$ newnick = sprintf ($ nick . weechat::config_get_plugin($ name . " _mask" ), $ text );
97
96
weechat::config_set_plugin($ name . " _backnick" , $ nick );
@@ -104,7 +103,8 @@ sub mnick_change
104
103
my $ name = weechat::infolist_string($ infolist , " name" );
105
104
my $ nick = weechat::info_get(' irc_nick' , $ name );
106
105
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 )
108
108
{
109
109
if (weechat::config_is_set_plugin($ name . " _backnick" )
110
110
&& weechat::config_get_plugin($ name . " _backnick" ) ne " " ) {
0 commit comments