comparison libpurple/protocols/jabber/jabber.c @ 29559: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
comparison
equal deleted inserted replaced
29558:d93676b59db1 29559:93d32ecf3186
3537 GHashTable *ui_info = purple_core_get_ui_info(); 3537 GHashTable *ui_info = purple_core_get_ui_info();
3538 const gchar *ui_type; 3538 const gchar *ui_type;
3539 const gchar *type = "pc"; /* default client type, if unknown or 3539 const gchar *type = "pc"; /* default client type, if unknown or
3540 unspecified */ 3540 unspecified */
3541 const gchar *ui_name = NULL; 3541 const gchar *ui_name = NULL;
3542 #ifdef HAVE_CYRUS_SASL
3543 /* We really really only want to do this once per process */
3544 static gboolean sasl_initialized = FALSE;
3545 #ifdef _WIN32
3546 UINT old_error_mode;
3547 gchar *sasldir;
3548 #endif
3549 int ret;
3550 #endif
3551
3552 /* XXX - If any other plugin wants SASL this won't be good ... */
3553 #ifdef HAVE_CYRUS_SASL
3554 if (!sasl_initialized) {
3555 sasl_initialized = TRUE;
3556 #ifdef _WIN32
3557 sasldir = g_build_filename(wpurple_install_dir(), "sasl2", NULL);
3558 sasl_set_path(SASL_PATH_TYPE_PLUGIN, sasldir);
3559 g_free(sasldir);
3560 /* Suppress error popups for failing to load sasl plugins */
3561 old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS);
3562 #endif
3563 if ((ret = sasl_client_init(NULL)) != SASL_OK) {
3564 purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret);
3565 }
3566 #ifdef _WIN32
3567 /* Restore the original error mode */
3568 SetErrorMode(old_error_mode);
3569 #endif
3570 }
3571 #endif
3542 3572
3543 jabber_cmds = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cmds_free_func); 3573 jabber_cmds = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, cmds_free_func);
3544 3574
3545 ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL; 3575 ui_type = ui_info ? g_hash_table_lookup(ui_info, "client_type") : NULL;
3546 if (ui_type) { 3576 if (ui_type) {