static void init_libpurple() { printf("init_libpurple\n"); /* Set a custom user directory (optional) */ purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); /* We do not want any debugging for now to keep the noise to a minimum. */ purple_debug_set_enabled(FALSE); /* Set the core-uiops, which is used to * - initialize the ui specific preferences. * - initialize the debug ui. * - initialize the ui components for all the modules. * - uninitialize the ui components for all the modules when the core terminates. */ purple_core_set_ui_ops(&taim_core_uiops); /* Set the uiops for the eventloop. If your client is glib-based, you can safely * copy this verbatim. */ purple_eventloop_set_ui_ops(&glib_eventloops); /* Set path to search for plugins. The core (libpurple) takes care of loading the * core-plugins, which includes the protocol-plugins. So it is not essential to add * any path here, but it might be desired, especially for ui-specific plugins. */ purple_plugins_add_search_path(CUSTOM_PLUGIN_PATH); /* Now that all the essential stuff has been set, let's try to init the core. It's * necessary to provide a non-NULL name for the current ui to the core. This name * is used by stuff that depends on this ui, for example the ui-specific plugins. */ if (!purple_core_init(UI_ID)) { /* Initializing the core failed. Terminate. */ fprintf(stderr, "libpurple initialization failed. Dumping core.\n" "Please report this!\n"); abort(); } purple_blist_set_ui_ops(&taim_blist_uiops); /* Create and load the buddylist. */ purple_blist_init(); g_blist = purple_blist_new(); purple_set_blist(g_blist); purple_blist_load(); /* Load the preferences. */ purple_prefs_load(); /* Load the desired plugins. The client should save the list of loaded plugins in * the preferences using purple_plugins_save_loaded(PLUGIN_SAVE_PREF) */ purple_plugins_load_saved(PLUGIN_SAVE_PREF); /* Load the pounces. */ purple_pounces_load(); }
STATIC_PROTO_INIT gboolean purple_core_init(const char *ui) { PurpleCoreUiOps *ops; PurpleCore *core; g_return_val_if_fail(ui != NULL, FALSE); g_return_val_if_fail(purple_get_core() == NULL, FALSE); #ifdef ENABLE_NLS bindtextdomain(PACKAGE, LOCALEDIR); #endif //VOXOX - JRT - 2009.04.11 #ifdef _WIN32 wpurple_init(); #ifdef _DEBUG // _CrtSetDbgFlag( 0x20 ); //_CRTDBG_LEAK_CHECK_DF );//VOXOX - JRT - 2009.04.10 JRT-XXX // _CrtSetAllocHook( AllocHook ); #endif #endif g_type_init(); _core = core = g_new0(PurpleCore, 1); core->ui = g_strdup(ui); core->reserved = NULL; ops = purple_core_get_ui_ops(); /* The signals subsystem is important and should be first. */ purple_signals_init(); purple_util_init(); purple_signal_register(core, "uri-handler", purple_marshal_BOOLEAN__POINTER_POINTER_POINTER, purple_value_new(PURPLE_TYPE_BOOLEAN), 3, purple_value_new(PURPLE_TYPE_STRING), /* Protocol */ purple_value_new(PURPLE_TYPE_STRING), /* Command */ purple_value_new(PURPLE_TYPE_BOXED, "GHashTable *")); /* Parameters */ purple_signal_register(core, "quitting", purple_marshal_VOID, NULL, 0); /* The prefs subsystem needs to be initialized before static protocols * for protocol prefs to work. */ purple_prefs_init(); purple_debug_init(); if (ops != NULL) { if (ops->ui_prefs_init != NULL) ops->ui_prefs_init(); if (ops->debug_ui_init != NULL) ops->debug_ui_init(); } #ifdef HAVE_DBUS purple_dbus_init(); #endif purple_ciphers_init(); purple_cmds_init(); /* Since plugins get probed so early we should probably initialize their * subsystem right away too. */ purple_plugins_init(); /* Initialize all static protocols. */ static_proto_init(); purple_plugins_probe(G_MODULE_SUFFIX); /* The buddy icon code uses the imgstore, so init it early. */ purple_imgstore_init(); /* Accounts use status, buddy icons and connection signals, so * initialize these before accounts */ purple_status_init(); purple_buddy_icons_init(); purple_connections_init(); purple_accounts_init(); purple_savedstatuses_init(); purple_notify_init(); purple_certificate_init(); purple_conversations_init(); purple_blist_init(); purple_log_init(); purple_network_init(); purple_privacy_init(); purple_pounces_init(); purple_proxy_init(); purple_dnsquery_init(); purple_sound_init(); purple_ssl_init(); purple_stun_init(); purple_xfers_init(); purple_idle_init(); purple_smileys_init(); /* * Call this early on to try to auto-detect our IP address and * hopefully save some time later. */ purple_network_get_my_ip(-1); if (ops != NULL && ops->ui_init != NULL) ops->ui_init(); return TRUE; }