/* This code is automatically generated by genipc_server.py. Do not edit. */

#include <xmmsc/xmmsv.h>
static void
__int_xmms_cmd_send_message (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	xmmsv_t *t;
	if (xmmsv_list_get_size (arg->args) != 3) {
		XMMS_DBG ("Wrong number of arguments to send_message (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to send_message");
		return;
	}
	gint32 argval0;
	gint32 argval1;
	xmmsv_t * argval2;

	if (!xmmsv_list_get (arg->args, 0, &t)) {
		XMMS_DBG ("Missing arg 0 in send_message");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in send_message");
		return;
	}
	if (!xmmsv_get_int (t, &argval0)) {
		XMMS_DBG ("Error parsing arg 0 in send_message");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in send_message");
		return;
	}
	if (!xmmsv_list_get (arg->args, 1, &t)) {
		XMMS_DBG ("Missing arg 1 in send_message");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in send_message");
		return;
	}
	if (!xmmsv_get_int (t, &argval1)) {
		XMMS_DBG ("Error parsing arg 1 in send_message");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in send_message");
		return;
	}
	if (!xmmsv_list_get (arg->args, 2, &t)) {
		XMMS_DBG ("Missing arg 2 in send_message");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 2 in send_message");
		return;
	}
	argval2 = t;

	xmms_courier_client_send_message ((xmms_courier_t *) object, argval0, argval1, argval2, arg->client, arg->cookie, &arg->error);
	arg->retval = NULL;
}


static void
__int_xmms_cmd_reply (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	xmmsv_t *t;
	if (xmmsv_list_get_size (arg->args) != 3) {
		XMMS_DBG ("Wrong number of arguments to reply (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to reply");
		return;
	}
	gint32 argval0;
	gint32 argval1;
	xmmsv_t * argval2;

	if (!xmmsv_list_get (arg->args, 0, &t)) {
		XMMS_DBG ("Missing arg 0 in reply");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 0 in reply");
		return;
	}
	if (!xmmsv_get_int (t, &argval0)) {
		XMMS_DBG ("Error parsing arg 0 in reply");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 0 in reply");
		return;
	}
	if (!xmmsv_list_get (arg->args, 1, &t)) {
		XMMS_DBG ("Missing arg 1 in reply");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 1 in reply");
		return;
	}
	if (!xmmsv_get_int (t, &argval1)) {
		XMMS_DBG ("Error parsing arg 1 in reply");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Error parsing arg 1 in reply");
		return;
	}
	if (!xmmsv_list_get (arg->args, 2, &t)) {
		XMMS_DBG ("Missing arg 2 in reply");
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Missing arg 2 in reply");
		return;
	}
	argval2 = t;

	xmms_courier_client_reply ((xmms_courier_t *) object, argval0, argval1, argval2, arg->client, arg->cookie, &arg->error);
	arg->retval = NULL;
}


static void
__int_xmms_cmd_get_connected_clients (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to get_connected_clients (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to get_connected_clients");
		return;
	}


	arg->retval = xmms_courier_client_get_connected_clients ((xmms_courier_t *) object, &arg->error);
}


static void
__int_xmms_cmd_ready (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to ready (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to ready");
		return;
	}


	xmms_courier_client_ready ((xmms_courier_t *) object, arg->client, &arg->error);
	arg->retval = xmmsv_new_none ();
}


static void
__int_xmms_cmd_get_ready_clients (xmms_object_t *object, xmms_object_cmd_arg_t *arg)
{
	if (xmmsv_list_get_size (arg->args) != 0) {
		XMMS_DBG ("Wrong number of arguments to get_ready_clients (%d)", xmmsv_list_get_size (arg->args));
		xmms_error_set (&arg->error, XMMS_ERROR_INVAL, "Wrong number of arguments to get_ready_clients");
		return;
	}


	arg->retval = xmms_courier_client_get_ready_clients ((xmms_courier_t *) object, &arg->error);
}



static void
xmms_courier_register_ipc_commands (xmms_object_t *courier_object)
{
	xmms_ipc_object_register (XMMS_IPC_OBJECT_COURIER, courier_object);

	xmms_object_cmd_add (courier_object, XMMS_IPC_COMMAND_COURIER_SEND_MESSAGE, __int_xmms_cmd_send_message);
	xmms_object_cmd_add (courier_object, XMMS_IPC_COMMAND_COURIER_REPLY, __int_xmms_cmd_reply);
	xmms_object_cmd_add (courier_object, XMMS_IPC_COMMAND_COURIER_GET_CONNECTED_CLIENTS, __int_xmms_cmd_get_connected_clients);
	xmms_object_cmd_add (courier_object, XMMS_IPC_COMMAND_COURIER_READY, __int_xmms_cmd_ready);
	xmms_object_cmd_add (courier_object, XMMS_IPC_COMMAND_COURIER_GET_READY_CLIENTS, __int_xmms_cmd_get_ready_clients);

	xmms_ipc_broadcast_register (courier_object, XMMS_IPC_SIGNAL_COURIER_MESSAGE);
	xmms_ipc_broadcast_register (courier_object, XMMS_IPC_SIGNAL_COURIER_READY);

}

static void
xmms_courier_unregister_ipc_commands (void)
{
	xmms_ipc_broadcast_unregister (XMMS_IPC_SIGNAL_COURIER_MESSAGE);
	xmms_ipc_broadcast_unregister (XMMS_IPC_SIGNAL_COURIER_READY);


	xmms_ipc_object_unregister (XMMS_IPC_OBJECT_COURIER);
}
