From: Mike Rylander Date: Thu, 6 Sep 2018 17:53:51 +0000 (-0400) Subject: Move all the way to a subelement X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fmiker%2Flp-1703411-xmpp-opensrf-message-subelement;p=working%2FOpenSRF.git Move all the way to a subelement Signed-off-by: Mike Rylander --- diff --git a/src/libopensrf/transport_message.c b/src/libopensrf/transport_message.c index 40217d2..f95debc 100644 --- a/src/libopensrf/transport_message.c +++ b/src/libopensrf/transport_message.c @@ -396,11 +396,6 @@ int message_prepare_xml( transport_message* msg ) { /* set from and to */ xmlNewProp( message_node, BAD_CAST "to", BAD_CAST msg->recipient ); xmlNewProp( message_node, BAD_CAST "from", BAD_CAST msg->sender ); - xmlNewProp( message_node, BAD_CAST "router_from", BAD_CAST msg->router_from ); - xmlNewProp( message_node, BAD_CAST "router_to", BAD_CAST msg->router_to ); - xmlNewProp( message_node, BAD_CAST "router_class", BAD_CAST msg->router_class ); - xmlNewProp( message_node, BAD_CAST "router_command", BAD_CAST msg->router_command ); - xmlNewProp( message_node, BAD_CAST "osrf_xid", BAD_CAST msg->osrf_xid ); /* set from and to on a new node, also */ opensrf_node = xmlNewChild(message_node, NULL, (xmlChar*) "opensrf", NULL ); @@ -413,7 +408,6 @@ int message_prepare_xml( transport_message* msg ) { xmlAddChild(message_node, opensrf_node); if( msg->broadcast ) { - xmlNewProp( message_node, BAD_CAST "broadcast", BAD_CAST "1" ); xmlNewProp( opensrf_node, BAD_CAST "broadcast", BAD_CAST "1" ); } diff --git a/src/libopensrf/transport_session.c b/src/libopensrf/transport_session.c index 99b1a3f..7ea15d5 100644 --- a/src/libopensrf/transport_session.c +++ b/src/libopensrf/transport_session.c @@ -573,14 +573,6 @@ static void startElementHandler( ses->state_machine->in_message = 1; buffer_add( ses->from_buffer, get_xml_attr( atts, "from" ) ); buffer_add( ses->recipient_buffer, get_xml_attr( atts, "to" ) ); - buffer_add( ses->router_from_buffer, get_xml_attr( atts, "router_from" ) ); - buffer_add( ses->osrf_xid_buffer, get_xml_attr( atts, "osrf_xid" ) ); - buffer_add( ses->router_to_buffer, get_xml_attr( atts, "router_to" ) ); - buffer_add( ses->router_class_buffer, get_xml_attr( atts, "router_class" ) ); - buffer_add( ses->router_command_buffer, get_xml_attr( atts, "router_command" ) ); - const char* broadcast = get_xml_attr( atts, "broadcast" ); - if( broadcast ) - ses->router_broadcast = atoi( broadcast ); return; } diff --git a/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPMessage.pm b/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPMessage.pm index cc10054..44e2040 100644 --- a/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPMessage.pm +++ b/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPMessage.pm @@ -6,7 +6,7 @@ use strict; use warnings; use XML::LibXML; use constant JABBER_MESSAGE => - "". + "". "%s%s"; @@ -100,11 +100,6 @@ sub to_xml { JABBER_MESSAGE, $self->{to}, $self->{from}, - # once on - $self->{router_command}, - $self->{router_class}, - $self->{osrf_xid}, - # and again on $self->{router_command}, $self->{router_class}, $self->{osrf_xid}, @@ -131,17 +126,13 @@ sub parse_xml { $self->{body} = $root->findnodes('/message/body').''; $self->{thread} = $root->findnodes('/message/thread').''; - $self->{from} = $root->getAttribute('router_from'); - $self->{from} = $osrf_node->getAttribute('router_from') if $osrf_node; + $self->{from} = $osrf_node->getAttribute('router_from'); $self->{from} = $root->getAttribute('from') unless $self->{from}; $self->{to} = $root->getAttribute('to'); - $self->{type} = $root->getAttribute('type'); - $self->{osrf_xid} = $root->getAttribute('osrf_xid'); - - $self->{type} = $osrf_node->getAttribute('type') if $osrf_node; - $self->{osrf_xid} = $osrf_node->getAttribute('osrf_xid') if $osrf_node; + $self->{type} = $osrf_node->getAttribute('type'); + $self->{osrf_xid} = $osrf_node->getAttribute('osrf_xid'); } diff --git a/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm b/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm index c68b8bc..737cf96 100644 --- a/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm +++ b/src/perl/lib/OpenSRF/Transport/SlimJabber/XMPPReader.pm @@ -306,18 +306,15 @@ sub start_element { my $msg = $self->{message}; $msg->{to} = $attrs{'to'}; - $msg->{from} = $attrs{router_from} if $attrs{router_from}; - $msg->{from} = $attrs{from} unless $msg->{from}; - $msg->{osrf_xid} = $attrs{'osrf_xid'}; - $msg->{type} = $attrs{type}; + $msg->{from} = $attrs{from}; } elsif($name eq 'opensrf') { # These will be authoritative if they exist my $msg = $self->{message}; - $msg->{from} = $attrs{router_from} if $attrs{router_from}; - $msg->{osrf_xid} = $attrs{'osrf_xid'} if $attrs{'osrf_xid'}; - $msg->{type} = $attrs{type} if $attrs{type}; + $msg->{from} = $attrs{router_from}; + $msg->{osrf_xid} = $attrs{'osrf_xid'}; + $msg->{type} = $attrs{type}; } elsif($name eq 'body') { $self->{xml_state} = IN_BODY;