changeset 18189:030a2209ae96

- Style issues - Made ssl-gnutls compile
author William Ehlhardt <williamehlhardt@gmail.com>
date Tue, 19 Jun 2007 17:44:54 +0000
parents e6271671eb24
children b2d110e9857f
files libpurple/certificate.h libpurple/plugins/ssl/ssl-gnutls.c
diffstat 2 files changed, 25 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.h	Tue Jun 19 17:20:16 2007 +0000
+++ b/libpurple/certificate.h	Tue Jun 19 17:44:54 2007 +0000
@@ -35,18 +35,18 @@
 extern "C" {
 #endif /* __cplusplus */
 
-typedef struct _Certificate Certificate;
-typedef struct _CertificateScheme CertificateScheme;
+typedef struct _PurpleCertificate PurpleCertificate;
+typedef struct _PurpleCertificateScheme PurpleCertificateScheme;
 
 /** A certificate instance
  *
  *  An opaque data structure representing a single certificate under some
  *  CertificateScheme
  */
-struct _Certificate
+struct _PurpleCertificate
 {
 	/** Scheme this certificate is under */
-	CertificateScheme * scheme;
+	PurpleCertificateScheme * scheme;
 	/** Opaque pointer to internal data */
 	gpointer data;
 };
@@ -59,7 +59,7 @@
  *  There may be only ONE CertificateScheme provided for each certificate
  *  type, as specified by the "name" field.
  */
-struct _CertificateScheme
+struct _PurpleCertificateScheme
 {
 	/** Name of the certificate type
 	 *  ex: "x509", "pgp", etc.
@@ -79,7 +79,7 @@
 	 *  @return           Pointer to the newly allocated Certificate struct
 	 *                    or NULL on failure.
 	 */
-	Certificate * (* import_certificate)(gchar * filename);
+	PurpleCertificate * (* import_certificate)(gchar * filename);
 
 	/** Destroys and frees a Certificate structure
 	 *
@@ -90,7 +90,7 @@
 	 *              destroyed if it is not of the correct
 	 *              CertificateScheme. Can be NULL
 	 */
-	void (* destroy_certificate)(Certificate * crt);
+	void (* destroy_certificate)(PurpleCertificate * crt);
 	
 	/* TODO: Fill out this structure */
 };
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Tue Jun 19 17:20:16 2007 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Tue Jun 19 17:44:54 2007 +0000
@@ -295,7 +295,7 @@
 
 /* Forward declarations are fun!
    TODO: This is a stupid place for this */
-static Certificate *
+static PurpleCertificate *
 x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode);
 
 static GList *
@@ -322,7 +322,7 @@
 
 	/* Convert each certificate to a Certificate and append it to the list */
 	for (i = 0; i < cert_list_size; i++) {
-		Certificate * newcrt = x509_import_from_datum(cert_list[i],
+		PurpleCertificate * newcrt = x509_import_from_datum(cert_list[i],
 							      GNUTLS_X509_FMT_DER);
 		/* Append is somewhat inefficient on linked lists, but is easy
 		   to read. If someone complains, I'll change it.
@@ -341,14 +341,7 @@
 /************************************************************************/
 const gchar * SCHEME_NAME = "x509";
 
-/* X.509 certificate operations provided by this plugin */
-/* TODO: Flesh this out! */
-static CertificateScheme x509_gnutls = {
-	"x509",                          /* Scheme name */
-	N_("X.509 Certificates"),        /* User-visible scheme name */
-	x509_import_from_file,           /* Certificate import function */
-	x509_destroy_certificate         /* Destroy cert */
-};
+static PurpleCertificateScheme x509_gnutls;
 
 /** Transforms a gnutls_datum_t containing an X.509 certificate into a Certificate instance under the x509_gnutls scheme
  *
@@ -359,13 +352,13 @@
  *
  * @return A newly allocated Certificate structure of the x509_gnutls scheme
  */
-static Certificate *
+static PurpleCertificate *
 x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode)
 {
 	/* Internal certificate data structure */
 	gnutls_x509_crt_t *certdat;
 	/* New certificate to return */
-	Certificate * crt;
+	PurpleCertificate * crt;
 
 	/* Allocate and prepare the internal certificate data */
 	certdat = g_new(gnutls_x509_crt_t, 1);
@@ -376,7 +369,7 @@
 	gnutls_x509_crt_import(*certdat, &dt, mode);
 	
 	/* Allocate the certificate and load it with data */
-	crt = g_new(Certificate, 1);
+	crt = g_new(PurpleCertificate, 1);
 	crt->scheme = &x509_gnutls;
 	crt->data = certdat;
 
@@ -388,10 +381,10 @@
  *
  * @return A newly allocated Certificate structure of the x509_gnutls scheme
  */
-static Certificate *
+static PurpleCertificate *
 x509_import_from_file(const gchar * filename)
 {
-	Certificate *crt;  /* Certificate being constructed */
+	PurpleCertificate *crt;  /* Certificate being constructed */
 	gchar *buf;        /* Used to load the raw file data */
 	gsize buf_sz;      /* Size of the above */
 	gnutls_datum_t dt; /* Struct to pass down to GnuTLS */
@@ -433,7 +426,7 @@
  *
  */
 static void
-x509_destroy_certificate(Certificate * crt)
+x509_destroy_certificate(PurpleCertificate * crt)
 {
 	/* TODO: Issue a warning here? */
 	if (NULL == crt) return;
@@ -461,6 +454,15 @@
 	g_free(crt);
 }
 
+/* X.509 certificate operations provided by this plugin */
+/* TODO: Flesh this out! */
+static PurpleCertificateScheme x509_gnutls = {
+	"x509",                          /* Scheme name */
+	N_("X.509 Certificates"),        /* User-visible scheme name */
+	x509_import_from_file,           /* Certificate import function */
+	x509_destroy_certificate         /* Destroy cert */
+};
+
 static PurpleSslOps ssl_ops =
 {
 	ssl_gnutls_init,