[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-commit
Subject:    [Rt-commit] rt branch, 4.0/interface-in-headers, created. rt-4.0.6-233-gf93e180
From:       alexmv () bestpractical ! com (Alex Vandiver)
Date:       2012-06-29 23:31:23
Message-ID: 20120629233123.BEE882418001 () booth ! bestpractical ! com
[Download RAW message or body]

The branch, 4.0/interface-in-headers has been created
        at  f93e180d673c30e46715718f19f33122dfe3a1b0 (commit)

- Log -----------------------------------------------------------------
commit f93e180d673c30e46715718f19f33122dfe3a1b0
Author: Alex Vandiver <alexmv@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..08c4f30 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 => MobileClient() ? 'Mobile' : 'Web',
     );
 
     if ( $ARGS{'Attachments'} ) {
@@ -1807,6 +1808,7 @@ sub ProcessUpdateMessage {
         Subject => $args{ARGSRef}->{'UpdateSubject'},
         Body    => $args{ARGSRef}->{'UpdateContent'},
         Type    => $args{ARGSRef}->{'UpdateContentType'},
+        Interface => MobileClient() ? 'Mobile' : 'Web',
     );
 
     $Message->head->replace( 'Message-ID' => Encode::encode_utf8(
@@ -1937,11 +1939,13 @@ sub MakeMIMEEntity {
         Body                => undef,
         AttachmentFieldName => undef,
         Type                => undef,
+        Interface           => 'API',
         @_,
     );
     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;

-----------------------------------------------------------------------
_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic