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

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

#include <kdatastream.h>


SessionIface_stub::SessionIface_stub( const QCString& app, const QCString& obj )
  : DCOPStub( app, obj )
{
}

SessionIface_stub::SessionIface_stub( DCOPClient* client, const QCString& app, const QCString& obj )
  : DCOPStub( client, app, obj )
{
}

bool SessionIface_stub::closeSession()
{
    bool result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    QByteArray data, replyData;
    QCString replyType;
    if ( dcopClient()->call( app(), obj(), "closeSession()", data, replyType, replyData ) ) {
	if ( replyType == "bool" ) {
	    QDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

bool SessionIface_stub::sendSignal( int arg0 )
{
    bool result;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    QByteArray data, replyData;
    QCString replyType;
    QDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    if ( dcopClient()->call( app(), obj(), "sendSignal(int)", data, replyType, replyData ) ) {
	if ( replyType == "bool" ) {
	    QDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}


