Mercurial > pidgin
changeset 18984:2b4150624cf2
- Add purple_certificate_pool_mkpath helper function
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Thu, 05 Jul 2007 05:35:23 +0000 |
parents | bb4acabd8fac |
children | 806c610ac5a0 |
files | libpurple/certificate.c libpurple/certificate.h |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/certificate.c Thu Jul 05 04:59:36 2007 +0000 +++ b/libpurple/certificate.c Thu Jul 05 05:35:23 2007 +0000 @@ -176,6 +176,24 @@ return subject_name; } +gchar * +purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) +{ + gchar *path; + + g_return_val_if_fail(pool, NULL); + g_return_val_if_fail(pool->scheme_name, NULL); + g_return_val_if_fail(pool->name, NULL); + + path = g_build_filename(purple_user_dir(), + pool->scheme_name, + pool->name, + id, + NULL); + return path; +} + + /****************************************************************************/ /* Builtin Verifiers, Pools, etc. */ /****************************************************************************/
--- a/libpurple/certificate.h Thu Jul 05 04:59:36 2007 +0000 +++ b/libpurple/certificate.h Thu Jul 05 05:35:23 2007 +0000 @@ -402,6 +402,19 @@ gchar * purple_certificate_get_subject_name(PurpleCertificate *crt); +/** + * Helper function for generating file paths in ~/.purple/certificates for + * CertificatePools that use them. + * + * @todo Passing in filesystem-unfriendly characters will cause breakage! + * @param pool CertificatePool to build a path for + * @param id Key to look up a Certificate by. May be NULL. + * @return A newly allocated path of the form + * ~/.purple/certificates/scheme_name/pool_name/unique_id + */ +gchar * +purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id); + /*@}*/ /*****************************************************************************/