changeset 19020:d69355001a6e

- Add purple_certificate_copy_list
author William Ehlhardt <williamehlhardt@gmail.com>
date Fri, 13 Jul 2007 09:02:45 +0000
parents e179e7e6ded7
children fcca10d0ac7d
files libpurple/certificate.c libpurple/certificate.h
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Fri Jul 13 08:42:59 2007 +0000
+++ b/libpurple/certificate.c	Fri Jul 13 09:02:45 2007 +0000
@@ -108,6 +108,22 @@
 	return (crt->scheme->copy_certificate)(crt);
 }
 
+GList *
+purple_certificate_copy_list(GList *crt_list)
+{
+	GList *new, *l;
+
+	/* First, make a shallow copy of the list */
+	new = g_list_copy(crt_list);
+
+	/* Now go through and actually duplicate each certificate */
+	for (l = new; l; l = l->next) {
+		l->data = purple_certificate_copy(l->data);
+	}
+
+	return new;
+}
+
 void
 purple_certificate_destroy (PurpleCertificate *crt)
 {
--- a/libpurple/certificate.h	Fri Jul 13 08:42:59 2007 +0000
+++ b/libpurple/certificate.h	Fri Jul 13 09:02:45 2007 +0000
@@ -379,6 +379,15 @@
 purple_certificate_copy(PurpleCertificate *crt);
 
 /**
+ * Duplicates an entire list of certificates
+ *
+ * @param crt_list   List to duplicate
+ * @return New list copy
+ */
+GList *
+purple_certificate_copy_list(GList *crt_list);
+
+/**
  * Destroys and free()'s a Certificate
  *
  * @param crt        Instance to destroy. May be NULL.