[Rt-commit] rt branch, 4.0/interface-and-ip-in-headers, created. rt-4.0.5-79-g1e69f4e
Jason May
jasonmay at bestpractical.com
Fri Feb 17 10:21:14 EST 2012
The branch, 4.0/interface-and-ip-in-headers has been created
at 1e69f4e09e43cdae0925a547f27c444a1a722a08 (commit)
- Log -----------------------------------------------------------------
commit 5bfc1de72266c7f3915c867ad296b9ecc91ba010
Author: Jason May <jasonmay at bestpractical.com>
Date: Mon Dec 19 18:04:27 2011 -0500
Put client's remote IP in the MIME headers for new tickets
Putting X-RT-Received-IP in the MIME header for the initial ticket
action makes the sender's source easier to track than digging through
access logs.
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 39c0c8c..494a716 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1689,6 +1689,7 @@ sub MakeMIMEEntity {
my $Message = MIME::Entity->build(
Type => 'multipart/mixed',
"Message-Id" => RT::Interface::Email::GenMessageId,
+ "X-RT-Received-IP" => $ENV{'REMOTE_ADDR'},
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..58404ca 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-Received-IP' => $ENV{REMOTE_ADDR},
+);
$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 9ae803d..79371ed 100755
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -171,7 +171,8 @@ else {
MIME::Entity->build(
From => $session{CurrentUser}->EmailAddress,
Subject => $v{Subject},
- Data => $text
+ Data => $text,
+ 'X-RT-Received-IP' => $ENV{REMOTE_ADDR},
);
}
diff --git a/share/html/REST/1.0/ticket/comment b/share/html/REST/1.0/ticket/comment
index 768a468..90fe8f8 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-Received-IP' => $ENV{REMOTE_ADDR},
+);
$ent->attach(Data => $k->{Text}) if $k->{Text};
my $i = 1;
commit 1e69f4e09e43cdae0925a547f27c444a1a722a08
Author: Jason May <jasonmay at bestpractical.com>
Date: Thu Feb 16 16:45:16 2012 -0500
Specify the interface of creation in the MIME headers
This allows for introspection in scrips whether tickets were made from
REST, web, email, mobile, etc.
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 909a9f4..1e3dcbf 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1514,6 +1514,9 @@ sub Gateway {
);
}
+ # Copy Originating-IP to RT-Received-IP for completeness
+ $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 494a716..42bc0d8 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1331,11 +1331,12 @@ sub CreateTicket {
);
my $MIMEObj = MakeMIMEEntity(
- Subject => $ARGS{'Subject'},
- From => $ARGS{'From'},
- Cc => $ARGS{'Cc'},
- Body => $sigless,
- Type => $ARGS{'ContentType'},
+ Subject => $ARGS{'Subject'},
+ From => $ARGS{'From'},
+ Cc => $ARGS{'Cc'},
+ Body => $sigless,
+ Type => $ARGS{'ContentType'},
+ Interface => 'Web',
);
if ( $ARGS{'Attachments'} ) {
@@ -1551,9 +1552,10 @@ sub ProcessUpdateMessage {
}
my $Message = MakeMIMEEntity(
- Subject => $args{ARGSRef}->{'UpdateSubject'},
- Body => $args{ARGSRef}->{'UpdateContent'},
- Type => $args{ARGSRef}->{'UpdateContentType'},
+ Subject => $args{ARGSRef}->{'UpdateSubject'},
+ Body => $args{ARGSRef}->{'UpdateContent'},
+ Type => $args{ARGSRef}->{'UpdateContentType'},
+ Interface => 'Web',
);
$Message->head->replace( 'Message-ID' => Encode::encode_utf8(
@@ -1689,7 +1691,7 @@ sub MakeMIMEEntity {
my $Message = MIME::Entity->build(
Type => 'multipart/mixed',
"Message-Id" => RT::Interface::Email::GenMessageId,
- "X-RT-Received-IP" => $ENV{'REMOTE_ADDR'},
+ "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 58404ca..6d87b5d 100755
--- a/share/html/REST/1.0/Forms/ticket/comment
+++ b/share/html/REST/1.0/Forms/ticket/comment
@@ -92,6 +92,7 @@ my $cgi = $m->cgi_object;
my $ent = MIME::Entity->build(
Type => "multipart/mixed",
'X-RT-Received-IP' => $ENV{REMOTE_ADDR},
+ 'X-RT-Interface' => 'REST',
);
$ent->attach(Data => $changes{Text}) if $changes{Text};
diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 79371ed..2dea403 100755
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -173,6 +173,7 @@ else {
Subject => $v{Subject},
Data => $text,
'X-RT-Received-IP' => $ENV{REMOTE_ADDR},
+ 'X-RT-Interface' => 'REST',
);
}
diff --git a/share/html/REST/1.0/ticket/comment b/share/html/REST/1.0/ticket/comment
index 90fe8f8..950012f 100755
--- a/share/html/REST/1.0/ticket/comment
+++ b/share/html/REST/1.0/ticket/comment
@@ -109,6 +109,7 @@ my $cgi = $m->cgi_object;
my $ent = MIME::Entity->build(
Type => "multipart/mixed",
'X-RT-Received-IP' => $ENV{REMOTE_ADDR},
+ 'X-RT-Interface' => 'REST',
);
$ent->attach(Data => $k->{Text}) if $k->{Text};
diff --git a/share/html/SelfService/Display.html b/share/html/SelfService/Display.html
index 23c7467..7edcc62 100755
--- a/share/html/SelfService/Display.html
+++ b/share/html/SelfService/Display.html
@@ -133,8 +133,11 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) {
}
- ( $Ticket, @results ) =
- CreateTicket( Attachments => $session{'Attachments'}, %ARGS );
+ ( $Ticket, @results ) = CreateTicket(
+ Attachments => $session{'Attachments'},
+ Interface => 'Web',
+ %ARGS
+ );
unless ( $Ticket->id ) {
$m->comp( 'Error.html', Why => join( "\n", @results ));
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 5e84a50..ca8e7cd 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -129,6 +129,7 @@ if ($ARGS{'id'} eq 'new') {
($TicketObj, @Actions) = CreateTicket(
Attachments => delete $session{'Attachments'},
+ Interface => 'Web',
%ARGS,
);
unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) {
diff --git a/share/html/index.html b/share/html/index.html
index d85fbaa..2063da9 100755
--- a/share/html/index.html
+++ b/share/html/index.html
@@ -111,7 +111,8 @@ if ( $ARGS{'QuickCreate'} ) {
Requestors => $ARGS{'Requestors'},
From => $session{'CurrentUser'}->EmailAddress,
Content => $ARGS{'Content'},
- Subject => $ARGS{'Subject'});
+ Subject => $ARGS{'Subject'},
+ Interface => 'Web');
push @results, $msg;
if ( $t && $t->Id && RT->Config->Get('DisplayTicketAfterQuickCreate', $session{'CurrentUser'}) ) {
diff --git a/share/html/m/ticket/show b/share/html/m/ticket/show
index 2b45e90..50df7bb 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') ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list