Subject: | halfop patch |
I added halfop in the same manner as voice.
No compile errors but I realy only used the halfop() method for setting the halfop.
patch for the file after the kill buggfix is applied.
--- DB.pm 2004-01-11 01:26:43.000000000 +0100
+++ DB.pm.new 2004-01-11 01:16:04.000000000 +0100
@@ -118,6 +118,7 @@
my $op = ($lc_nick =~ s/\@// ? 1 : 0);
my $voice = ($lc_nick =~ s/\+// ? 1 : 0);
+ my $halfop = ($lc_nick =~ s/\%// ? 1 : 0);
# Første bokstaven i et nick er en bokstav, sørg for at det ikke er noe fremmedlegmer før det.
# (Remove modes that I dont understand. (A nick starts with a alphachar))
@@ -125,8 +126,9 @@
$channels{"$lc_chan"}{'users'}{"$lc_nick"}{'op'}= $op;
$channels{"$lc_chan"}{'users'}{"$lc_nick"}{'voice'}= $voice;
+ $channels{"$lc_chan"}{'users'}{"$lc_nick"}{'halfop'}= $halfop;
- $users{"$lc_nick"}{'channels'}{"$lc_chan"}=($op?'@':'').($voice?'+':'');
+ $users{"$lc_nick"}{'channels'}{"$lc_chan"}=($op?'@':'').($voice?'+':'').($halfop?'%':'');
}
return if ($mode eq '0');
@@ -239,6 +241,9 @@
} elsif (/v/) {
my ($lc_nick, $lc_chan) = (_lc(shift @items), lc($target));
$channels{"$lc_chan"}{'users'}{"$lc_nick"}{'voice'}=1;
+ } elsif (/h/) {
+ my ($lc_nick, $lc_chan) = (_lc(shift @items), lc($target));
+ $channels{"$lc_chan"}{'users'}{"$lc_nick"}{'halfop'}=1;
} elsif (/l/) {
my $lc_chan = lc($target);
$channels{"$lc_chan"}{'limit'}=shift @items;
@@ -265,6 +270,11 @@
if (exists($channels{"$lc_chan"}{'users'}{"$lc_nick"}{'voice'})) {
delete($channels{"$lc_chan"}{'users'}{"$lc_nick"}{'voice'});
}
+ } elsif (/h/) {
+ my ($lc_nick, $lc_chan) = (_lc(shift @items), lc($target));
+ if (exists($channels{"$lc_chan"}{'users'}{"$lc_nick"}{'halfop'})) {
+ delete($channels{"$lc_chan"}{'users'}{"$lc_nick"}{'halfop'});
+ }
} elsif (/l/) {
my $lc_chan = lc($target);
if (exists($channels{"$lc_chan"}{'limit'})) {
@@ -413,7 +423,14 @@
my $lc_chan = lc(shift);
return $channels{"$lc_chan"}{'users'}{"$lc_nick"}{'voice'};
}
-
+
+sub has_halfop {
+ my $self = shift;
+ my $lc_nick = _lc(shift);
+ my $lc_chan = lc(shift);
+ return $channels{"$lc_chan"}{'users'}{"$lc_nick"}{'halfop'};
+}
+
sub channel_list {
my $self = shift;
my @l;
@@ -470,6 +487,7 @@
foreach (keys %{ $channels{"$lc_chan"}{'users'} }) {
$channels{"$lc_chan"}{'users'}{"$_"}{'op'} = 0;
$channels{"$lc_chan"}{'users'}{"$_"}{'voice'} = 0;
+ $channels{"$lc_chan"}{'users'}{"$_"}{'halfop'} = 0;
}
foreach (keys %{ $channels{"$lc_chan"}{'bans'} }) {
@@ -562,6 +580,18 @@
&_multimodes($from, $channel, '-o', @nicks);
}
+sub halfop {
+ my ($self, $from, $channel) = (shift, shift, shift);
+ my @nicks = @_;
+ &_multimodes($from, $channel, '+h', @nicks);
+}
+
+sub dehalfop {
+ my ($self, $from, $channel) = (shift, shift, shift);
+ my @nicks = @_;
+ &_multimodes($from, $channel, '-h', @nicks);
+}
+
sub voice {
my ($self, $from, $channel) = (shift, shift, shift);
my @nicks = @_;
@@ -573,7 +603,5 @@
my @nicks = @_;
&_multimodes($from, $channel, '-v', @nicks);
}
-
-
1;