From: octo Date: Thu, 14 Apr 2005 22:16:51 +0000 (+0000) Subject: The Bignumbers plugin now only displays Nicks that are in the main table. X-Git-Tag: Release-0.8.0~19 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b35e3c4286bacccb72237b1550b6281418f772d8;p=onis.git The Bignumbers plugin now only displays Nicks that are in the main table. --- diff --git a/lib/Onis/Plugins/Bignumbers.pm b/lib/Onis/Plugins/Bignumbers.pm index 46e5634..0332ee4 100644 --- a/lib/Onis/Plugins/Bignumbers.pm +++ b/lib/Onis/Plugins/Bignumbers.pm @@ -9,7 +9,7 @@ use Onis::Html (qw(get_filehandle)); use Onis::Language (qw(translate)); use Onis::Data::Core (qw(get_main_nick register_plugin nick_to_name)); use Onis::Data::Persistent (); -use Onis::Plugins::Core (qw(get_core_nick_counters)); +use Onis::Plugins::Core (qw(get_core_nick_counters nick_is_in_main_table)); @Onis::Plugins::Bignumbers::EXPORT_OK = (qw(get_bignumbers)); @Onis::Plugins::Bignumbers::ISA = ('Exporter'); @@ -387,6 +387,7 @@ sub sort_by_field defined ($CalcData->{$_}{'lines'}) and ($CalcData->{$_}{'lines'} != 0) and defined ($CalcData->{$_}{$field}) + and (nick_is_in_main_table ($_) > 0) } (keys (%$CalcData)); diff --git a/lib/Onis/Plugins/Core.pm b/lib/Onis/Plugins/Core.pm index da58275..1423fb2 100644 --- a/lib/Onis/Plugins/Core.pm +++ b/lib/Onis/Plugins/Core.pm @@ -17,14 +17,14 @@ complicated plugin so far. =cut -use Onis::Config qw/get_config/; -use Onis::Html qw/html_escape get_filehandle/; -use Onis::Language qw/translate/; +use Onis::Config (qw(get_config)); +use Onis::Html (qw(html_escape get_filehandle)); +use Onis::Language (qw(translate)); use Onis::Users (qw(get_realname get_link get_image ident_to_name)); -use Onis::Data::Core qw#get_all_nicks nick_to_ident ident_to_nick get_main_nick register_plugin#; -use Onis::Data::Persistent; +use Onis::Data::Core (qw(get_all_nicks nick_to_ident ident_to_nick get_main_nick register_plugin)); +use Onis::Data::Persistent (); -@Onis::Plugins::Core::EXPORT_OK = (qw(get_core_nick_counters get_sorted_nicklist)); +@Onis::Plugins::Core::EXPORT_OK = (qw(get_core_nick_counters get_sorted_nicklist nick_is_in_main_table)); @Onis::Plugins::Core::ISA = ('Exporter'); our $NickLinesCounter = Onis::Data::Persistent->new ('NickLinesCounter', 'nick', @@ -53,6 +53,8 @@ our $QuoteData = {}; # Is generated before output. Nicks are merged according t our $NickData = {}; # Same as above, but for nicks rather than quotes. our $SortedNicklist = []; +our $NicksInMainTable = {}; + our @H_IMAGES = qw#dark-theme/h-red.png dark-theme/h-blue.png dark-theme/h-yellow.png dark-theme/h-green.png#; our $QuoteCacheSize = 10; our $QuoteMin = 30; @@ -735,6 +737,8 @@ EOF # our table.. if ($linescount <= $LongLines) { + $NicksInMainTable->{$nick} = $linescount; + my $quote = translate ('-- no quote available --'); if (@{$QuoteData->{$nick}}) @@ -1031,6 +1035,20 @@ sub get_sorted_nicklist return ($SortedNicklist); } +=item B (I<$nick>) + +Returns the position of the nick in the main table or zero if it is not in the +main table. + +=cut + +sub nick_is_in_main_table +{ + my $nick = shift; + + return (defined ($NicksInMainTable->{$nick}) ? $NicksInMainTable->{$nick} : 0); +} + =back =head1 AUTHOR