use strict;
use warnings;
+use Exporter;
+
use Onis::Config qw(get_config);
use Onis::Html qw(get_filehandle);
use Onis::Language qw(translate);
use Onis::Data::Core qw(register_plugin get_main_nick nick_to_ident nick_to_name);
-use Onis::Users (qw(ident_to_name));
use Onis::Data::Persistent;
+=head1 NAME
+
+Onis::Plugins::Conversations - Who talks with who
+
+=head1 DESCRIPTION
+
+This plugins tries to recignise conversations and counts the amount that people
+talk to each other.
+
+=cut
+
+@Onis::Plugins::Conversations::EXPORT_OK = (qw(get_conversations));
+@Onis::Plugins::Conversations::ISA = ('Exporter');
+
our $ConversationCache = Onis::Data::Persistent->new ('ConversationCache', 'partners', qw(time0 time1 time2 time3));
our $ConversationData = {};
for (3, 2, 1, 0)
{
my $i = $img[$_];
- my $w = int (0.5 + ($rec->{'users'}{$nick0}[$_] * $factor));
+ my $w = int (0.5 + ($rec->{'nicks'}{$nick0}[$_] * $factor));
my $c = '';
$w ||= 1;
for (0, 1, 2, 3)
{
my $i = $img[$_];
- my $w = int (0.5 + ($rec->{'users'}{$nick1}[$_] * $factor));
+ my $w = int (0.5 + ($rec->{'nicks'}{$nick1}[$_] * $factor));
my $c = '';
$w ||= 1;
print $fh "</table>\n\n";
}
+=head1 EXPORTED FUNCTIONS
+
+=over 4
+
+=item B<get_conversations> (I<$nick>)
+
+Returns a hashref to the conversations this nick was involved with. The layout
+is the following. I<$other> is the nick of the person I<$nick> chattet with.
+The arrays hold the number of characters written by the nick used as the key.
+The first field contains the characters for the hours 0-5, the second field
+holds 6-11 and so on.
+
+ {
+ $other =>
+ {
+ total => 0,
+ nicks =>
+ {
+ $nick => [0, 0, 0, 0],
+ $other => [0, 0, 0, 0]
+ }
+ },
+ ...
+ }
+
+=cut
+
sub get_conversations
{
my $nick = shift;
return ($ConversationData->{$nick});
}
}
+
+=back
+
+=head1 AUTHOR
+
+Florian octo Forster, E<lt>octo at verplant.orgE<gt>
+
+=cut