# HG changeset patch
# User eion@robbmob.com
# Date 1288582814 0
# Node ID cea7e713ef0709d1c4ef62fbc53bc79954457081
# Parent  ddf1b577b838d6d9a4e36e6959f09000581fa63a
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>

diff -r ddf1b577b838 -r cea7e713ef07 libpurple/protocols/jabber/auth.c
--- 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)
diff -r ddf1b577b838 -r cea7e713ef07 libpurple/protocols/jabber/auth.h
--- 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);