diff options
| author | fukachan <fukachan> | 2001-11-03 01:22:13 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2001-11-03 01:22:13 +0000 |
| commit | 153a4f7f186483cb73872def6e2db5c9adf8cee5 (patch) | |
| tree | 0e6932669f14a54bb1e4bb63209a9c40ff57d872 /fml/lib/Mail/ThreadTrack | |
| parent | 707c14a03a4de82064901fdd5ce3e8ef6c5a25c3 (diff) | |
| download | fml8-153a4f7f186483cb73872def6e2db5c9adf8cee5.tar.gz fml8-153a4f7f186483cb73872def6e2db5c9adf8cee5.tar.bz2 fml8-153a4f7f186483cb73872def6e2db5c9adf8cee5.zip | |
ticket -> thread
Diffstat (limited to 'fml/lib/Mail/ThreadTrack')
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Analyze.pm | 68 | ||||
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/DB.pm | 4 | ||||
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/HeaderRewrite.pm | 8 | ||||
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Print.pm | 24 | ||||
| -rw-r--r-- | fml/lib/Mail/ThreadTrack/Print/CGI.pm | 20 |
5 files changed, 60 insertions, 64 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Analyze.pm b/fml/lib/Mail/ThreadTrack/Analyze.pm index 238f5651..dd958830 100644 --- a/fml/lib/Mail/ThreadTrack/Analyze.pm +++ b/fml/lib/Mail/ThreadTrack/Analyze.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Analyze.pm,v 1.2 2001/11/03 00:13:10 fukachan Exp $ +# $FML: Analyze.pm,v 1.3 2001/11/03 00:18:01 fukachan Exp $ # package Mail::ThreadTrack::Analyze; @@ -18,11 +18,7 @@ Mail::ThreadTrack::Analyze - analyze mail thread relation =head1 SYNOPSIS - my $ticket = $pkg->new($args); - if (defined $ticket) { - $ticket->analyze($msg); - $ticket->rewrite_header($msg); - } +See C<Mail::ThreadTrack> perl module. =head1 DESCRIPTION @@ -35,9 +31,9 @@ Mail::ThreadTrack::Analyze - analyze mail thread relation C<$mesg> is Mail::Message object. -1) assign a new ticket or extract the existing ticket-id from the subject. +1) assign a new thread or extract the existing thread-id from the subject. -2) update ticket status if needed. +2) update thread status if needed. =cut @@ -46,7 +42,7 @@ sub analyze { my ($self, $msg) = @_; $self->_assign($msg); - $self->update_ticket_status($msg); + $self->update_thread_status($msg); $self->update_db($msg); } @@ -65,8 +61,8 @@ sub _is_reply } -# Descriptions: assign a new ticket or -# extract the existing ticket-id from the subject +# Descriptions: assign a new thread or +# extract the existing thread-id from the subject # Arguments: $self $curproc $args # Side Effects: a new thread_id may be assigned # article header is rewritten @@ -95,34 +91,34 @@ sub _assign } } - # 2. check "X-Ticket-Pragma:" field, + # 2. check "X-Thread-Pragma:" field, # we ignore this mail if the pragma is specified as "ignore". - if (defined $header->get('x-ticket-pragma')) { - my $pragma = $header->get('x-ticket-pragma') || ''; + if (defined $header->get('x-thread-pragma')) { + my $pragma = $header->get('x-thread-pragma') || ''; if ($pragma =~ /ignore/i) { $self->{ _pragma } = 'ignore'; - $self->_append_ticket_status_info("ignored"); + $self->_append_thread_status_info("ignored"); return undef; } } - # if the header carries "Subject: Re: ..." with ticket-id, + # if the header carries "Subject: Re: ..." with thread-id, # we do not rewrite the subject but save the extracted $thread_id. if ($is_reply && $thread_id) { $self->log("reply message with thread_id=$thread_id"); $self->{ _thread_id } = $thread_id; $self->{ _status } = 'analyzed'; - $self->_append_ticket_status_info('analyzed'); + $self->_append_thread_status_info('analyzed'); } elsif ($thread_id) { $self->log("usual message with thread_id=$thread_id"); $self->{ _thread_id } = $thread_id; - $self->_append_ticket_status_info("found"); + $self->_append_thread_status_info("found"); } else { $self->log("message with no thread_id"); - # assign a new ticket number for a new message + # assign a new thread number for a new message my $id = $self->increment_id(); # O.K. rewrite Subject: of the article to distribute @@ -130,7 +126,7 @@ sub _assign my $header = $msg->rfc822_message_header(); $self->_get_thread_id($header, $config, $id); $self->_rewrite_header($header, $config, $id); - $self->_append_ticket_status_info("newly assigned"); + $self->_append_thread_status_info("newly assigned"); } else { $self->log("add fail for $id"); @@ -184,19 +180,19 @@ sub _speculate_thread_id } -sub _append_ticket_status_info +sub _append_thread_status_info { my ($self, $s) = @_; $self->{ _status_info } .= $self->{ _status_info } ? " -> ".$s : $s; } -=head2 update_ticket_status($msg) +=head2 update_thread_status($msg) =cut -sub update_ticket_status +sub update_thread_status { my ($self, $msg) = @_; @@ -205,7 +201,7 @@ sub update_ticket_status # entries to check my $header = $msg->rfc822_message_header(); my $subject = $header->get('subject'); - my $pragma = $header->get('x-ticket-pragma') || ''; + my $pragma = $header->get('x-thread-pragma') || ''; my $content = ''; my $message = $msg->get_first_plaintext_message(); @@ -220,11 +216,11 @@ sub update_ticket_status $subject =~ /^\s*close/ || $pragma =~ /close/ ) { $self->{ _status } = "closed"; - $self->_append_ticket_status_info("closed"); - $self->log("ticket is closed"); + $self->_append_thread_status_info("closed"); + $self->log("thread is closed"); } else { - $self->log("ticket status not changed"); + $self->log("thread status not changed"); } } @@ -287,12 +283,12 @@ sub _extract_message_id_references sub _extract_thread_id_in_subject { my ($self, $header, $config) = @_; - my $tag = $config->{ ticket_subject_tag }; + my $tag = $config->{ thread_subject_tag }; my $subject = $header->get('subject'); my $regexp = _regexp_compile($tag); # Subject: ... [thread_id] - if (($config->{ ticket_subject_tag_location } eq 'appended') && + if (($config->{ thread_subject_tag_location } eq 'appended') && ($subject =~ /($regexp)\s*$/)) { my $id = $1; $id =~ s/^(\[|\(|\{)//; @@ -302,7 +298,7 @@ sub _extract_thread_id_in_subject # XXX incomplete, we check subject after cutting off "Re:" et. al. # Subject: [thread_id] ... # Subject: Re: [thread_id] ... - elsif (($config->{ ticket_subject_tag_location } eq 'appended') && + elsif (($config->{ thread_subject_tag_location } eq 'appended') && ($subject =~ /^\s*($regexp)/)) { my $id = $1; $id =~ s/^(\[|\(|\{)//; @@ -310,7 +306,7 @@ sub _extract_thread_id_in_subject return $id; } else { - $self->log("no ticket id /$regexp/ in subject"); + $self->log("no thread id /$regexp/ in subject"); return 0; } } @@ -319,12 +315,12 @@ sub _extract_thread_id_in_subject sub _get_thread_id { my ($self, $header, $config, $id) = @_; - my $subject_tag = $config->{ ticket_subject_tag }; + my $subject_tag = $config->{ thread_subject_tag }; my $id_syntax = $config->{ thread_id_syntax }; # thread_id in subject my $thread_id = sprintf($subject_tag, $id); - $self->{ _ticket_subject_tag } = $thread_id; + $self->{ _thread_subject_tag } = $thread_id; $thread_id = sprintf($id_syntax, $id); $self->{ _thread_id } = $thread_id; @@ -337,10 +333,10 @@ sub _rewrite_header { my ($self, $header, $config, $id) = @_; - # append the ticket tag to the subject + # append the thread tag to the subject my $subject = $header->get('subject') || ''; $header->replace('Subject', - $subject." " . $self->{ _ticket_subject_tag }); + $subject." " . $self->{ _thread_subject_tag }); } @@ -441,7 +437,7 @@ sub _update_db $when = Mail::Message::Date->new($when)->mail_header_style(); $buf .= "\t\n"; - $buf .= "\tthis ticket/thread is opended at article $aid[0]\n"; + $buf .= "\tthis thread is opended at article $aid[0]\n"; $buf .= "\tby $sender\n"; $buf .= "\ton $when\n"; $buf .= "\tarticle references: @aid\n"; diff --git a/fml/lib/Mail/ThreadTrack/DB.pm b/fml/lib/Mail/ThreadTrack/DB.pm index c682aed0..4a90c3a0 100644 --- a/fml/lib/Mail/ThreadTrack/DB.pm +++ b/fml/lib/Mail/ThreadTrack/DB.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: DB.pm,v 1.1.1.1 2001/11/02 09:07:39 fukachan Exp $ +# $FML: DB.pm,v 1.2 2001/11/03 00:18:01 fukachan Exp $ # package Mail::ThreadTrack::DB; @@ -58,7 +58,7 @@ my @kind_of_databases = qw(thread_id sub db_open { my ($self) = @_; - my $db_type = $self->{ config }->{ ticket_db_type } || 'AnyDBM_File'; + my $db_type = $self->{ config }->{ thread_db_type } || 'AnyDBM_File'; my $db_dir = $self->{ _db_dir }; my $index_file = $self->{ _index_db }; diff --git a/fml/lib/Mail/ThreadTrack/HeaderRewrite.pm b/fml/lib/Mail/ThreadTrack/HeaderRewrite.pm index a05ee571..61bf4ba5 100644 --- a/fml/lib/Mail/ThreadTrack/HeaderRewrite.pm +++ b/fml/lib/Mail/ThreadTrack/HeaderRewrite.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: HeaderRewrite.pm,v 1.1.1.1 2001/11/02 09:07:39 fukachan Exp $ +# $FML: HeaderRewrite.pm,v 1.2 2001/11/03 00:18:01 fukachan Exp $ # package Mail::ThreadTrack::HeaderRewrite; @@ -37,15 +37,15 @@ sub rewrite_header my $header = $msg->rfc822_message_header; if (defined $self->{ _status_info }) { - $header->add('X-Ticket-Status', $self->{ _status_info }); + $header->add('X-Thread-Status', $self->{ _status_info }); } if (defined $self->{ _thread_id }) { - $header->add('X-Ticket-ID', $self->{ _thread_id }); + $header->add('X-Thread-ID', $self->{ _thread_id }); } if (defined $self->{ _status_history }) { - $header->add('X-Ticket-History', $self->{ _status_history }); + $header->add('X-Thread-History', $self->{ _status_history }); } } diff --git a/fml/lib/Mail/ThreadTrack/Print.pm b/fml/lib/Mail/ThreadTrack/Print.pm index 855fa2ed..88f94de6 100644 --- a/fml/lib/Mail/ThreadTrack/Print.pm +++ b/fml/lib/Mail/ThreadTrack/Print.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: Print.pm,v 1.2 2001/11/03 00:10:06 fukachan Exp $ +# $FML: Print.pm,v 1.3 2001/11/03 00:18:02 fukachan Exp $ # package Mail::ThreadTrack::Print; @@ -26,7 +26,7 @@ Mail::ThreadTrack::Print - print out thread relation =head2 C<show_summary(>) -top level entrance for routines to show the ticket summary. +top level entrance for routines to show the thread summary. See L<simple_print()> for more detail. Either of @@ -36,14 +36,14 @@ C<_summary_print()> is used for purposes. Each row that C<show_summary()> returns has a set of -C<date>, C<age>, C<status>, C<ticket-id> and -C<articles>, which is a list of articles with the ticket-id. +C<date>, C<age>, C<status>, C<thread-id> and +C<articles>, which is a list of articles with the thread-id. =head2 C<simple_print()> show entries by the thread_id order. For example, - date age status ticket id articles + date age status thread id articles ------------------------------------------------------------ 2001/02/07 3.6 going elena_#00000450 807 808 809 2001/02/07 3.1 open elena_#00000451 810 @@ -68,24 +68,24 @@ sub show_summary my ($tid, $status, $thread_id); my $mode = $self->get_mode || 'text'; - # rh: ticket id list, which is ARRAY REFERENCE tied to db_dir/*db's + # rh: thread id list, which is ARRAY REFERENCE tied to db_dir/*db's $thread_id = $self->list_up_thread_id(); # self->{ _hash_table } is tied to DB's. $self->db_open(); if (@$thread_id) { - # sort the ticket output order it out by cost - # and print the ticket summary in that order. + # sort the thread output order it out by cost + # and print the thread summary in that order. $self->sort($thread_id); if ($mode eq 'html') { print "<TABLE BORDER=4>\n" if $mode eq 'html'; - $self->_print_ticket_summary($thread_id); + $self->_print_thread_summary($thread_id); print "</TABLE>\n" if $mode eq 'html'; } else { - $self->_print_ticket_summary($thread_id); + $self->_print_thread_summary($thread_id); # show short summary for each article $self->_print_article_summary($thread_id); @@ -98,7 +98,7 @@ sub show_summary -sub _print_ticket_summary +sub _print_thread_summary { my ($self, $thread_id) = @_; my $mode = $self->get_mode || 'text'; @@ -132,7 +132,7 @@ sub _print_ticket_summary $status = $rh->{ _status }->{ $tid }; if ($mode eq 'html') { - $self->_show_ticket_by_html_table( { + $self->_show_thread_by_html_table( { format => $format, date => $date, age => $age, diff --git a/fml/lib/Mail/ThreadTrack/Print/CGI.pm b/fml/lib/Mail/ThreadTrack/Print/CGI.pm index 0eb9b1a0..0a32a101 100644 --- a/fml/lib/Mail/ThreadTrack/Print/CGI.pm +++ b/fml/lib/Mail/ThreadTrack/Print/CGI.pm @@ -8,7 +8,7 @@ sub STR2EUC } -sub show_articles_for_ticket +sub show_articles_for_thread { my ($self, $thread_id) = @_; my $mode = $self->get_mode || 'text'; @@ -56,8 +56,8 @@ sub cgi_top_menu { my ($self) = @_; my $config = $self->{ _config }; - my $action = 'fmlticket.cgi'; - my $target = $config->{ ticket_cgi_target_window } || 'TicketCGIWindow'; + my $action = 'fmlthread.cgi'; + my $target = $config->{ thread_cgi_target_window } || 'ThreadCGIWindow'; use DirHandle; my $dh = new DirHandle $config->{ ml_home_prefix }; @@ -88,15 +88,15 @@ sub cgi_top_menu # This shows summary on C<$thread_id> in HTML language. -# It is used in C<FML::CGI::TicketSystem>. -sub _show_ticket_by_html_table +# It is used in C<FML::CGI::ThreadSystem>. +sub _show_thread_by_html_table { my ($self, $optargs) = @_; my $config = $self->{ _config }; my $ml_name = $config->{ ml_name }; my $spool_dir = $config->{ spool_dir }; - my $action = 'fmlticket.cgi'; - my $target = $config->{ ticket_cgi_target_window } || 'TicketCGIWindow'; + my $action = 'fmlthread.cgi'; + my $target = $config->{ thread_cgi_target_window } || 'ThreadCGIWindow'; # printf($fd $format, # $date, $age, $status, $tid, $rh->{ _articles }->{ $tid }); @@ -145,8 +145,8 @@ sub run_cgi { my ($self) = @_; my $config = $self->{ _config }; - my $title = $config->{ ticket_cgi_title } || 'ticket system interface'; - my $color = $config->{ ticket_cgi_bgcolor } || '#E6E6FA'; + my $title = $config->{ thread_cgi_title } || 'thread system interface'; + my $color = $config->{ thread_cgi_bgcolor } || '#E6E6FA'; # XXX $ml_name may change by HTTP request $config->{ ml_name } = param('ml_name') if param('ml_name'); @@ -173,7 +173,7 @@ sub run_cgi if ($action eq 'show') { Log("run.cgi.show_articles for $thread_id"); - $self->show_articles_for_ticket($thread_id); + $self->show_articles_for_thread($thread_id); } else { # menu at the top of scrren |
