# Copyright (c) 2008 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: ExtraHeaders.pm,v 1.1 2008/02/25 03:10:47 nagler Exp $ package Bivio::UI::Mail::Widget::ExtraHeaders; use strict; use Bivio::Base 'UI.Widget'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.1 $ =~ /\d+/g); sub initialize { my($self) = @_; my($values) = $self->get('values'); while (my($k, $v) = each(%$values)) { $self->initialize_value($k, $v); } return; } sub internal_new_args { shift; return { values => {@_}, }; } sub mail_headers { my($self, $req) = @_; my($values) = $self->get('values'); return [ map({ my($v) = $self->render_simple_value($values->{$_}, $req); length($v) ? [$_ => $v] : (); } sort {lc($a) cmp lc($b)} keys(%$values)), ]; } sub render { my($self, $source, $buffer) = @_; # for testing only $$buffer .= join( '', map("$_->[0]: $_->[1]\n", @{$self->mail_headers($source)})); return; } 1;