3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

Do not lowercase hostmask/nicks in message history (quotegrab now preserves nick case)

This commit is contained in:
Pragmatic Software 2013-11-14 06:35:40 +00:00
parent d83fbf83db
commit f618b29282
3 changed files with 9 additions and 7 deletions

View File

@ -213,14 +213,10 @@ sub check_flood {
my ($self, $channel, $nick, $user, $host, $text, $max_messages, $max_time, $mode) = @_;
$channel = lc $channel;
my $mask = lc "$nick!$user\@$host";
my $mask = "$nick!$user\@$host";
$self->{pbot}->logger->log(sprintf("%-14s | %-65s | %s\n", $channel eq $mask ? "QUIT" : $channel, $mask, $text));
$nick = lc $nick;
$user = lc $user;
$host = lc $host;
my $account = $self->get_flood_account($nick, $user, $host);
if(not defined $account) {

View File

@ -137,7 +137,7 @@ sub export_quotegrabs() {
}
$last_channel = "";
foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or $$a{nick} cmp $$b{nick} } @{ $self->{quotegrabs} }) {
foreach my $quotegrab (sort { $$a{channel} cmp $$b{channel} or lc $$a{nick} cmp lc $$b{nick} } @{ $self->{quotegrabs} }) {
if(not $quotegrab->{channel} =~ /^$last_channel$/i) {
print FILE "</tbody>\n</table>\n" if $had_table;
print FILE "<a name='" . $quotegrab->{channel} . "'></a>\n";
@ -236,6 +236,10 @@ sub grab_quotegrab {
return "/msg $nick Please choose a history between 1 and $self->{pbot}->{MAX_NICK_MESSAGES}";
}
if(not $channel =~ m/^#/) {
return "'$channel' is not a valid channel; usage: grab <nick> [[history] channel] (you must specify a history parameter before the channel parameter)";
}
my $found_mask = undef;
my $last_spoken = 0;
foreach my $mask (keys %{ $self->{pbot}->antiflood->message_history }) {
@ -252,6 +256,8 @@ sub grab_quotegrab {
return "No message history for $grab_nick in channel $channel. Usage: grab <nick> [history [channel]]; to specify channel, you must also specify history";
}
($grab_nick) = $found_mask =~ m/^([^!]+)!/; # convert $grab_nick to match casing of nick
if(not exists $self->{pbot}->antiflood->message_history->{$found_mask}->{channels}->{$channel}) {
return "No message history for $grab_nick in channel $channel. Usage: grab <nick> [history [channel]]; to specify channel, you must also specify history";
}

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 464,
BUILD_REVISION => 466,
BUILD_DATE => "2013-11-13",
};