/****************************************************************************
**
** DCOP Stub Implementation created by dcopidl2cpp from WebServerManager.kidl
**
** WARNING! All changes made in this file will be lost!
**
*****************************************************************************/

#include "WebServerManager_stub.h"
#include <dcopclient.h>

#include <kdatastream.h>

namespace KPF {

WebServerManager_stub::WebServerManager_stub( const TQCString& app, const TQCString& obj )
  : DCOPStub( app, obj )
{
}

WebServerManager_stub::WebServerManager_stub( DCOPClient* client, const TQCString& app, const TQCString& obj )
  : DCOPStub( client, app, obj )
{
}

WebServerManager_stub::WebServerManager_stub( const DCOPRef& ref )
  : DCOPStub( ref )
{
}

TQValueList<DCOPRef> WebServerManager_stub::serverList()
{
    TQValueList<DCOPRef> result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    if ( dcopClient()->call( app(), obj(), "serverList()", data, replyType, replyData ) ) {
	if ( replyType == "TQValueList<DCOPRef>" ) {
	    TQDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

DCOPRef WebServerManager_stub::createServer( TQString arg0, uint arg1, uint arg2, uint arg3, bool arg4, TQString arg5 )
{
    DCOPRef result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    arg << arg2;
    arg << arg3;
    arg << arg4;
    arg << arg5;
    if ( dcopClient()->call( app(), obj(), "createServer(TQString,uint,uint,uint,bool,TQString)", data, replyType, replyData ) ) {
	if ( replyType == "DCOPRef" ) {
	    TQDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

void WebServerManager_stub::disableServer( DCOPRef arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    if ( dcopClient()->call( app(), obj(), "disableServer(DCOPRef)", data, replyType, replyData ) ) {
	setStatus( CallSucceeded );
    } else { 
	callFailed();
    }
}

void WebServerManager_stub::quit()
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    if ( dcopClient()->call( app(), obj(), "quit()", data, replyType, replyData ) ) {
	setStatus( CallSucceeded );
    } else { 
	callFailed();
    }
}

} // namespace

