diff libpurple/plugins/mono/loader/mono.c @ 15876:80ee585fb53c

SF Patch #1686400 from Eoin Coffey ("ecoffey") ecoffey described the changes: 1) Small tweaks to the loader to bring it up to speed with new mono versions and API wrapper changes that grim had made. (was in original patch, just forgot about it :-P) 2) .NET Plugins are now required to define an Id as part of their info. 3) Modified gaim_probe_plugin to check for existence of info->id and to make sure it's not empty; Prints an error, stores an error in the plugin and sets plugin->unloadable = TRUE.
author Richard Laager <rlaager@wiktel.com>
date Sat, 24 Mar 2007 06:24:59 +0000
parents 32c366eeeb99
children 98b4e313b9ba
line wrap: on
line diff
--- a/libpurple/plugins/mono/loader/mono.c	Fri Mar 23 01:47:09 2007 +0000
+++ b/libpurple/plugins/mono/loader/mono.c	Sat Mar 24 06:24:59 2007 +0000
@@ -26,9 +26,8 @@
 {
 	MonoAssembly *assm;
 	MonoMethod *m = NULL;
-	MonoMethod *info_method = NULL;
 	MonoObject *plugin_info;
-	gboolean found_load = FALSE, found_unload = FALSE, found_destroy = FALSE, found_info = FALSE;
+	gboolean found_load = FALSE, found_unload = FALSE, found_destroy = FALSE;
 	gpointer iter = NULL;
 
 	PurplePluginInfo *info;
@@ -71,6 +70,7 @@
 	mono_runtime_object_init(mplug->obj);
 
 	while ((m = mono_class_get_methods(mplug->klass, &iter))) {
+		purple_debug_info("mono", "plugin method: %s\n", mono_method_get_name(m));
 		if (strcmp(mono_method_get_name(m), "Load") == 0) {
 			mplug->load = m;
 			found_load = TRUE;
@@ -80,22 +80,20 @@
 		} else if (strcmp(mono_method_get_name(m), "Destroy") == 0) {
 			mplug->destroy = m;
 			found_destroy = TRUE;
-		} else if (strcmp(mono_method_get_name(m), "Info") == 0) {
-			info_method = m;
-			found_info = TRUE;
 		}
 	}
 
-	if (!(found_load && found_unload && found_destroy && found_info)) {
+	if (!(found_load && found_unload && found_destroy)) {
 		purple_debug(PURPLE_DEBUG_ERROR, "mono", "did not find the required methods\n");
 		return FALSE;
 	}
-
-	plugin_info = ml_invoke(info_method, mplug->obj, NULL);
+	
+	plugin_info = ml_get_info_prop(mplug->obj);
 
 	/* now that the methods are filled out we can populate
 	   the info struct with all the needed info */
 
+	info->id = ml_get_prop_string(plugin_info, "Id");
 	info->name = ml_get_prop_string(plugin_info, "Name");
 	info->version = ml_get_prop_string(plugin_info, "Version");
 	info->summary = ml_get_prop_string(plugin_info, "Summary");