Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jabber.c @ 29959:93d32ecf3186
jabber: Only initialize SASL once, too.
A lot of these have moved from plugin init to plugin load time. There's not
much that happens between then, but this could in theory cause issues.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Tue, 09 Mar 2010 20:53:11 +0000 |
parents | d93676b59db1 |
children | 13f320cde14f |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Tue Mar 09 19:09:37 2010 +0000 +++ b/libpurple/protocols/jabber/jabber.c Tue Mar 09 20:53:11 2010 +0000 @@ -3539,6 +3539,36 @@ const gchar *type = "pc"; /* default client type, if unknown or unspecified */ const gchar *ui_name = NULL; +#ifdef HAVE_CYRUS_SASL + /* We really really only want to do this once per process */ + static gboolean sasl_initialized = FALSE; +#ifdef _WIN32 + UINT old_error_mode; + gchar *sasldir; +#endif + int ret; +#endif + + /* XXX - If any other plugin wants SASL this won't be good ... */ +#ifdef HAVE_CYRUS_SASL + if (!sasl_initialized) { + sasl_initialized = TRUE; +#ifdef _WIN32 + sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL); + sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir); + g_free(sasldir); + /* Suppress error popups for failing to load sasl plugins */ + old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); +#endif + if ((ret = sasl_client_init(NULL)) != SASL_OK) { + purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret); + } +#ifdef _WIN32 + /* Restore the original error mode */ + SetErrorMode(old_error_mode); +#endif + } +#endif jabber_cmds = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cmds_free_func);