X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=lib%2FOnis%2FPlugins%2FWords.pm;h=65c1f7bc7cc8753c50fd7e2127791e9bd1d12996;hb=572ca233bb6a1ad08df5f42175595129bdd5c04f;hp=77078483f4b26e41a66cff2524be00e936bd417a;hpb=e13a37ca21a73794e4e451944db6f23c088da090;p=onis.git diff --git a/lib/Onis/Plugins/Words.pm b/lib/Onis/Plugins/Words.pm index 7707848..65c1f7b 100644 --- a/lib/Onis/Plugins/Words.pm +++ b/lib/Onis/Plugins/Words.pm @@ -6,8 +6,9 @@ use warnings; use Onis::Config (qw(get_config)); use Onis::Html (qw(get_filehandle)); use Onis::Language (qw(translate)); -use Onis::Data::Core (qw(register_plugin)); +use Onis::Data::Core (qw(register_plugin get_main_nick)); use Onis::Data::Persistent (); +use Onis::Users (qw(nick_to_name)); register_plugin ('TEXT', \&add); register_plugin ('ACTION', \&add); @@ -48,7 +49,6 @@ sub add my ($counter) = $WordCache->get ($word); $counter ||= 0; $counter++; - $WordCache->put ($word, $counter, $time, $nick); } } @@ -83,7 +83,7 @@ sub calculate push (@data, [$word, $counter, $nick, $lastusedtime]); } - @$WordData = sort { $b->[0] <=> $a->[0] } (@data); + @$WordData = sort { $b->[1] <=> $a->[1] } (@data); splice (@$WordData, $max); } @@ -114,12 +114,13 @@ EOF $i++; my ($word, $count, $nick) = @$_; + my $name = nick_to_name ($nick) || $nick; print $fh " \n", qq# $i\n#, qq# $word\n#, qq# $count\n#, - qq# $nick\n#, + qq# $name\n#, qq# \n#; } print $fh "\n\n";