soc.2009.telepathy.playground: 19085a45: Added debug prints on unload and destroy...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Thu Apr 23 08:21:40 EDT 2009


-----------------------------------------------------------------
Revision: 19085a458952486ec14271385527170206a8a30e
Ancestor: dc4856c9408bcd0893c111ed5024388ea989116b
Author: sttwister at soc.pidgin.im
Date: 2009-04-23T12:18:05
Branch: im.pidgin.soc.2009.telepathy.playground
URL: http://d.pidgin.im/viewmtn/revision/info/19085a458952486ec14271385527170206a8a30e

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Added debug prints on unload and destroy.
Fixed crash on unload.

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	c946281d338ea26ef6276720b66bb0598b648342
+++ libpurple/protocols/telepathy/telepathy.c	e120408150991becadcd7038a4bb9a5ddb48936d
@@ -57,14 +57,6 @@ telepathy_actions(PurplePlugin *plugin, 
 }
 
 
-static gboolean
-telepathy_plugin_load(PurplePlugin *plugin)
-{
-	purple_debug_info("telepathy", "Loading prpl...\n");
-
-	return TRUE;
-}
-
 static const char *
 telepathy_list_icon(PurpleAccount *acct, PurpleBuddy *buddy)
 {
@@ -125,9 +117,26 @@ telepathy_close(PurpleConnection *gc)
 	purple_debug_info("telepathy", "We're closing, sorry :(\n");
 }
 
+static gboolean
+telepathy_plugin_load(PurplePlugin *plugin)
+{
+	purple_debug_info("telepathy", "Loading prpl...\n");
+
+	return TRUE;
+}
+
+static gboolean
+telepathy_plugin_unload(PurplePlugin *plugin)
+{
+	purple_debug_info("telepathy", "Unloading %s\n", plugin->info->name);
+
+	return TRUE;
+}
+
 static void
-telepathy_destroy(PurplePlugin *plugin) {
-	purple_debug_info("telepathy", "Shutting down\n");
+telepathy_plugin_destroy(PurplePlugin *plugin)
+{
+	purple_debug_info("telepathy", "Shutting down %s\n", plugin->info->name);
 }
 
 static PurplePluginProtocolInfo telepathy_prpl_info2 =
@@ -232,8 +241,8 @@ static PurplePluginInfo telepathy_info2 
 	"http://google.com",     
 
 	telepathy_plugin_load,                   
-	NULL,                          
-	telepathy_destroy,                          
+	telepathy_plugin_unload,                          
+	telepathy_plugin_destroy,                          
 
 	NULL,                          
 	&telepathy_prpl_info2,                          
@@ -348,8 +357,8 @@ static PurplePluginInfo telepathy_info =
 	"http://google.com",     
 
 	telepathy_plugin_load,                   
-	NULL,                          
-	telepathy_destroy,                          
+	telepathy_plugin_unload,                          
+	telepathy_plugin_destroy,                          
 
 	NULL,                          
 	&telepathy_prpl_info,                          
@@ -378,7 +387,6 @@ PURPLE_INIT_PLUGIN(telepathy, telepathy_
 PURPLE_INIT_PLUGIN(telepathy, telepathy_init, telepathy_info)
 */
 
-/* TODO: Fix the purple_plugin_unload crash. */
 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin); 
 G_MODULE_EXPORT gboolean purple_init_plugin(PurplePlugin *plugin)
 { 
@@ -395,6 +403,11 @@ G_MODULE_EXPORT gboolean purple_init_plu
 	purple_debug_info("telepathy", "Registering second plugin\n");
 	plugin2 = purple_plugin_new(TRUE, NULL);
 	plugin2->info = &(telepathy_info2);
+
+	/* we need to tell libpurple that this plugin also resides in this module */
+	g_module_open(plugin->path, G_MODULE_BIND_LOCAL);
+	plugin2->handle = plugin->handle;
+
 	telepathy_init((plugin2));
 	purple_plugin_load((plugin2));
 	return purple_plugin_register(plugin2);


More information about the Commits mailing list