Mercurial > pidgin.yaz
view libpurple/core.c @ 16307:9326d4cf5497
If anyone sees the "Unable to add buddy 1" message after
this commit, please let me know.
More changes in an effort to get rid of the "Unable to Add,
Could not add the buddy 1 for an unknown reason. The
most common reason for this is that you have the
maximum number of allowed buddies in your buddy list" message.
My previous checkin fixed a problem that resulted in the same
error, but the cause was completely different. The important
change in this commit is the one in aim_ssi_itemlist_add().
Apparently there's this funky thing where items in the master
group can't have a buddy ID equal to any group ID. Who knew?
There are a few other minor changes in this commit. I added
a "break" when looping through the items making sure we don't
pick a buddy ID that's already in use. And added some checks
to make sure we never try to update our data if we haven't
received the list from the server yet. Oh, and the 2 bytes
that specify the length of the checksum for the icon are
two separate values. The first byte is either a 0 or a 1 and
I don't know what it means. The second byte is the length of
the checksum.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 23 Apr 2007 01:05:27 +0000 |
parents | fa8aeab4ca5a |
children | 786edf5e2144 |
line wrap: on
line source
/** * @file core.c Purple Core API * @ingroup core * * purple * * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * 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 "internal.h" #include "cipher.h" #include "connection.h" #include "conversation.h" #include "core.h" #include "debug.h" #include "dnsquery.h" #include "ft.h" #include "idle.h" #include "network.h" #include "notify.h" #include "plugin.h" #include "pounce.h" #include "prefs.h" #include "privacy.h" #include "proxy.h" #include "savedstatuses.h" #include "signals.h" #include "sound.h" #include "sslconn.h" #include "status.h" #include "stun.h" #ifdef HAVE_DBUS # include "dbus-server.h" #endif struct PurpleCore { char *ui; void *reserved; }; static PurpleCoreUiOps *_ops = NULL; static PurpleCore *_core = NULL; 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 #ifdef _WIN32 wpurple_init(); #endif _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_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 /* Initialize all static protocols. */ static_proto_init(); /* Since plugins get probed so early we should probably initialize their * subsystem right away too. */ purple_plugins_init(); purple_plugins_probe(G_MODULE_SUFFIX); /* Accounts use status and buddy icons, so initialize these before accounts */ purple_status_init(); purple_buddy_icons_init(); purple_accounts_init(); purple_savedstatuses_init(); purple_ciphers_init(); purple_notify_init(); purple_connections_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(); /* * 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; } void purple_core_quit(void) { PurpleCoreUiOps *ops; PurpleCore *core = purple_get_core(); g_return_if_fail(core != NULL); /* The self destruct sequence has been initiated */ purple_signal_emit(purple_get_core(), "quitting"); /* Transmission ends */ purple_connections_disconnect_all(); /* Save .xml files, remove signals, etc. */ purple_idle_uninit(); purple_ssl_uninit(); purple_pounces_uninit(); purple_blist_uninit(); purple_ciphers_uninit(); purple_notify_uninit(); purple_conversations_uninit(); purple_connections_uninit(); purple_buddy_icons_uninit(); purple_accounts_uninit(); purple_savedstatuses_uninit(); purple_status_uninit(); purple_prefs_uninit(); purple_xfers_uninit(); purple_proxy_uninit(); purple_dnsquery_uninit(); purple_debug_info("main", "Unloading all plugins\n"); purple_plugins_destroy_all(); ops = purple_core_get_ui_ops(); if (ops != NULL && ops->quit != NULL) ops->quit(); /* * purple_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. */ purple_sound_uninit(); purple_plugins_uninit(); purple_signals_uninit(); #ifdef HAVE_DBUS purple_dbus_uninit(); #endif g_free(core->ui); g_free(core); #ifdef _WIN32 wpurple_cleanup(); #endif _core = NULL; } gboolean purple_core_quit_cb(gpointer unused) { purple_core_quit(); return FALSE; } const char * purple_core_get_version(void) { return VERSION; } const char * purple_core_get_ui(void) { PurpleCore *core = purple_get_core(); g_return_val_if_fail(core != NULL, NULL); return core->ui; } PurpleCore * purple_get_core(void) { return _core; } void purple_core_set_ui_ops(PurpleCoreUiOps *ops) { _ops = ops; } PurpleCoreUiOps * purple_core_get_ui_ops(void) { return _ops; }