* @file core.c Gaim Core API * Gaim is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "conversation.h" #include "savedstatuses.h" # include "dbus-server.h" static GaimCoreUiOps *_ops = NULL; static GaimCore *_core = NULL; gaim_core_init(const char *ui) g_return_val_if_fail(ui != NULL, FALSE); g_return_val_if_fail(gaim_get_core() == NULL, FALSE); _core = core = g_new0(GaimCore, 1); ops = gaim_core_get_ui_ops(); /* The signals subsystem is important and should be first. */ gaim_signal_register(core, "quitting", gaim_marshal_VOID, NULL, 0); /* The prefs subsystem needs to be initialized before static protocols * for protocol prefs to work. */ if (ops->ui_prefs_init != NULL) if (ops->debug_ui_init != NULL) /* Initialize all static protocols. */ /* Since plugins get probed so early we should probably initialize their * subsystem right away too. gaim_plugins_probe(G_MODULE_SUFFIX); /* Accounts use status and buddy icons, so initialize these before accounts */ gaim_savedstatuses_init(); gaim_conversations_init(); /* Call this early on to try to auto-detect our IP address */ gaim_network_get_my_ip(-1); if (ops != NULL && ops->ui_init != NULL) GaimCore *core = gaim_get_core(); g_return_if_fail(core != NULL); /* The self destruct sequence has been initiated */ gaim_signal_emit(gaim_get_core(), "quitting"); gaim_connections_disconnect_all(); /* Save .xml files, remove signals, etc. */ gaim_conversations_uninit(); gaim_connections_uninit(); gaim_buddy_icons_uninit(); gaim_savedstatuses_uninit(); gaim_debug_info("main", "Unloading all plugins\n"); gaim_plugins_destroy_all(); ops = gaim_core_get_ui_ops(); if (ops != NULL && ops->quit != NULL) * gaim_sound_uninit() should be called as close to * shutdown as possible. This is because the call * to ao_shutdown() can sometimes leave our * environment variables in an unusable state, which * can cause a crash when getenv is called (by gettext * for example). See the complete bug report at * http://trac.xiph.org/cgi-bin/trac.cgi/ticket/701 * TODO: Eventually move this call higher up with the others. gaim_core_quit_cb(gpointer unused) gaim_core_get_version(void) GaimCore *core = gaim_get_core(); g_return_val_if_fail(core != NULL, NULL); gaim_core_set_ui_ops(GaimCoreUiOps *ops) gaim_core_get_ui_ops(void)