[Rt-devel] No MessageId set for Attachments?

Petter Reinholdtsen pere at hungry.com
Fri Sep 3 04:04:01 EDT 2004


I started to look at a way to find ticket ID based on message ID.  It
would be useful for us when needing to find out where a specific
message ended up in RT.

Lookin in the database, I noticed that the messageid column in the
attachments table always is NULL (Rt 3.2.1).  Looking further, I
discovered that the Attachment class fail to parse out the MessageId,
and thus the value is never set.

This patch should fix the problem.  Is this the correct location to
add this code?

Index: lib/RT/Attachment_Overlay.pm
===================================================================
--- lib/RT/Attachment_Overlay.pm        (revision 1413)
+++ lib/RT/Attachment_Overlay.pm        (working copy)
@@ -153,6 +153,11 @@
     defined($Subject) or $Subject = '';
     chomp($Subject);

+    #Get the MessageID
+    my $MessageId = $Attachment->head->get( 'messageid', 0 );
+    defined($MessageId) or $MessageId = '';
+    chomp($MessageId);
+
     #Get the filename
     my $Filename = $Attachment->head->recommended_filename || eval {
        ${ $Attachment->head->{mail_hdr_hash}{'Content-Disposition'}[0] }
@@ -167,6 +172,7 @@
             Parent        => 0,
             ContentType   => $Attachment->mime_type,
             Headers => $Attachment->head->as_string,
+            MessageId => $MessageId,
             Subject => $Subject);

         foreach my $part ( $Attachment->parts ) {


More information about the Rt-devel mailing list