[Rt-devel] No MessageId set for Attachments?
Ruslan U. Zakirov
cubic at acronis.ru
Fri Sep 3 04:24:48 EDT 2004
Petter Reinholdtsen wrote:
> 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 );
I don't think that MessageId should be '' if it's undefind. I prefer
NULL, but anyway next code is more readable
my $MessageId = $Attachment->head->get( 'messageid', 0 ) || '';
then this trick with defined:
> + defined($MessageId) or $MessageId = '';
or:
$MessageId = '' unless defined $MessageId;
> + chomp($MessageId);
useless
> +
> #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 ) {
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
More information about the Rt-devel
mailing list