Software Freedom Law Center

root/trunk/antimatter/tim/Modules/SFLC/TimeTracker/Output/EntryResolver.pm

Revision 53, 2.5 kB (checked in by bkuhn, 10 months ago)
  • Added SFLC's internally developed tim bot released under AGPLv3
Line 
1 # Copyright (C) 2005   Software Freedom Law Center, Inc.
2 #  Author: Bradley M. Kuhn <bkuhn@softwarefreedom.org>
3 #
4 #  This software gives you freedom; it is licensed to you under version
5 #  3 of the GNU Affero General Public License.
6 #
7 #  This software is distributed WITHOUT ANY WARRANTY, without even the
8 #  implied warranties of MERCHANTABILITY and FITNESS FOR A PARTICULAR
9 #  PURPOSE.  See the GNU Affero General Public License for further
10 #  details.
11 #
12 # You should have received a copy of the GNU Affero General Public
13 # License, version 3 along with this software.  If not, see
14 # <http://www.gnu.org/licenses/>.
15 package SFLC::TimeTracker::Output::EntryResolver;
16
17 use strict;
18 use warnings;
19
20 use base qw(SFLC::TimeTracker::Output);
21
22 ###############################################################################
23 sub new {
24   my($class, %input) = @_;
25
26   $input{object} = $input{entryList} if defined $input{entryList};
27
28   $input{object} = [] if not defined $input{object};
29   my $self = SFLC::TimeTracker::Output::new($class, %input);
30
31 }
32 ###############################################################################
33 sub get {
34   my($self, $field) = @_;
35   if ($field =~ /^(?:entryList)$/) {
36     return @{$self->SUPER::get('object')};
37   } else {
38     return $self->SUPER::get($field);
39   }
40 }
41 ###############################################################################
42 sub set {
43   my($self, $field, $val) = @_;
44   if ($field =~ /^(?:entryList)$/) {
45     return $self->SUPER::set('object', $val);
46   } else {
47     return $self->SUPER::set($field, $val);
48   }
49 }
50 ###############################################################################
51 sub addEntry {
52   my $self = shift;
53   my(@x) = $self->get('entryList');
54   push @x, @_;
55   $self->set(entryList => \@x);
56 }
57 ###############################################################################
58 sub action {
59   my($self, $actionData) = @_;
60   my(@x) = $self->get('entryList');
61
62   foreach my $entryOutput (@x) {
63     $entryOutput->action($actionData);
64   }
65   my(%retAction) = %{$actionData};
66   $retAction{edge} = 'proceed';
67   return \%retAction;
68 }
69 ###############################################################################
70 sub prettyPrintIRC ($$) {
71   my($self, $now) = @_;
72
73   my(@x) = $self->get('entryList');
74   my $str;
75   foreach my $entryOutput (@x) {
76     $str = (defined $str) ? "  " : "";
77     $str .= $entryOutput->prettyPrintIRC($now);
78   }
79   return $str;
80 }
81 ###############################################################################
82 1;
83 __END__
84 #
85 # Local variables:
86 # compile-command: "perl -I ../../../../Modules -c EntryResolver.pm"
87 # End:
Note: See TracBrowser for help on using the browser.

SFLC Main Page

[frdm] Support SFLC