Draft patch to add references and in-reply-to parsing

We are testing RT here at work, and one of the problems we would like
to solve is making sure emails are grouped together in the correct
ticket, even if the subject is missing the ticket ID marker. We want
the follwing messages to end up in the same ticket when recieved in
order:To: otrs@some.domain
Subject: Foo is not working, everything is bad
From: user@some.domain
Message-ID: 1@some.domain

Please, please help us.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain
In-Reply-To: 1@some.domain
Message-ID: 2@some.domain

Oh, and bar is giving strange noises as well.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain 2@some.domain
In-Reply-To: 2@some.domain
Message-ID: 3@some.domain

I got my local admin to help me. Everything is OK now.

As you can see, the messages contain references to each other, and it
should be possible to make sure these emails are grouped together in
one ticket.

I’ve started on a patch, but do not quite know how to look up ticket
IDs based on message-ids. Anyone got a clue to spare?

Here is the current draft, which of course do not work because the
part marked XXX is broken.

— src-3-0-8/lib/RT/Interface/Email.pm 2004-01-02 22:23:39.000000000 +0100
+++ src-3-0-8-local/lib/RT/Interface/Email.pm 2004-01-27 14:23:13.000000000 +0100
@@ -475,6 +475,61 @@

 $args{'ticket'} ||= $parser->ParseTicketId($Subject);
  • unless ( $args{‘ticket’} ) {
  •    # Based on info from <URL:http://www.jwz.org/doc/threading.html>
    
  •   my @msgids = ();
    
  •   my $references = $head->get('References') || '';
    
  •   my $inreplyto  = $head->get('In-Reply-To') || '';
    
  •   push(@msgids, split(/\s+/, $references)) if ($references);
    
  •   if ($inreplyto) {
    
  •       if ($inreplyto =~ m/(<[^>]+>)/) {
    
  •           push(@msgids, $1);
    
  •       } else {
    
  •           $RT::Logger->log(level => 'debug',
    
  •                            message => "Gateway: Unhandled In-Reply-To format: '$inreplyto'"
    
  •                            );
    
  •       }
    
  •   }
    
  •    # Map Message-id(s) to ticket id
    
  •   my @ids = ();
    
  •   my %checked;
    
  •   my $msgid;
    
  •   for $msgid (@msgids) {
    
  •       next if $checked{$msgid}; # Already looked up this message-id
    
  •       # XXX Find proper API
    
  •       my $TicketID = $RT::Attachment::TicketIDofMessageId($msgid);
    
  •       push(@ids, @TicketIDs) if (@TicketIDs);
    
  •       $checked{$msgid} = 1;
    
  •   }
    
  •   # Reduce list of IDs to unique IDs only
    
  •   my $id;
    
  •   my %idhash;
    
  •   for $id (sort @ids) {
    
  •       $idhash{$id} = 1;
    
  •   }
    
  •   @ids = sort keys %idhash;
    
  •   # If the Message-id(s) are already in the database, use their
    
  •   # ticked-id
    
  •   if (1 < @ids) {
    
  •       $RT::Logger->log(level => 'debug',
    
  •                        message => "Gateway: Several possible tickets: " .
    
  •                            join(",", @ids)
    
  •                        );
    
  •   }
    
  •   # Just pick the first.  Not sure how we should handle several
    
  •   # ticket ids
    
  •   $args{'ticket'} = $ids[0] if (@ids);
    
  • }
    my $SystemTicket;
    if ( $args{‘ticket’} ) {
    $SystemTicket = RT::Ticket->new($RT::SystemUser);

Hello, Petter.

Msgids is good idea, but it’s really for ideal world only.
There is one known problem in such behavior. Often users use reply
button to create new one ticket. RT don’t have split tool. So you should
check Subject alsow.

Also look at comments in code.

Petter Reinholdtsen wrote:

We are testing RT here at work, and one of the problems we would like
to solve is making sure emails are grouped together in the correct
ticket, even if the subject is missing the ticket ID marker. We want
the follwing messages to end up in the same ticket when recieved in
order:

To: otrs@some.domain
Subject: Foo is not working, everything is bad
From: user@some.domain
Message-ID: 1@some.domain

Please, please help us.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain
In-Reply-To: 1@some.domain
Message-ID: 2@some.domain

Oh, and bar is giving strange noises as well.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain 2@some.domain
In-Reply-To: 2@some.domain
Message-ID: 3@some.domain

I got my local admin to help me. Everything is OK now.

As you can see, the messages contain references to each other, and it
should be possible to make sure these emails are grouped together in
one ticket.

I’ve started on a patch, but do not quite know how to look up ticket
IDs based on message-ids. Anyone got a clue to spare?

Here is the current draft, which of course do not work because the
part marked XXX is broken.

— src-3-0-8/lib/RT/Interface/Email.pm 2004-01-02 22:23:39.000000000 +0100
+++ src-3-0-8-local/lib/RT/Interface/Email.pm 2004-01-27 14:23:13.000000000 +0100
@@ -475,6 +475,61 @@

 $args{'ticket'} ||= $parser->ParseTicketId($Subject);
  • unless ( $args{‘ticket’} ) {
  •    # Based on info from <URL:http://www.jwz.org/doc/threading.html>
    
  •   my @msgids = ();
    
  •   my $references = $head->get('References') || '';
    
  •   my $inreplyto  = $head->get('In-Reply-To') || '';
    
  •   push(@msgids, split(/\s+/, $references)) if ($references);
    

You should skip other code if there is no references, shouldn’t you?

  •   if ($inreplyto) {
    
  •       if ($inreplyto =~ m/(<[^>]+>)/) {
    
  •           push(@msgids, $1);
    
  •       } else {
    
  •           $RT::Logger->log(level => 'debug',
    
  •                            message => "Gateway: Unhandled In-Reply-To format: '$inreplyto'"
    
  •                            );
    
  •       }
    
  •   }
    

else {
skip other checks;
}

  •    # Map Message-id(s) to ticket id
    
  •   my @ids = ();
    
  •   my %checked;
    
  •   my $msgid;
    
  •   for $msgid (@msgids) {
    
  •       next if $checked{$msgid}; # Already looked up this message-id
    
  •       # XXX Find proper API
    
  •       my $TicketID = $RT::Attachment::TicketIDofMessageId($msgid);
    
  •       push(@ids, @TicketIDs) if (@TicketIDs);
    
  •       $checked{$msgid} = 1;
    
  •   }
    

Here is something like
my $Attachs = $RT::Attachments->new($RT::SystemUser);
$Attachs->Limit(FIELD => ‘ContentType’,
OPERATOR => ‘=’,
VALUE => ‘text/plain’
);
$Attachs->Limit(FIELD => ‘ContentType’,
OPERATOR => ‘=’,
VALUE => ‘text/html’
);
$Attachs->Limit(FIELD => ‘Parent’, OPERATOR => ‘=’, VALUE => ‘0’);

my $trs = $Attachs->NewAlias(‘Transactions’);
my $tis = $Attachs->NewAlias(‘Tickets’);

$Attachs->Join(
ALIAS1 => ‘main’,
FIELD1 => ‘TransactionId’,
ALIAS2 => $trs,
FIELD2 => ‘id’
);

$Attachs->Join(
ALIAS1 => $trs,
FIELD1 => ‘Ticket’,
ALIAS2 => $tis,
FIELD2 => ‘id’
);

$Attachs->Limit( ALIAS => $trs,
FIELD => ‘Type’,
OPERATOR => ‘=’,
VALUE => ‘Comment’
);

$Attachs->Limit( ALIAS => $trs,
FIELD => ‘Type’,
OPERATOR => ‘=’,
VALUE => ‘Correspond’
);


I hope you could continue this…

[Ruslan U. Zakirov]

Msgids is good idea, but it’s really for ideal world only. There is
one known problem in such behavior. Often users use reply button to
create new one ticket.

I am aware of the problem, but suspect people doing this would learn
that it isn’t a good idea when their request is closed because it was
filed with the wrong ticket. :slight_smile:

RT don’t have split tool. So you should check Subject alsow.

It would be nice if one could undo a ticket merge, as there will be
cases where two tickets are merged by mistake.

Here is something like
my $Attachs = $RT::Attachments->new($RT::SystemUser);
$Attachs->Limit(FIELD => ‘ContentType’,
OPERATOR => ‘=’,
VALUE => ‘text/plain’
);
$Attachs->Limit(FIELD => ‘ContentType’,
OPERATOR => ‘=’,
VALUE => ‘text/html’
);
$Attachs->Limit(FIELD => ‘Parent’, OPERATOR => ‘=’, VALUE => ‘0’);

my $trs = $Attachs->NewAlias(‘Transactions’);
my $tis = $Attachs->NewAlias(‘Tickets’);

$Attachs->Join(
ALIAS1 => ‘main’,
FIELD1 => ‘TransactionId’,
ALIAS2 => $trs,
FIELD2 => ‘id’
);

$Attachs->Join(
ALIAS1 => $trs,
FIELD1 => ‘Ticket’,
ALIAS2 => $tis,
FIELD2 => ‘id’
);

$Attachs->Limit( ALIAS => $trs,
FIELD => ‘Type’,
OPERATOR => ‘=’,
VALUE => ‘Comment’
);

$Attachs->Limit( ALIAS => $trs,
FIELD => ‘Type’,
OPERATOR => ‘=’,
VALUE => ‘Correspond’
);


I hope you could continue this…

Thank you for your suggestion. I’ll try to continue, but do not
really know this DBDx module API yet.

[Petter Reinholdtsen]

Thank you for your suggestion. I’ll try to continue, but do not
really know this DBDx module API yet.

Continuing my stumble in the dark, I came up with this patch. I still
can not say I understand the DBIx::SearchBuilder API, but based on the
example from Ruslan U. Zakirov I continued by adding the MessageId
value and the loop to extract the ticket ids.

The code is completely untested, as I do not have source access to our
RT test installation yet.

Am I on the right track?

diff -ur src-3-0-8/lib/RT/Interface/Email.pm src-3-0-8-386linuxlibc63/lib/RT/Interface/Email.pm
— src-3-0-8/lib/RT/Interface/Email.pm 2004-01-02 22:23:39.000000000 +0100
+++ src-3-0-8-386linuxlibc63/lib/RT/Interface/Email.pm 2004-01-28 18:54:51.000000000 +0100
@@ -475,6 +475,110 @@

 $args{'ticket'} ||= $parser->ParseTicketId($Subject);
  • unless ( $args{‘ticket’} ) {
  •    # Based on info from <URL:http://www.jwz.org/doc/threading.html>
    
  • my @msgids = ();
  • my $references = $head->get(‘References’) || ‘’;
  • my $inreplyto = $head->get(‘In-Reply-To’) || ‘’;
  • push(@msgids, split(/\s+/, $references)) if ($references);
  • if ($inreplyto) {
  •   if ($inreplyto =~ m/(<[^>]+>)/) {
    
  •   push(@msgids, $1);
    
  •   } else {
    
  •   $RT::Logger->log(level => 'debug', 
    
  •   		 message => "Gateway: Unhandled In-Reply-To format: '$inreplyto'"
    
  •   		 );
    
  •   }
    
  • }
  •    # Map Message-id(s) to ticket id
    
  • my @ids = ();
  • my %checked;
  • my $msgid;
  • for $msgid (@msgids) {
  •   next if $checked{$msgid}; # Already looked up this message-id
    
  •   # Look up ticket IDs given MessageID of attachment
    
  •   my $Attachs = $RT::Attachments->new($RT::SystemUser);
    
  •   $Attachs->Limit( FIELD => 'MessageId',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => $msgid
    
  •   	     );
    
  •   $Attachs->Limit( FIELD => 'ContentType',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => 'text/plain'
    
  •   	     );
    
  •   $Attachs->Limit( FIELD => 'ContentType',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => 'text/html'
    
  •   	     );
    
  •   $Attachs->Limit( FIELD => 'Parent',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => '0'
    
  •   	     );
    
  •   my $trs = $Attachs->NewAlias('Transactions');
    
  •   my $tis = $Attachs->NewAlias('Tickets');
    
  •   $Attachs->Join( ALIAS1 => 'main',
    
  •   	    FIELD1 => 'TransactionId',
    
  •   	    ALIAS2 => $trs,
    
  •   	    FIELD2 => 'id'
    
  •   	    );
    
  •   $Attachs->Join( ALIAS1 => $trs,
    
  •   	    FIELD1 => 'Ticket',
    
  •   	    ALIAS2 => $tis,
    
  •   	    FIELD2 => 'id'
    
  •   	   );
    
  •   $Attachs->Limit( ALIAS => $trs,
    
  •   	     FIELD => 'Type',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => 'Comment'
    
  •   	     );
    
  •   $Attachs->Limit( ALIAS => $trs,
    
  •   	     FIELD => 'Type',
    
  •   	     OPERATOR => '=',
    
  •   	     VALUE => 'Correspond'
    
  •   	     );
    
  •   while (my $ticket = $Attachs->Next) {
    
  •   my $ticketid = $Attachs->Ticket;
    
  •   print "Found ID $ticketid\n";
    
  •   push(@ids, $ticketid) if $ticketid;
    
  •   }
    
  •   $checked{$msgid} = 1;
    
  • }
  • Reduce list of IDs to unique IDs only

  • my $id;
  • my %idhash;
  • for $id (sort @ids) {
  •   $idhash{$id} = 1;
    
  • }
  • @ids = sort keys %idhash;
  • If the Message-id(s) are already in the database, use their

  • ticked-id

  • if (1 < @ids) {
  •   $RT::Logger->log(level => 'debug', 
    
  •   	     message => "Gateway: Several possible tickets: " .
    
  •   	         join(",", @ids)
    
  •   	     );
    
  • }
  • Just pick the first. Not sure how we should handle several

  • ticket ids

  • $args{‘ticket’} = $ids[0] if (@ids);
  • }
    my $SystemTicket;
    if ( $args{‘ticket’} ) {
    $SystemTicket = RT::Ticket->new($RT::SystemUser);

Unfortunately, you’d have to retrieve the Ticket and either pull the
oldest attachment (which should be what created the ticket) in the best
case, or walk through all the attachments in a worst case, and create a
hash of the Message-ID headers you see. This would be both database
and processor intensive as you’re essentially going to have to search
at least one attachment for every ticket.

A better solution would be to create a column either in the Ticket
table or the Attachment table to hold your reference message-id(s) and
populate them on the initial insert, but that requires a schema change.On Jan 27, 2004, at 6:16 AM, Petter Reinholdtsen wrote:

We are testing RT here at work, and one of the problems we would like
to solve is making sure emails are grouped together in the correct
ticket, even if the subject is missing the ticket ID marker. We want
the follwing messages to end up in the same ticket when recieved in
order:

To: otrs@some.domain
Subject: Foo is not working, everything is bad
From: user@some.domain
Message-ID: 1@some.domain

Please, please help us.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain
In-Reply-To: 1@some.domain
Message-ID: 2@some.domain

Oh, and bar is giving strange noises as well.

To: otrs@some.domain
Subject: Re: Foo is not working, everything is bad
From: user@some.domain
References: 1@some.domain 2@some.domain
In-Reply-To: 2@some.domain
Message-ID: 3@some.domain

I got my local admin to help me. Everything is OK now.

As you can see, the messages contain references to each other, and it
should be possible to make sure these emails are grouped together in
one ticket.

I’ve started on a patch, but do not quite know how to look up ticket
IDs based on message-ids. Anyone got a clue to spare?

Here is the current draft, which of course do not work because the
part marked XXX is broken.

— src-3-0-8/lib/RT/Interface/Email.pm 2004-01-02 22:23:39.000000000
+0100
+++ src-3-0-8-local/lib/RT/Interface/Email.pm 2004-01-27
14:23:13.000000000 +0100
@@ -475,6 +475,61 @@

 $args{'ticket'} ||= $parser->ParseTicketId($Subject);
  • unless ( $args{‘ticket’} ) {
  •    # Based on info from 
    

URL:http://www.jwz.org/doc/threading.html

  •   my @msgids = ();
    
  •   my $references = $head->get('References') || '';
    
  •   my $inreplyto  = $head->get('In-Reply-To') || '';
    
  •   push(@msgids, split(/\s+/, $references)) if ($references);
    
  •   if ($inreplyto) {
    
  •       if ($inreplyto =~ m/(<[^>]+>)/) {
    
  •           push(@msgids, $1);
    
  •       } else {
    
  •           $RT::Logger->log(level => 'debug',
    
  •                            message => "Gateway: Unhandled 
    

In-Reply-To format: ‘$inreplyto’"

  •                            );
    
  •       }
    
  •   }
    
  •    # Map Message-id(s) to ticket id
    
  •   my @ids = ();
    
  •   my %checked;
    
  •   my $msgid;
    
  •   for $msgid (@msgids) {
    
  •       next if $checked{$msgid}; # Already looked up this 
    

message-id
+

  •       # XXX Find proper API
    
  •       my $TicketID = 
    

$RT::Attachment::TicketIDofMessageId($msgid);

  •       push(@ids, @TicketIDs) if (@TicketIDs);
    
  •       $checked{$msgid} = 1;
    
  •   }
    
  •   # Reduce list of IDs to unique IDs only
    
  •   my $id;
    
  •   my %idhash;
    
  •   for $id (sort @ids) {
    
  •       $idhash{$id} = 1;
    
  •   }
    
  •   @ids = sort keys %idhash;
    
  •   # If the Message-id(s) are already in the database, use their
    
  •   # ticked-id
    
  •   if (1 < @ids) {
    
  •       $RT::Logger->log(level => 'debug',
    
  •                        message => "Gateway: Several possible 
    

tickets: " .

  •                            join(",", @ids)
    
  •                        );
    
  •   }
    
  •   # Just pick the first.  Not sure how we should handle several
    
  •   # ticket ids
    
  •   $args{'ticket'} = $ids[0] if (@ids);
    
  • }
  • my $SystemTicket;
    if ( $args{‘ticket’} ) {
    $SystemTicket = RT::Ticket->new($RT::SystemUser);

rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives

[Petter Reinholdtsen, 2004-01-28]

Continuing my stumble in the dark, I came up with this patch. I
still can not say I understand the DBIx::SearchBuilder API, but
based on the example from Ruslan U. Zakirov I continued by adding
the MessageId value and the loop to extract the ticket ids.

Based on this initial try, and some clues from the thread discussing
messageid parsing in RT::Attachment, I ended up with the following
patch to get what I wanted. This patch is tested and found to work
fine.

If the patch is acceptable, please include it in a future version of
RT. If it isn’t acceptable, please let me know what is wrong with it.

The patch is relative to todays 3.2-RELEASE branch in subversion.

Index: lib/RT/Ticket_Overlay.pm
— lib/RT/Ticket_Overlay.pm (revision 1473)
+++ lib/RT/Ticket_Overlay.pm (working copy)
@@ -291,6 +291,67 @@

}}}

+# {{{ sub LoadByMessageId
+=head2 LoadByMessageId
+Given a RFC 822 message id, loads the specified ticket. If the
+message id is assosiated with several tickets, select the smallest
+ticket id.
+=cut
+sub LoadByMessageId {

  • my $self = shift;
  • my $MessageId = shift;
  • my $Attachs = RT::Attachments->new($RT::SystemUser);
  • $Attachs->Limit( FIELD => ‘MessageId’,
  •                 OPERATOR => '=',
    
  •                 VALUE => $MessageId
    
  •                 );
    
  • $Attachs->Limit( FIELD => ‘ContentType’,
  •                 OPERATOR => '=',
    
  •                 VALUE => 'text/plain'
    
  •                 );
    
  • $Attachs->Limit( FIELD => ‘ContentType’,
  •                 OPERATOR => '=',
    
  •                 VALUE => 'text/html'
    
  •                 );
    
  • $Attachs->Limit( FIELD => ‘Parent’,
  •                 OPERATOR => '=',
    
  •                 VALUE => '0'
    
  •                 );
    
  • my $trs = $Attachs->NewAlias(‘Transactions’);
  • my $tis = $Attachs->NewAlias(‘Tickets’);
  • $Attachs->Join( ALIAS1 => ‘main’,
  •                FIELD1 => 'TransactionId',
    
  •                ALIAS2 => $trs,
    
  •                FIELD2 => 'id'
    
  •                );
    
  • $Attachs->Join( ALIAS1 => $trs,
  •                FIELD1 => 'Ticket',
    
  •                ALIAS2 => $tis,
    
  •                FIELD2 => 'id'
    
  •                );
    
  • my %tickets = ();
  • while (my $attachment = $Attachs->Next) {
  •    $tickets{$attachment->TransactionObj()->Ticket} = 1;
    
  • }
  • my @ids = sort { $a <=> $b } keys %tickets;
  • if (1 < @ids) {
  •    $RT::Logger->info("Message ID $MessageId maps to several tickets.",
    
  •                      "Selecting the first.");
    
  • }
  • if (@ids) {
  •    return $self->Load($ids[0]);
    
  • } else {
  •    return undef;
    
  • }
    +}
    +# }}}

{{{ sub Create

=head2 Create (ARGS)
Index: lib/RT/Attachment_Overlay.pm
— lib/RT/Attachment_Overlay.pm (revision 1473)
+++ lib/RT/Attachment_Overlay.pm (working copy)
@@ -153,6 +153,10 @@
defined($Subject) or $Subject = ‘’;
chomp($Subject);

  • #Get the MessageID, or undef if not available
  • my $MessageId = $Attachment->head->get( ‘message-id’, 0 );
  • chomp($MessageId);
    #Get the filename
    my $Filename = $Attachment->head->recommended_filename || eval {
    ${ $Attachment->head->{mail_hdr_hash}{‘Content-Disposition’}[0] }
    @@ -167,6 +171,7 @@
    Parent => 0,
    ContentType => $Attachment->mime_type,
    Headers => $Attachment->head->as_string,
  •        MessageId     => $MessageId,
           Subject => $Subject);
    
       foreach my $part ( $Attachment->parts ) {
    

@@ -198,6 +203,7 @@
ContentEncoding => $ContentEncoding,
Parent => $args{‘Parent’},
Headers => $Attachment->head->as_string,

  •                                   MessageId       => $MessageId,
                                      Subject       =>  $Subject,
                                      Content         => $Body,
                                      Filename => $Filename, );
    

Index: lib/RT/Interface/Email.pm
— lib/RT/Interface/Email.pm (revision 1473)
+++ lib/RT/Interface/Email.pm (working copy)
@@ -271,6 +271,59 @@
return $CurrentUser;
}

}}}

+# {{{ sub ParseReferences
+sub ParseReferences {

  • my $head = shift;
  • Based on info from URL:http://www.jwz.org/doc/threading.html

  • my @msgids = ();
  • my $references = $head->get(‘References’) || ‘’;
  • chomp($references);
  • my $inreplyto = $head->get(‘In-Reply-To’) || ‘’;
  • chomp($inreplyto);
  • push(@msgids, split(/\s+/, $references)) if ($references);
  • if ($inreplyto) {
  •    if ($inreplyto =~ m/(<[^>]+>)/) {
    
  •        push(@msgids, $1);
    
  •    } else {
    
  •        $RT::Logger->info("Gateway: Unhandled In-Reply-To ".
    
  •                           "format: '$inreplyto'");
    
  •    }
    
  • }
  • Map Message-id(s) to ticket id

  • my %tickets = ();
  • my %checked;
  • my $ticket = RT::Ticket->new($RT::SystemUser);
  • for my $MessageId (@msgids) {
  •    next if $checked{$MessageId}; # Already looked up this message-id
    
  •    my $ticketid = $ticket->LoadByMessageId($MessageId);
    
  •    $tickets{$ticketid} = 1 if defined $ticketid;
    
  •    $checked{$MessageId} = 1;
    
  • }
  • my @ticketids = sort keys %tickets;
  • If the Message-id(s) are already in the database, use their

  • ticked-id

  • if (1 < @ticketids) {
  •    $RT::Logger->debug("Gateway: Several possible tickets: " .
    
  •                       join(",", @ticketids) );
    
  • }
  • Just pick the first. Not sure how we should handle several

  • ticket ids

  • return $ticketids[0] if (@ticketids);
    +}
    +# }}}

{{{ ParseCcAddressesFromHead

=head2 ParseCcAddressesFromHead HASHREF
@@ -471,6 +524,9 @@

 $args{'ticket'} ||= $parser->ParseTicketId($Subject);
  • Check references headers if subject is missing ticket info

  • $args{‘ticket’} ||= ParseReferences($head);
    my $SystemTicket;
    my $Right = ‘CreateTicket’;
    if ( $args{‘ticket’} ) {

[Petter Reinholdtsen]

Based on this initial try, and some clues from the thread discussing
messageid parsing in RT::Attachment, I ended up with the following
patch to get what I wanted. This patch is tested and found to work
fine.

If the patch is acceptable, please include it in a future version of
RT. If it isn’t acceptable, please let me know what is wrong with it.

Anything wrong with this patch?

I’m still not sure how to find out when a patch is accepted or not.
Which branch of subversion should I keep an eye on? Will someone
respond to my message letting me know the patch was accepted or
rejected? Should I submit the patch into the bug tracking system?

[Petter Reinholdtsen]

Based on this initial try, and some clues from the thread discussing
messageid parsing in RT::Attachment, I ended up with the following
patch to get what I wanted. This patch is tested and found to work
fine.

If the patch is acceptable, please include it in a future version of
RT. If it isn’t acceptable, please let me know what is wrong with it.

Anything wrong with this patch?

I’m still not sure how to find out when a patch is accepted or not.
Which branch of subversion should I keep an eye on? Will someone
respond to my message letting me know the patch was accepted or
rejected? Should I submit the patch into the bug tracking system?

The intent is clearly pretty cool, but I haven’t had a chance to look,
honestly. At this point, I’d expect it to go into 3.3 or 3.5.

To submit a patch for inclusion, you should send it to
rt-bugs@lists.bestpractical.com. When I get a chance, I do try to
review patches on rt-devel, but well, these customers keep my nose to
the grindstone.

We’re much more likely to look at patches that come with set of new
tests to add to the test suite to “prove” the functionality.