io BUGFIX handle prefixed rpc in the rpc reply
Fixes #15
diff --git a/src/io.c b/src/io.c
index cffd9df..c17cb57 100644
--- a/src/io.c
+++ b/src/io.c
@@ -1012,7 +1012,15 @@
rpc_elem = va_arg(ap, struct lyxml_elem *);
reply = va_arg(ap, struct nc_server_reply *);
- nc_write_clb((void *)&arg, "<rpc-reply", 10, 0);
+ if (rpc_elem && rpc_elem->ns && rpc_elem->ns->prefix) {
+ nc_write_clb((void *)&arg, "<", 1, 0);
+ nc_write_clb((void *)&arg, rpc_elem->ns->prefix, strlen(rpc_elem->ns->prefix), 0);
+ nc_write_clb((void *)&arg, ":rpc-reply", 10, 0);
+ }
+ else {
+ nc_write_clb((void *)&arg, "<rpc-reply", 10, 0);
+ }
+
/* can be NULL if replying with a malformed-message error */
if (rpc_elem) {
lyxml_print_clb(nc_write_xmlclb, (void *)&arg, rpc_elem, LYXML_PRINT_ATTRS);
@@ -1057,7 +1065,14 @@
va_end(ap);
return -1;
}
- nc_write_clb((void *)&arg, "</rpc-reply>", 12, 0);
+ if (rpc_elem && rpc_elem->ns && rpc_elem->ns->prefix) {
+ nc_write_clb((void *)&arg, "</", 2, 0);
+ nc_write_clb((void *)&arg, rpc_elem->ns->prefix, strlen(rpc_elem->ns->prefix), 0);
+ nc_write_clb((void *)&arg, ":rpc-reply>", 11, 0);
+ }
+ else {
+ nc_write_clb((void *)&arg, "</rpc-reply>", 12, 0);
+ }
break;
case NC_MSG_NOTIF: