/[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 22 by dpavlin, Sat May 8 01:13:33 2004 UTC revision 27 by dpavlin, Sat May 8 20:34:26 2004 UTC
# Line 42  sub new { Line 42  sub new {
42    
43          $self->{config} = new Config::IniFiles( -file => $config_file );          $self->{config} = new Config::IniFiles( -file => $config_file );
44    
45          my $index_file = $self->{config}->val('global', 'index') || croak "can't find [index] section in config file with path of index";          $self->{config_file} = $config_file;
46            $config_file =~ s/\.conf.*$//;
47            $self->{config_name} = $config_file;
48    
49            my $index_dir = $self->{config}->val('global', 'index') || croak "can't find [index] section in config file with path of index";
50    
51          $self->{mgr} = Mail::Box::Manager->new(access => 'r');          $self->{mgr} = Mail::Box::Manager->new(access => 'r');
52          $self->{index_file} = $index_file;          $self->{index_dir} = $index_dir;
53    
54          # placeholder for opened folders          # placeholder for opened folders
55          $self->{folder} = {};          $self->{folder} = {};
# Line 66  sub normalize_string { Line 70  sub normalize_string {
70          $v = join('',sort split(/\s+/,$v));          $v = join('',sort split(/\s+/,$v));
71          $v =~ s/\W+//g;          $v =~ s/\W+//g;
72    
73          return $v;          return lc($v);
74  }  }
75    
76  # reset tables for search results  # reset tables for search results
# Line 222  sub search { Line 226  sub search {
226    
227          $self->{'curr_result'} = 0;          $self->{'curr_result'} = 0;
228    
229            $self->reset_counters;
230    
231          print STDERR "$results results\n" if ($debug == 2);          print STDERR "$results results\n" if ($debug == 2);
232    
233          return $results || 'error';          return $results || 'error';
# Line 328  sub plain_text_body { Line 334  sub plain_text_body {
334                  }                  }
335          }          }
336    
337            if (! $body) {
338                    $body = "[plain/text body not found]" if ($debug == 2);
339                    print STDERR "plain/text body not found\n" if ($debug);
340                    return;
341            }
342    
343          # reformat with Text::Autoformat          # reformat with Text::Autoformat
344          my $wrap = $self->{wrap_margin};          my $wrap = $self->{wrap_margin};
345          if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) {          if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) {
                 $body =~ s/[\r\n]/\n/gs;  
346                  $body = autoformat($body, {right=>$wrap, all=>1});                  $body = autoformat($body, {right=>$wrap, all=>1});
347                  $body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2);                  $body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2);
348          }          }
# Line 375  sub fetch_result_by_id { Line 386  sub fetch_result_by_id {
386                  print STDERR "$id stored in cache\n" if ($debug == 2);                  print STDERR "$id stored in cache\n" if ($debug == 2);
387          } else {          } else {
388                  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);
389                    foreach my $p (qw(from to cc bcc)) {
390                            foreach my $v (@{$row->{$p}}) {
391                                    $self->add_counter($p,$v);
392                            }
393                    }
394    
395                    $self->add_counter_calendar($row->{date_utime});
396          }          }
397    
398          return $row;          return $row;

Legend:
Removed from v.22  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26