Re: [rt-users] Recognize tickets created via email or via web

2013-03-22 Thread Emmanuel Lacour
On 21/03/2013 12:38, Michele Bergonzoni wrote:
 I have a custom scrip where I want to distinguish whether the ticket was
 created via email or via web.
 
 Now I am looking at ther Received: header of the first attachment of
 the first transaction of the ticket:

[...]

 This apparently works and has insofar not misclassified, but seems quite
 ugly to me. For example, future versions of RT could add a Received:
 with the IP address where the web connection came from (many webmails do
 that). I didn't even try with a ticket created via CLI.
 
 Can anyone suggest a better and future-proof approach?
 

well that's what I used to used since a long time and it still works ;)

if you look at the transactions and attachments table, there is
currently no dedicated field/header set by RT to distinguish those
transactions. SO as of now, looking at the Received header looks the
best solution.

-- 
Easter-eggs  Spécialiste GNU/Linux
44-46 rue de l'Ouest  -  75014 Paris  -  France -  Métro Gaité
Phone: +33 (0) 1 43 35 00 37-   Fax: +33 (0) 1 43 35 00 76
mailto:elac...@easter-eggs.com  -   http://www.easter-eggs.com


Re: [rt-users] Recognize tickets created via email or via web

2013-03-22 Thread Craig Ringer
On 03/22/2013 05:19 PM, Emmanuel Lacour wrote:
 On 21/03/2013 12:38, Michele Bergonzoni wrote:
 I have a custom scrip where I want to distinguish whether the ticket was
 created via email or via web.

 Now I am looking at ther Received: header of the first attachment of
 the first transaction of the ticket:
 [...]

 This apparently works and has insofar not misclassified, but seems quite
 ugly to me. For example, future versions of RT could add a Received:
 with the IP address where the web connection came from (many webmails do
 that). I didn't even try with a ticket created via CLI.

 Can anyone suggest a better and future-proof approach?

 well that's what I used to used since a long time and it still works ;)

 if you look at the transactions and attachments table, there is
 currently no dedicated field/header set by RT to distinguish those
 transactions. SO as of now, looking at the Received header looks the
 best solution.
Another option would be to modify RT::Interface::Email.pm and
RT::Interface::Web.pm to insert the desired header into the generated
message (in the case of Web.pm) or parsed email (in the case of
Email.pm). You could probably make a convincing case for such a patch to
be accepted into RT proper, at least for adding a header to Web.pm
generated messages; probably harder to argue modification of externally
originated mail for Email.pm.

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services



Re: [rt-users] Recognize tickets created via email or via web

2013-03-22 Thread Thomas Sibley
Michele, if you upgrade to RT 4.0.9 you can use the X-RT-Interface
header.  The potential values are Email, Web, Mobile, REST, and API.

Craig,

 Another option would be to modify RT::Interface::Email.pm and
 RT::Interface::Web.pm to insert the desired header into the generated
 message (in the case of Web.pm) or parsed email (in the case of
 Email.pm). You could probably make a convincing case for such a patch to
 be accepted into RT proper...

This is exactly what we've done:

tom@whaam rt (4.0-trunk=) $ git ack 'X-RT-Interface'
lib/RT/Interface/Email.pm
1567:$head-replace('X-RT-Interface' = 'Email');

lib/RT/Interface/Web.pm
2077:X-RT-Interface = $args{Interface},
2121:$Message-head-delete('X-RT-Interface');

lib/RT/Ticket.pm
2243:$args{'MIMEObj'}-head-replace('X-RT-Interface' = 'API')
2244:unless $args{'MIMEObj'}-head-get('X-RT-Interface');

share/html/REST/1.0/Forms/ticket/comment
95:'X-RT-Interface' = 'REST',

share/html/REST/1.0/Forms/ticket/default
192:'X-RT-Interface' = 'REST',

share/html/REST/1.0/ticket/comment
112:'X-RT-Interface' = 'REST',



Re: [rt-users] Recognize tickets created via email or via web

2013-03-22 Thread Michele Bergonzoni

Il 22/03/2013 17.48, Thomas Sibley wrote:

Michele, if you upgrade to RT 4.0.9 you can use the X-RT-Interface
header.  The potential values are Email, Web, Mobile, REST, and API.


Many thanks to you and to other people who pointed this out privately, 
this is exactly what I was looking for.


Regards,
Bergonz


--
Ing. Michele Bergonzoni - Laboratori Guglielmo Marconi S.p.a.
Phone:+39-051-6781926 e-mail: berg...@labs.it
alt.advanced.networks.design.configure.operate