/***************************************************************************
                            KSSLPeerInfo.cpp -  description
                             -------------------
    begin                : Fri Mar 15 15:14:30 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar 15 15:14:30 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <ksslpeerinfo.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KSSLPeerInfo.h>

class KSSLPeerInfoJBridge : public KSSLPeerInfo
{
public:
	~KSSLPeerInfoJBridge() {QtSupport::qtKeyDeleted(this);}
	KSSLPeerInfoJBridge() : KSSLPeerInfo() {}
};


JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (KSSLPeerInfo*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_dispose(JNIEnv *env, jobject obj)
{
	Java_org_kde_koala_KSSLPeerInfo_finalize(env, obj);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KSSLPeerInfo_isDisposed(JNIEnv *env, jobject obj)
{
	return (QtSupport::getQt(env, obj) == 0);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KSSLPeerInfo_getPeerCertificate(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)(KSSLCertificate *) &((KSSLPeerInfo*) QtSupport::getQt(env, obj))->getPeerCertificate(), "org.kde.koala.KSSLCertificate");
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KSSLPeerInfo_certMatchesAddress(JNIEnv *env, jobject obj)
{
	return (jboolean) ((KSSLPeerInfo*) QtSupport::getQt(env, obj))->certMatchesAddress();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_setPeerHost__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring host)
{
static QString * _qstring_host = 0;
	((KSSLPeerInfo*) QtSupport::getQt(env, obj))->setPeerHost((QString) * (QString *) QtSupport::toQString(env, host, &_qstring_host));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_setPeerHost__(JNIEnv *env, jobject obj)
{
	((KSSLPeerInfo*) QtSupport::getQt(env, obj))->setPeerHost(QString::null);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_reset(JNIEnv *env, jobject obj)
{
	((KSSLPeerInfo*) QtSupport::getQt(env, obj))->reset();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KSSLPeerInfo_newKSSLPeerInfo(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KSSLPeerInfoJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

