[Rt-devel] Altering a new ticket's subject

Dan Thomson thomson.dan at gmail.com
Fri Mar 20 16:38:29 EDT 2009


Hey all,

I've been playing with RT recently and I've been charged with making
small automatic modifications to a ticket's Subject field upon
reception of an email. I'm trying to do this in the least invasive way
possible, but I can't figure out how to do this without making
modifications to the actual RT code base.

What I'm doing presently is making use of the "Pre" callback in
mail-gateway to add some tags to the message subject line, then
returning the modification to $ARGS{'message'}.

eg.

       diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway
rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
       --- rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway  2009-03-20
14:10:23.000000000 -0400
       +++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
2009-03-20 14:10:46.000000000 -0400
       @@ -52,7 +52,11 @@
        $ticket => undef
        </%ARGS>
        <%init>
       -$m->comp('/Elements/Callback', _CallbackName => 'Pre', %ARGS);
       +my %argsTmp = $m->comp('/Elements/Callback', _CallbackName =>
'Pre', %ARGS);
       +if($argsTmp{'message'})
       +{
       +   $ARGS{'message'} = $argsTmp{'message'};
       +}
        use RT::Interface::Email ();    # It's an exporter, but we don't care
        $r->content_type('text/plain; charset=utf-8');
        $m->error_format('text');


There's gotta be a better way, but I don't know the code well enough
myself. Can anybody point me in the right direction here? I'm
presently using version 3.6.1 (I know, I know, I know :)). Any help
would be appreciated.

Thanks,

-- 
Dan Thomson


More information about the Rt-devel mailing list