}
# Sometimes we have to hide server modes on quakenet too.
-sub nick_mode_changed {
- my ($channel_rec, $nick_rec, $setby, $mode, $type) = @_;
- my $tag = $channel_rec->{server}->{tag};
- my $nick = $nick_rec->{nick};
- # Return if we don't care about this tag
+sub message_irc_mode {
+ my ($server_rec, $channel, $nick, $addr, $mode) = @_;
+ my $tag = $server_rec->{tag};
+ # Return if we don't care about this tag.
if (process_tag($tag) == 0) {
return 0;
}
- Irssi::print "Processing MODE $tag: $nick $setby $mode $type";
+ Irssi::print "Processing MIM $tag: $channel $nick $addr $mode";
+ my $servermask = Irssi::settings_get_str('quakequit_servermask');
+ # break the target nicks away from the modes set on them.
+ my ($modes, @targets) = split / /, $mode, 2;
# If the nick exists in the hash and the mode setter is *.quakenet.org, signal_stop.
- if (($quits{$nick} == 1) and ($setby eq "*.quakenet.org")) {
- Irssi::signal_stop();
- return 0;
+ foreach my $target (@targets) {
+ if ($quits{$target} == 1) {
+ Irssi::signal_stop();
+ return 0;
+ }
}
}
-# Add a networks setting
+#sub nick_mode_changed {
+# my ($channel_rec, $nick_rec, $setby, $mode, $type) = @_;
+# my $tag = $channel_rec->{server}->{tag};
+# # Return if we don't care about this tag
+# if (process_tag($tag) == 0) {
+# return 0;
+# }
+# my $nick = $nick_rec->{nick};
+# my $servermask = Irssi::settings_get_str('quakequit_servermask');
+# Irssi::print "Processing MODE $tag: $nick $setby $mode $type";
+# # If the nick exists in the hash and the mode setter is *.quakenet.org, signal_stop.
+# #if (($quits{$nick} == 1) and (lc $setby eq lc $servermask)) {
+# if ($quits{$nick} == 1) {
+# if ($setby eq $servermask) {
+# print "Setby is matching quakenet.org";
+# }
+# Irssi::signal_stop();
+# return 0;
+# }
+#}
+
+## Settings
+# quakequit_networks: set the networks that you'd like this script to watch
+# quakequit_servermask: the name of the server that's setting the modes on rejoin
Irssi::settings_add_str('quakequit', 'quakequit_networks', 'QuakeNet');
+Irssi::settings_add_str('quakequit', 'quakequit_servermask', '*.quakenet.org');
# Signals to grab
-Irssi::signal_add('message join', 'message_join');
-Irssi::signal_add('message quit', 'message_quit');
-Irssi::signal_add('nick mode changed', 'nick_mode_changed');
+Irssi::signal_add_last('message irc mode', 'message_irc_mode');
+Irssi::signal_add_last('message join', 'message_join');
+Irssi::signal_add_last('message quit', 'message_quit');
+#Irssi::signal_add('nick mode changed', 'nick_mode_changed');