[Rt-commit] rt branch, 4.0/interface-in-headers, created. rt-4.0.6-233-gf944369
Alex Vandiver
alexmv at bestpractical.com
Thu Jun 28 21:12:37 EDT 2012
The branch, 4.0/interface-in-headers has been created
at f94436948fc1c1c82b554aee83ac67b243937867 (commit)
- Log -----------------------------------------------------------------
commit f94436948fc1c1c82b554aee83ac67b243937867
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 28 20:42:51 2012 -0400
Encode the interface (Email/Web/Mobile/REST) that content came from
While examining the presence of the Recieved header was often used as a
stand-in for knowing if a transaction was initiated via email or not, it
is simpler to record the interface explicitly. Store one of four values
in the X-RT-Interface MIME header: Email, Web, Mobile, or REST,
depending on the endpoint of the request that created the MIME object.
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 8f38d99..784516b 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1519,6 +1519,8 @@ sub Gateway {
);
}
+ $head->replace('X-RT-Interface' => 'Email');
+
my ( $id, $Transaction, $ErrStr ) = $Ticket->Create(
Queue => $SystemQueueObj->Id,
Subject => $Subject,
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 91c8ff2..1d1c771 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1588,6 +1588,7 @@ sub CreateTicket {
Cc => $ARGS{'Cc'},
Body => $sigless,
Type => $ARGS{'ContentType'},
+ Interface => $ARGS{'Interface'} || 'Web',
);
if ( $ARGS{'Attachments'} ) {
@@ -1770,6 +1771,7 @@ sub ProcessUpdateMessage {
ARGSRef => undef,
TicketObj => undef,
SkipSignatureOnly => 1,
+ Interface => 'Web',
@_
);
@@ -1807,6 +1809,7 @@ sub ProcessUpdateMessage {
Subject => $args{ARGSRef}->{'UpdateSubject'},
Body => $args{ARGSRef}->{'UpdateContent'},
Type => $args{ARGSRef}->{'UpdateContentType'},
+ Interface => $args{Interface},
);
$Message->head->replace( 'Message-ID' => Encode::encode_utf8(
@@ -1937,11 +1940,13 @@ sub MakeMIMEEntity {
Body => undef,
AttachmentFieldName => undef,
Type => undef,
+ Interface => 'Web',
@_,
);
my $Message = MIME::Entity->build(
Type => 'multipart/mixed',
"Message-Id" => Encode::encode_utf8( RT::Interface::Email::GenMessageId ),
+ "X-RT-Interface" => $args{Interface},
map { $_ => Encode::encode_utf8( $args{ $_} ) }
grep defined $args{$_}, qw(Subject From Cc)
);
diff --git a/share/html/REST/1.0/Forms/ticket/comment b/share/html/REST/1.0/Forms/ticket/comment
index 35b543d..1baf38f 100755
--- a/share/html/REST/1.0/Forms/ticket/comment
+++ b/share/html/REST/1.0/Forms/ticket/comment
@@ -89,7 +89,10 @@ if (!$changes{Text} && @atts == 0) {
}
my $cgi = $m->cgi_object;
-my $ent = MIME::Entity->build(Type => "multipart/mixed");
+my $ent = MIME::Entity->build(
+ Type => "multipart/mixed",
+ 'X-RT-Interface' => 'REST',
+);
$ent->attach(Data => $changes{Text}) if $changes{Text};
my $i = 1;
diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 032e6c9..6919938 100755
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -188,7 +188,8 @@ else {
MIME::Entity->build(
From => $session{CurrentUser}->EmailAddress,
Subject => $v{Subject},
- Data => $text
+ Data => $text,
+ 'X-RT-Interface' => 'REST',
);
}
diff --git a/share/html/REST/1.0/ticket/comment b/share/html/REST/1.0/ticket/comment
index 768a468..bef2717 100755
--- a/share/html/REST/1.0/ticket/comment
+++ b/share/html/REST/1.0/ticket/comment
@@ -106,7 +106,10 @@ if (!$k->{Text} && @atts == 0) {
}
my $cgi = $m->cgi_object;
-my $ent = MIME::Entity->build(Type => "multipart/mixed");
+my $ent = MIME::Entity->build(
+ Type => "multipart/mixed",
+ 'X-RT-Interface' => 'REST',
+);
$ent->attach(Data => $k->{Text}) if $k->{Text};
my $i = 1;
diff --git a/share/html/m/ticket/show b/share/html/m/ticket/show
index f6ffe88..fbe7521 100644
--- a/share/html/m/ticket/show
+++ b/share/html/m/ticket/show
@@ -71,6 +71,7 @@ if ($ARGS{'id'} eq 'new') {
($Ticket, @Actions) = CreateTicket(
Attachments => delete $session{'Attachments'},
+ Interface => 'Mobile',
%ARGS,
);
unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
@@ -101,6 +102,7 @@ if ($ARGS{'id'} eq 'new') {
ARGSRef => \%ARGS,
Actions => \@Actions,
TicketObj => $Ticket,
+ Interface => 'Mobile',
);
delete $session{'Attachments'};
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list