mod_xmlrpc {bad_value,ok} bug (with patch)

Sorry to post here, but the Bugzilla did not have a category for mod_xmlrpc. I had a problem with running add_rosteritem in mod_xmlrpc on:

ejabberd 1.1.1
erlang/otp R11B-0
xmlrpc-1.13

When trying to use add_rosteritem, any success would result in a 500 server error. The complaint was that 'ok' was not a valid response:

=ERROR REPORT==== 2006-07-18 16:29:24 ===
{xmlrpc_http,180,{xmlrpc_encode,payload,{response,[ok]},{bad_value,ok}}}

I fixed the problem by replacing 'ok' with 0:

Index: apps/ejabberd/trunk/sources/ejabberd-1.1.1/src/mod_xmlrpc.erl
===================================================================
--- apps/ejabberd/trunk/sources/ejabberd-1.1.1/src/mod_xmlrpc.erl (revision 271)
+++ apps/ejabberd/trunk/sources/ejabberd-1.1.1/src/mod_xmlrpc.erl (revision 273)
@@ -191,7 +191,7
 	Node = node(),
     R = case add_rosteritem(Localuser, Localserver, User, Server, Nick, Group, list_to_atom(Subs), []) of
 		{atomic, ok} ->
-		    ok;
+		    0;
 		{error, Reason} ->
 			io:format("Can't add roster item to user ~p@~p on node ~p: ~p~n",
 		      [Localuser, Localserver, Node, Reason]);

I hope this helps anyone trying to use add_rosteritem with a new ejabberd setup.

You are right... what a

You are right... what a silly bug. I've just applied the patch and published the fixed module.

Thanks.

Syndicate content