From 851fc6603399c5f839510b2769717f2b99a58fd0 Mon Sep 17 00:00:00 2001 From: miker Date: Tue, 20 Nov 2007 18:46:25 +0000 Subject: [PATCH] pushing locale through in the perl git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1131 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/AppSession.pm | 1 + src/perlmods/OpenSRF/Transport.pm | 3 +++ src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm | 4 +++- src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm | 11 +++++++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/perlmods/OpenSRF/AppSession.pm b/src/perlmods/OpenSRF/AppSession.pm index 517fdf8..76f6c09 100644 --- a/src/perlmods/OpenSRF/AppSession.pm +++ b/src/perlmods/OpenSRF/AppSession.pm @@ -544,6 +544,7 @@ sub send { $self->{peer_handle}->send( to => $self->remote_id, thread => $self->session_id, + locale => $self->session_locale, body => $json ); if( $disconnect) { diff --git a/src/perlmods/OpenSRF/Transport.pm b/src/perlmods/OpenSRF/Transport.pm index fbecf58..bf29dc8 100644 --- a/src/perlmods/OpenSRF/Transport.pm +++ b/src/perlmods/OpenSRF/Transport.pm @@ -87,6 +87,7 @@ sub handler { # Extract message information my $remote_id = $helper->get_remote_id(); my $sess_id = $helper->get_sess_id(); + my $locale = $helper->get_locale(); my $body = $helper->get_body(); my $type = $helper->get_msg_type(); @@ -152,6 +153,8 @@ sub handler { } } + # set the locale for the session, if passed + $app_session->session_locale($locale) if ($locale); # cycle through and pass each oilsMessage contained in the message # up to the message layer for processing. diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm index 657f719..18529c5 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm @@ -406,6 +406,7 @@ sub send { my $thread = $params{'thread'} || ""; my $router_command = $params{'router_command'} || ""; my $router_class = $params{'router_class'} || ""; + my $locale = $params{'locale'} || ""; my $msg = OpenSRF::Transport::SlimJabber::MessageWrapper->new; @@ -414,7 +415,8 @@ sub send { $msg->setBody( $body ); $msg->set_router_command( $router_command ); $msg->set_router_class( $router_class ); - $msg->set_osrf_xid($logger->get_osrf_xid); + $msg->set_locale( $locale ); + $msg->set_osrf_xid($logger->get_osrf_xid); $logger->transport( "JabberClient Sending message to $to with thread $thread and body: \n$body", INTERNAL ); diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm index 3f5393c..79011dd 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/MessageWrapper.pm @@ -122,5 +122,16 @@ sub get_osrf_xid { $self->{msg_node}->getAttribute('osrf_xid'); } +sub set_locale { + my( $self, $xid ) = @_; + $self->{msg_node}->setAttribute( locale => $xid ); +} + + +sub get_locale { + my $self = shift; + $self->{msg_node}->getAttribute('locale'); +} + 1; -- 2.11.0