/* 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 );
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" );
}
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;
}
use XML::LibXML;
use constant JABBER_MESSAGE =>
- "<message to='%s' from='%s router_command='%s' router_class='%s' osrf_xid='%s''>".
+ "<message to='%s' from='%s>".
"<opensrf router_command='%s' router_class='%s' osrf_xid='%s'/>".
"<thread>%s</thread><body>%s</body></message>";
JABBER_MESSAGE,
$self->{to},
$self->{from},
- # once on <message>
- $self->{router_command},
- $self->{router_class},
- $self->{osrf_xid},
- # and again on <opensrf/>
$self->{router_command},
$self->{router_class},
$self->{osrf_xid},
$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');
}
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;