mirror of
https://github.com/perlbot/perlbuut
synced 2025-06-07 16:55:42 -04:00
Fix bug in channels sharing namespace.
This commit is contained in:
parent
422ace207c
commit
377fe7d9d5
3 changed files with 29 additions and 7 deletions
|
@ -55,6 +55,8 @@ http_plugin_port 1092
|
|||
channel \#perl-cats
|
||||
channel \#cout.dev
|
||||
channel \#web-locals
|
||||
channel \#regex
|
||||
channel \#regexen
|
||||
|
||||
ignore buubot
|
||||
ignore avarbot
|
||||
|
|
|
@ -45,8 +45,21 @@ server "*.freenode.net" {
|
|||
channel "#regex" {
|
||||
plugin "factoids" {
|
||||
addressed: false;
|
||||
namespaced: true;
|
||||
chanspace: "#regex";
|
||||
serverspace: "freenode.net";
|
||||
prefix_command: "!";
|
||||
filtersep: true;
|
||||
}
|
||||
plugin "default" {plugin: "factoids"; }
|
||||
}
|
||||
channel "#regexen" {
|
||||
plugin "factoids" {
|
||||
addressed: false;
|
||||
namespaced: true;
|
||||
chanspace: "#regex";
|
||||
serverspace: "freenode.net";
|
||||
prefix_command: "!";
|
||||
plugins: false;
|
||||
filtersep: true;
|
||||
}
|
||||
plugin "default" {plugin: "factoids"; }
|
||||
|
|
|
@ -78,7 +78,7 @@ sub get_conf_for_channel {
|
|||
my $gc = sub {$pm->plugin_conf($_[0], $server, $channel)};
|
||||
|
||||
# Load factoids if it exists, otherwise grab the old nfacts setup
|
||||
my $conf = $gc->("factoids") // $gc->("nfacts");
|
||||
my $conf = $gc->("factoids");
|
||||
return $conf;
|
||||
}
|
||||
|
||||
|
@ -93,23 +93,30 @@ sub get_namespaced_factoid {
|
|||
|
||||
return $body if $channel eq '*irc_msg' or $channel eq '##NULL';
|
||||
|
||||
warn "NAMESPACE: [ $channel , $server ]";
|
||||
open(my $fh, ">/tmp/notwut");
|
||||
|
||||
my $conf = $self->get_conf_for_channel($pm, $server, $channel);
|
||||
print $fh "NAMESPACE: [ $channel , $server ]";
|
||||
|
||||
warn Dumper($conf);
|
||||
my $conf = $self->get_conf_for_channel($pm, $said->{server}, $channel);
|
||||
|
||||
print $fh Dumper($conf);
|
||||
|
||||
my $realserver = $conf->{serverspace} // $server;
|
||||
my $realchannel = $conf->{chanspace} // $channel;
|
||||
|
||||
print $fh Dumper($realserver, $realchannel);
|
||||
|
||||
my $sepbody = $fsep.join($fsep, ($realserver, $realchannel, $body));
|
||||
|
||||
print $fh $sepbody, "\n";
|
||||
|
||||
return $sepbody;
|
||||
}
|
||||
|
||||
sub namespace_filter {
|
||||
my ($self, $body, $enabled) = @_;
|
||||
|
||||
return $body =~ s|$fsep[^$fsep]*?$fsep[^$fsep]*?$fsep(\S+)(?=\s)|$1|rg if $enabled;
|
||||
return $body =~ s|$fsep[^$fsep]*?$fsep[^$fsep]*?$fsep(\S+)|$1|rg if $enabled;
|
||||
$body;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue