package BarnOwl::Style::LizDenys;
use base qw(BarnOwl::Style::Default);

sub description {'lizdenys\'s custom style'}
BarnOwl::create_style('lizdenys', 'BarnOwl::Style::LizDenys');

sub chat_header {
    my $self = shift;
    my $m = shift;
    my $header;
    if ($m->is_personal) {
        my $personal_context = $m->personal_context;
        $personal_context = ' [' . $self->humanize($personal_context, 1) . ']' 
                            if $personal_context;
        if ($m->direction eq 'out') {
            $header = ucfirst $m->type . $personal_context . ' sent to ' . 
                      lc($m->pretty_recipient);
        } else {
            $header = ucfirst $m->type . $personal_context . ' from ' . 
                      lc($m->pretty_sender);
        }
    } else {
        $header = $self->humanize($m->context, 1);
        if (defined $m->subcontext) {
            $header .= ' / ' . $self->humanize($m->subcontext, 1);
        }
         $header .= ' / ' . '@b{' . $m->pretty_sender . '}';
    }
    if($m->opcode) {
        $header .= ' (' . $self->humanize($m->opcode, 1) . ')';
    }
    my $authstr = ($m->auth eq 'YES') ? ' + ' : ' - ';
    $header .= $authstr . $self->format_time($m);
    my $sighost = '[';
    if ($m->host) {
        $sighost .= lc($m->host) . ' / ';
    }
    my $sig = substr($self->format_sender($m), 3, -1);
    $sighost .= $sig . ']';
    $header .= ' ' . $sighost;
    return $header;
}

BarnOwl::admin_message('Style', 'Loaded lizdenys style');
