# HG changeset patch # User William Ehlhardt # Date 1184202604 0 # Node ID b1090cbfc2867211d3be1665dca7e317f1fc46d3 # Parent b4207894b534a6984650a31c5cb7061cf5ff5dd0 - Add expiration/activation functions for Certificates diff -r b4207894b534 -r b1090cbfc286 libpurple/certificate.c --- a/libpurple/certificate.c Thu Jul 12 00:55:35 2007 +0000 +++ b/libpurple/certificate.c Thu Jul 12 01:10:04 2007 +0000 @@ -203,6 +203,34 @@ return (scheme->check_subject_name)(crt, name); } +gboolean +purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration) +{ + PurpleCertificateScheme *scheme; + + g_return_val_if_fail(crt, FALSE); + + scheme = crt->scheme; + + g_return_val_if_fail(scheme, FALSE); + + /* If both provided references are NULL, what are you doing calling + this? */ + g_return_val_if_fail( (activation != NULL) || (expiration != NULL), FALSE); + + /* Fulfill the caller's requests, if possible */ + if (activation) { + g_return_val_if_fail(scheme->get_activation, FALSE); + *activation = scheme->get_activation(crt); + } + if (expiration) { + g_return_val_if_fail(scheme->get_expiration, FALSE); + *expiration = scheme->get_expiration(crt); + } + + return TRUE; +} + gchar * purple_certificate_pool_mkpath(PurpleCertificatePool *pool, const gchar *id) diff -r b4207894b534 -r b1090cbfc286 libpurple/certificate.h --- a/libpurple/certificate.h Thu Jul 12 00:55:35 2007 +0000 +++ b/libpurple/certificate.h Thu Jul 12 01:10:04 2007 +0000 @@ -429,6 +429,18 @@ gboolean purple_certificate_check_subject_name(PurpleCertificate *crt, const gchar *name); +/** + * Get the expiration/activation times. + * + * @param crt Certificate instance + * @param activation Reference to store the activation time at. May be NULL + * if you don't actually want it. + * @param expiration Reference to store the expiration time at. May be NULL + * if you don't actually want it. + * @return TRUE if the requested values were obtained, otherwise FALSE. + */ +gboolean +purple_certificate_get_times(PurpleCertificate *crt, time_t *activation, time_t *expiration); /*@}*/