comparison libpurple/protocols/jabber/auth.c @ 30892: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 4072761e3454
children a5b556ac1de5
comparison
equal deleted inserted replaced
30654:ddf1b577b838 30892:cea7e713ef07
500 return 1; 500 return 1;
501 /* This really shouldn't happen */ 501 /* This really shouldn't happen */
502 return 0; 502 return 0;
503 } 503 }
504 504
505 void jabber_auth_add_mech(JabberSaslMech *mech)
506 {
507 auth_mechs = g_slist_insert_sorted(auth_mechs, mech, compare_mech);
508 }
509
510 void jabber_auth_remove_mech(JabberSaslMech *mech)
511 {
512 auth_mechs = g_slist_remove(auth_mechs, mech);
513 }
514
505 void jabber_auth_init(void) 515 void jabber_auth_init(void)
506 { 516 {
507 JabberSaslMech **tmp; 517 JabberSaslMech **tmp;
508 gint count, i; 518 gint count, i;
509 519
510 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_plain_mech(), compare_mech); 520 jabber_auth_add_mech(jabber_auth_get_plain_mech());
511 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_digest_md5_mech(), compare_mech); 521 jabber_auth_add_mech(jabber_auth_get_digest_md5_mech());
512 #ifdef HAVE_CYRUS_SASL 522 #ifdef HAVE_CYRUS_SASL
513 auth_mechs = g_slist_insert_sorted(auth_mechs, jabber_auth_get_cyrus_mech(), compare_mech); 523 jabber_auth_add_mech(jabber_auth_get_cyrus_mech());
514 #endif 524 #endif
515 525
516 tmp = jabber_auth_get_scram_mechs(&count); 526 tmp = jabber_auth_get_scram_mechs(&count);
517 for (i = 0; i < count; ++i) 527 for (i = 0; i < count; ++i)
518 auth_mechs = g_slist_insert_sorted(auth_mechs, tmp[i], compare_mech); 528 jabber_auth_add_mech(tmp[i]);
519 } 529 }
520 530
521 void jabber_auth_uninit(void) 531 void jabber_auth_uninit(void)
522 { 532 {
523 g_slist_free(auth_mechs); 533 g_slist_free(auth_mechs);