changeset 31330:cea7e713ef07

jabber: Add abstraction functions for adding/removing auth mechs. Closes #12715 Slight modification from me to g_slist_remove. If it breaks, blame him. committer: Paul Aurich <paul@darkrain42.org>
author eion@robbmob.com
date Mon, 01 Nov 2010 03:40:14 +0000
parents ddf1b577b838
children 5750f2f2cc0d
files libpurple/protocols/jabber/auth.c libpurple/protocols/jabber/auth.h
diffstat 2 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/auth.c	Mon Nov 01 02:59:27 2010 +0000
+++ b/libpurple/protocols/jabber/auth.c	Mon Nov 01 03:40:14 2010 +0000
@@ -502,20 +502,30 @@
 	return 0;
 }
 
+void jabber_auth_add_mech(JabberSaslMech *mech)
+{
+	auth_mechs = g_slist_insert_sorted(auth_mechs, mech, compare_mech);
+}
+
+void jabber_auth_remove_mech(JabberSaslMech *mech)
+{
+	auth_mechs = g_slist_remove(auth_mechs, mech);
+}
+
 void jabber_auth_init(void)
 {
 	JabberSaslMech **tmp;
 	gint count, i;
 
-	auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_plain_mech(), compare_mech);
-	auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_digest_md5_mech(), compare_mech);
+	jabber_auth_add_mech(jabber_auth_get_plain_mech());
+	jabber_auth_add_mech(jabber_auth_get_digest_md5_mech());
 #ifdef HAVE_CYRUS_SASL
-	auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_cyrus_mech(), compare_mech);
+	jabber_auth_add_mech(jabber_auth_get_cyrus_mech());
 #endif
 
 	tmp = jabber_auth_get_scram_mechs(&count);
 	for (i = 0; i < count; ++i)
-		auth_mechs = g_slist_insert_sorted(auth_mechs, tmp[i], compare_mech);
+		jabber_auth_add_mech(tmp[i]);
 }
 
 void jabber_auth_uninit(void)
--- a/libpurple/protocols/jabber/auth.h	Mon Nov 01 02:59:27 2010 +0000
+++ b/libpurple/protocols/jabber/auth.h	Mon Nov 01 03:40:14 2010 +0000
@@ -58,6 +58,9 @@
 JabberSaslMech *jabber_auth_get_cyrus_mech(void);
 #endif
 
+void jabber_auth_add_mech(JabberSaslMech *);
+void jabber_auth_remove_mech(JabberSaslMech *);
+
 void jabber_auth_init(void);
 void jabber_auth_uninit(void);