Mercurial > pidgin
changeset 25167:860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
In reality, probably not terribly useful since the entire program is about to quit.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 22 Nov 2008 19:44:05 +0000 |
parents | 18fdbe507fdd |
children | 805aadbb1a85 |
files | libpurple/protocols/jabber/data.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/libxmpp.c libpurple/protocols/jabber/pep.c libpurple/protocols/jabber/pep.h |
diffstat | 6 files changed, 57 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/data.c Sat Nov 22 18:53:48 2008 +0000 +++ b/libpurple/protocols/jabber/data.c Sat Nov 22 19:44:05 2008 +0000 @@ -244,4 +244,5 @@ g_hash_table_destroy(local_data_by_alt); g_hash_table_destroy(local_data_by_cid); g_hash_table_destroy(remote_data_by_cid); + local_data_by_alt = local_data_by_cid = remote_data_by_cid = NULL; }
--- a/libpurple/protocols/jabber/jabber.c Sat Nov 22 18:53:48 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Nov 22 19:44:05 2008 +0000 @@ -1518,6 +1518,16 @@ } } +static void jabber_features_destroy(void) +{ + while (jabber_features) { + JabberFeature *feature = jabber_features->data; + g_free(feature->namespace); + g_free(feature); + jabber_features = g_list_remove_link(jabber_features, jabber_features); + } +} + void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name) { GList *identity; JabberIdentity *ident; @@ -1542,6 +1552,19 @@ jabber_identities = g_list_append(jabber_identities, ident); } +static void jabber_identities_destroy(void) +{ + while (jabber_identities) { + JabberIdentity *id = jabber_identities->data; + g_free(id->category); + g_free(id->type); + g_free(id->lang); + g_free(id->name); + g_free(id); + jabber_identities = g_list_remove_link(jabber_identities, jabber_identities); + } +} + const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b) { return "jabber"; @@ -2635,3 +2658,10 @@ NULL, 1, purple_value_new(PURPLE_TYPE_STRING)); } + +void +jabber_uninit_plugin(void) +{ + jabber_features_destroy(); + jabber_identities_destroy(); +}
--- a/libpurple/protocols/jabber/jabber.h Sat Nov 22 18:53:48 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sat Nov 22 19:44:05 2008 +0000 @@ -310,7 +310,7 @@ * @param language the language localization of the name. Can be NULL. * @param name the name of the identity. */ -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name); +void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name); /** PRPL functions */ const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); @@ -333,6 +333,8 @@ int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); GList *jabber_actions(PurplePlugin *plugin, gpointer context); void jabber_register_commands(void); + void jabber_init_plugin(PurplePlugin *plugin); +void jabber_uninit_plugin(void); #endif /* _PURPLE_JABBER_H_ */
--- a/libpurple/protocols/jabber/libxmpp.c Sat Nov 22 18:53:48 2008 +0000 +++ b/libpurple/protocols/jabber/libxmpp.c Sat Nov 22 19:44:05 2008 +0000 @@ -148,9 +148,17 @@ purple_signal_unregister(plugin, "jabber-sending-xmlnode"); purple_signal_unregister(plugin, "jabber-sending-text"); - + + /* reverse order of init_plugin */ jabber_data_uninit(); - + /* PEP things should be uninit via jabber_pep_uninit, not here */ + jabber_pep_uninit(); + jabber_caps_uninit(); + jabber_iq_uninit(); + + /* Stay on target...stay on target... Almost there... */ + jabber_uninit_plugin(); + return TRUE; } @@ -272,11 +280,12 @@ #endif #endif jabber_register_commands(); - + + /* reverse order of unload_plugin */ jabber_iq_init(); + jabber_caps_init(); + /* PEP things should be init via jabber_pep_init, not here */ jabber_pep_init(); - jabber_caps_init(); - jabber_tune_init(); jabber_data_init(); #warning implement adding and retrieving own features via IPC API
--- a/libpurple/protocols/jabber/pep.c Sat Nov 22 18:53:48 2008 +0000 +++ b/libpurple/protocols/jabber/pep.c Sat Nov 22 19:44:05 2008 +0000 @@ -26,6 +26,7 @@ #include <string.h> #include "usermood.h" #include "usernick.h" +#include "usertune.h" static GHashTable *pep_handlers = NULL; @@ -35,10 +36,17 @@ /* register PEP handlers */ jabber_mood_init(); + jabber_tune_init(); jabber_nick_init(); } } +void jabber_pep_uninit(void) { + /* any PEP handlers that need to clean things up go here */ + g_hash_table_destroy(pep_handlers); + pep_handlers = NULL; +} + void jabber_pep_init_actions(GList **m) { /* register the PEP-specific actions */ jabber_mood_init_action(m);