cpw.darkrain42.xmpp.bosh: ac187cbd: Add more jabber plugin unloading functio...
paul at darkrain42.org
paul at darkrain42.org
Sat Jan 17 23:56:43 EST 2009
-----------------------------------------------------------------
Revision: ac187cbd274e328fdc1b2f362f58333a0467f54f
Ancestor: 991dad5d6581ce0fa49d9d000c4c892046d85cbc
Author: paul at darkrain42.org
Date: 2008-11-22T19:44:05
Branch: im.pidgin.cpw.darkrain42.xmpp.bosh
URL: http://d.pidgin.im/viewmtn/revision/info/ac187cbd274e328fdc1b2f362f58333a0467f54f
Modified 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
ChangeLog:
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.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/data.c 479b5c3440f041763c657afda16047f8880745eb
+++ libpurple/protocols/jabber/data.c 77943bd13a7be730c06fe1b0cd1172110a7ecd4b
@@ -244,4 +244,5 @@ jabber_data_uninit(void)
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;
}
============================================================
--- libpurple/protocols/jabber/jabber.c ede4dc9628128500c73535a543bab135c99b48c3
+++ libpurple/protocols/jabber/jabber.c 98a99e88f3c1a150875db8a37d609516db37c066
@@ -1518,6 +1518,16 @@ void jabber_remove_feature(const char *n
}
}
+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 @@ void jabber_add_identity(const gchar *ca
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 @@ jabber_init_plugin(PurplePlugin *plugin)
NULL, 1,
purple_value_new(PURPLE_TYPE_STRING));
}
+
+void
+jabber_uninit_plugin(void)
+{
+ jabber_features_destroy();
+ jabber_identities_destroy();
+}
============================================================
--- libpurple/protocols/jabber/jabber.h bdc4f5b6f89238381f7fdbda291655d576e50411
+++ libpurple/protocols/jabber/jabber.h a831125e668fe3decf5f996e3c24427f80b6e039
@@ -310,7 +310,7 @@ void jabber_remove_feature(const gchar *
* @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 @@ void jabber_register_commands(void);
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_ */
============================================================
--- libpurple/protocols/jabber/libxmpp.c 8d8f47112f6c4ca93dd53e589d4044df2f95a0fa
+++ libpurple/protocols/jabber/libxmpp.c 0bc2d75eca12de8f6e29a5940595e287c50063a6
@@ -148,9 +148,17 @@ static gboolean unload_plugin(PurplePlug
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 @@ init_plugin(PurplePlugin *plugin)
#endif
#endif
jabber_register_commands();
-
+
+ /* reverse order of unload_plugin */
jabber_iq_init();
- jabber_pep_init();
jabber_caps_init();
- jabber_tune_init();
+ /* PEP things should be init via jabber_pep_init, not here */
+ jabber_pep_init();
jabber_data_init();
#warning implement adding and retrieving own features via IPC API
============================================================
--- libpurple/protocols/jabber/pep.c 253a88c5dd79f299f7ec2b69e8e6d4ffd80524e9
+++ libpurple/protocols/jabber/pep.c acc2d9d8b27fe5d15822d9545e1c4790aac8e0f1
@@ -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 @@ void jabber_pep_init(void) {
/* 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);
============================================================
--- libpurple/protocols/jabber/pep.h ecf69f04d962b16b0ef8be0f3bdf11e65c087f21
+++ libpurple/protocols/jabber/pep.h 321136d26b3a3a504394c4a7402e4b84c76fbddc
@@ -27,6 +27,7 @@ void jabber_pep_init(void);
#include "buddy.h"
void jabber_pep_init(void);
+void jabber_pep_uninit(void);
void jabber_pep_init_actions(GList **m);
More information about the Commits
mailing list