Module: sip-router Branch: master Commit: 546dbde191dfb752abde2cd5a4a7cf9955a31768 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=546dbde1...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Tue Apr 22 15:56:30 2014 +0200
mtree: rpc mtree.summary returns an array to comply with xmlrpc format
---
modules/mtree/mtree_mod.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/modules/mtree/mtree_mod.c b/modules/mtree/mtree_mod.c index b6ed382..f48e443 100644 --- a/modules/mtree/mtree_mod.c +++ b/modules/mtree/mtree_mod.c @@ -1030,19 +1030,24 @@ void rpc_mtree_summary(rpc_t* rpc, void* c)
if(!mt_defined_trees()) { - rpc->fault(c, 500, "Empty tree list."); + rpc->fault(c, 500, "Empty tree list"); return; }
- if (rpc->add(c, "{", &th) < 0) + pt = mt_get_first_tree(); + if(pt==NULL) { - rpc->fault(c, 500, "Internal error creating rpc"); + rpc->fault(c, 404, "No tree"); return; } - pt = mt_get_first_tree();
while(pt!=NULL) { + if (rpc->add(c, "{", &th) < 0) + { + rpc->fault(c, 500, "Internal error creating rpc"); + return; + } if(rpc->struct_add(th, "s{", "table", pt->tname.s, "item", &ih) < 0) @@ -1201,7 +1206,7 @@ static const char* rpc_mtree_match_doc[6] = {
rpc_export_t mtree_rpc[] = { - {"mtree.summary", rpc_mtree_summary, rpc_mtree_summary_doc, 0}, + {"mtree.summary", rpc_mtree_summary, rpc_mtree_summary_doc, RET_ARRAY}, {"mtree.reload", rpc_mtree_reload, rpc_mtree_reload_doc, 0}, {"mtree.match", rpc_mtree_match, rpc_mtree_match_doc, 0}, {0, 0, 0, 0}