# HG changeset patch # User William Ehlhardt # Date 1184631011 0 # Node ID 15d9031e03b29b1d44267ec936207c4614d9c4c9 # Parent b3acaf46d9ad5d75949a4c5b5da01b0bd6b0f2ce - Add get_idlist support to tls_peers CertificatePool diff -r b3acaf46d9ad -r 15d9031e03b2 libpurple/certificate.c --- a/libpurple/certificate.c Mon Jul 16 23:59:14 2007 +0000 +++ b/libpurple/certificate.c Tue Jul 17 00:10:11 2007 +0000 @@ -520,6 +520,36 @@ return ret; } +static GList * +x509_tls_peers_get_idlist(void) +{ + GList *idlist = NULL; + GDir *dir; + const gchar *entry; + gchar *poolpath; + + /* Get a handle on the pool directory */ + poolpath = purple_certificate_pool_mkpath(&x509_tls_peers, NULL); + dir = g_dir_open(poolpath, + 0, /* No flags */ + NULL); /* Not interested in what the error is */ + g_free(poolpath); + + g_return_val_if_fail(dir, NULL); + + /* Traverse the directory listing and create an idlist */ + while ( (entry = g_dir_read_name(dir)) != NULL ) { + /* Copy the entry name into our list (GLib owns the original + string) */ + idlist = g_list_prepend(idlist, g_strdup(entry)); + } + + /* Release the directory */ + g_dir_close(dir); + + return idlist; +} + static PurpleCertificatePool x509_tls_peers = { "x509", /* Scheme name */ "tls_peers", /* Pool name */ @@ -530,7 +560,7 @@ x509_tls_peers_cert_in_pool, /* Certificate exists? */ x509_tls_peers_get_cert, /* Cert retriever */ x509_tls_peers_put_cert, /* Cert writer */ - NULL /* idlist retriever */ + x509_tls_peers_get_idlist /* idlist retriever */ };