/[mws]/trunk/MWS.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/MWS.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon May 10 20:26:17 2004 UTC revision 42 by dpavlin, Mon May 10 22:04:01 2004 UTC
# Line 20  use MIME::Base64; Line 20  use MIME::Base64;
20    
21  our $VERSION = '1.00';  our $VERSION = '1.00';
22    
 my $folder;     # placeholder for folders  
   
23  my $debug = 1;  my $debug = 1;
24    
25    my @counters = qw(from to cc bcc folder);
26    
27  sub new {  sub new {
28          my $class = shift;          my $class = shift;
29          my $self = {@_};          my $self = {@_};
# Line 81  sub add_counter($$) { Line 81  sub add_counter($$) {
81          my ($c,$v) = @_;          my ($c,$v) = @_;
82          my $k = $self->normalize_string($v);          my $k = $self->normalize_string($v);
83    
84          $self->{counter}->{$c}->{$k}->{name} = $v;          $self->{counter}->{$c}->{$k}->{name} = $v || return;
85          return $self->{counter}->{$c}->{$k}->{usage}++;          return $self->{counter}->{$c}->{$k}->{usage}++;
86  }  }
87    
# Line 356  sub fetch_result_by_id { Line 356  sub fetch_result_by_id {
356    
357                  $row->{'id'} = $id;                  $row->{'id'} = $id;
358    
359                  foreach my $p (qw(from to cc bcc)) {                  foreach my $p (@counters) {
360                          foreach my $v ($self->unroll($message,$p,'phrase')) {                          foreach my $v ($self->unroll($message,$p,'phrase')) {
361                                  push @{$row->{$p}},$v;                                  push @{$row->{$p}},$v;
362                                  $self->add_counter($p,$v);                                  $self->add_counter($p,$v);
363                          }                          }
364                  }                  }
365    
366                    $self->add_counter('folder', $1) if ($id =~ m/^(\S+)\s/);
367    
368                  $row->{'subject'} = $self->decode_qp($message->subject);                  $row->{'subject'} = $self->decode_qp($message->subject);
369                  $row->{'body'} = $self->plain_text_body($message);                  $row->{'body'} = $self->plain_text_body($message);
370                  my $utime = str2time($message->date);                  my $utime = str2time($message->date);
# Line 376  sub fetch_result_by_id { Line 379  sub fetch_result_by_id {
379                  print STDERR "$id stored in cache\n" if ($debug == 2);                  print STDERR "$id stored in cache\n" if ($debug == 2);
380          } else {          } else {
381                  print STDERR "fetch_result_by_id($id) in cache\n" if ($debug == 2);                  print STDERR "fetch_result_by_id($id) in cache\n" if ($debug == 2);
382                  foreach my $p (qw(from to cc bcc)) {                  foreach my $p (@counters) {
383                          foreach my $v (@{$row->{$p}}) {                          foreach my $v (@{$row->{$p}}) {
384                                  $self->add_counter($p,$v);                                  $self->add_counter($p,$v);
385                          }                          }
386                  }                  }
387    
388                    $self->add_counter('folder', $1) if ($id =~ m/^(\S+)\s/);
389    
390                  $self->add_counter_calendar($row->{date_utime});                  $self->add_counter_calendar($row->{date_utime});
391          }          }
392    

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26