#include "XmlRpcppClient.hpp"

using namespace mole;
using namespace ctx;
using namespace xmlrpcpp;

XmlRpcppClient::XmlRpcppClient(const char * u, int p, const char * s):
  client(new XmlRpc::XmlRpcClient(u, p, s)){}

XmlRpcppClient::~XmlRpcppClient(){}

/* TODO : Verify it... */
bool
XmlRpcppClient::bind(Server * s, bool co){
    if (s){
	if (client){
	    client->close();
	    delete client;
	}

	client = new XmlRpc::XmlRpcClient(
		s->getIp().c_str(),
		s->getPort(),
		s->getPath().c_str());
	return co && connect();
    }
    return false;
}
