changeset 11980:67fbd2ff4c4e

[gaim-migrate @ 14273] Mono cleanup patch from Eoin Coffey First, I changed mono_loader_ to ml_, since I was getting sick of typing mono_loader_ :-D Moved the mono runtime init and deinit code out of mono.c into ml_init and ml_uninit in mono-helper.c Added api/Status.cs and loader/status-glue.c so the .net api now knows very little (as in the 'id') of statuses. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sat, 05 Nov 2005 02:09:30 +0000
parents 717cbb3115bc
children 053bb5ad040b
files plugins/mono/GetBuddyBack.cs plugins/mono/MPlugin.cs plugins/mono/api/BuddyList.cs plugins/mono/api/Makefile.am plugins/mono/api/Status.cs plugins/mono/loader/Makefile.am plugins/mono/loader/blist-glue.c plugins/mono/loader/mono-glue.h plugins/mono/loader/mono-helper.c plugins/mono/loader/mono-helper.h plugins/mono/loader/mono.c plugins/mono/loader/signal-glue.c plugins/mono/loader/status-glue.c
diffstat 13 files changed, 191 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mono/GetBuddyBack.cs	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/GetBuddyBack.cs	Sat Nov 05 02:09:30 2005 +0000
@@ -14,7 +14,7 @@
 		Debug.debug(Debug.INFO, "buddyback", "loading...\n");
 		
 		/*Signal.connect(BuddyList.GetHandle(), this, "buddy-back", new Signal.Handler(HandleSig));*/
-		BuddyList.OnBuddyBack.connect(this, new Signal.Handler(HandleSig));
+		/*BuddyList.OnBuddyBack.connect(this, new Signal.Handler(HandleSig));*/
 	}
 	
 	public override void Unload()
--- a/plugins/mono/MPlugin.cs	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/MPlugin.cs	Sat Nov 05 02:09:30 2005 +0000
@@ -5,8 +5,10 @@
 	public void HandleSig(object[] args)
 	{
 		Buddy buddy = (Buddy)args[0];
+		Status old_status = (Status)args[1];
+		Status status = (Status)args[2];
 		
-		Debug.debug(Debug.INFO, "mplug", "buddy " + buddy.Name + " went away\n");
+		Debug.debug(Debug.INFO, "mplug", "buddy " + buddy.Name + " went from " + old_status.Id + " to " + status.Id + "\n");
 	}
 	
 	public override void Load()
@@ -14,7 +16,7 @@
 		Debug.debug(Debug.INFO, "mplug", "loading...\n");
 		
 		/*Signal.connect(BuddyList.GetHandle(), this, "buddy-away", new Signal.Handler(HandleSig));*/
-		BuddyList.OnBuddyAway.connect(this, new Signal.Handler(HandleSig));
+		BuddyList.OnBuddyStatusChanged.connect(this, new Signal.Handler(HandleSig));
 	}
 	
 	public override void Unload()
--- a/plugins/mono/api/BuddyList.cs	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/api/BuddyList.cs	Sat Nov 05 02:09:30 2005 +0000
@@ -10,8 +10,7 @@
 
 		private static IntPtr handle = _get_handle();
 		
-		public static Event OnBuddyAway = new Event(handle, "buddy-away");
-		public static Event OnBuddyBack = new Event(handle, "buddy-back");
+		public static Event OnBuddyStatusChanged = new Event(handle, "buddy-status-changed");
 		
 		public static IntPtr GetHandle()
 		{
--- a/plugins/mono/api/Makefile.am	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/api/Makefile.am	Sat Nov 05 02:09:30 2005 +0000
@@ -5,7 +5,8 @@
 	BuddyList.cs \
 	Buddy.cs \
 	Signal.cs \
-	Event.cs
+	Event.cs \
+	Status.cs
 
 EXTRA_DIST = $(mono_sources)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/mono/api/Status.cs	Sat Nov 05 02:09:30 2005 +0000
@@ -0,0 +1,9 @@
+namespace Gaim
+{
+	public class Status
+	{
+		private string id;
+				
+		public string Id { get { return id; } set { id = value; } }
+	}
+}
--- a/plugins/mono/loader/Makefile.am	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/Makefile.am	Sat Nov 05 02:09:30 2005 +0000
@@ -9,7 +9,8 @@
 	mono-helper.h \
 	debug-glue.c \
 	signal-glue.c \
-	blist-glue.c
+	blist-glue.c \
+	status-glue.c 
 
 mono_la_LDFLAGS  = -module -avoid-version
 
--- a/plugins/mono/loader/blist-glue.c	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/blist-glue.c	Sat Nov 05 02:09:30 2005 +0000
@@ -6,7 +6,7 @@
 {
 	void *handle = gaim_blist_get_handle();
 	
-	return mono_value_box(mono_loader_get_domain(), mono_get_intptr_class(), &handle);
+	return mono_value_box(ml_get_domain(), mono_get_intptr_class(), &handle);
 }
 
 MonoObject* gaim_blist_build_buddy_object(void* data)
@@ -16,20 +16,20 @@
 			
 	GaimBuddy *buddy = (GaimBuddy*)data;
 	
-	klass = mono_class_from_name(mono_loader_get_api_image(), "Gaim", "Buddy");
+	klass = mono_class_from_name(ml_get_api_image(), "Gaim", "Buddy");
 	if (!klass) {
 		gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't build the class!\n");
 	}
 	
-	obj = mono_object_new(mono_loader_get_domain(), klass);
+	obj = mono_object_new(ml_get_domain(), klass);
 	if (!obj) {
 		gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't create the object!\n");
 	}
 	
 	mono_runtime_object_init(obj);
 	
-	mono_loader_set_prop_string(obj, "Name", (char*)gaim_buddy_get_name(buddy));
-	mono_loader_set_prop_string(obj, "Alias", (char*)gaim_buddy_get_alias(buddy));
+	ml_set_prop_string(obj, "Name", (char*)gaim_buddy_get_name(buddy));
+	ml_set_prop_string(obj, "Alias", (char*)gaim_buddy_get_alias(buddy));
 	
 	return obj;
 }
--- a/plugins/mono/loader/mono-glue.h	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/mono-glue.h	Sat Nov 05 02:09:30 2005 +0000
@@ -14,4 +14,6 @@
 
 MonoObject* gaim_blist_build_buddy_object(void* buddy);
 
+MonoObject* gaim_status_build_status_object(void* data);
+
 #endif
--- a/plugins/mono/loader/mono-helper.c	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/mono-helper.c	Sat Nov 05 02:09:30 2005 +0000
@@ -17,7 +17,42 @@
 #include "value.h"
 #include "debug.h"
 
-MonoObject* mono_loader_delegate_invoke(MonoObject *method, void **params)
+static gboolean _runtime_active = FALSE;
+
+gboolean ml_init()
+{
+	MonoDomain *d;
+	
+	g_return_val_if_fail(_runtime_active == FALSE, TRUE);
+	
+	d = mono_jit_init("gaim");
+	
+	if (!d) {
+		ml_set_domain(NULL);
+		return FALSE;
+	}
+	
+	ml_set_domain(d);
+	
+	ml_init_internal_calls();
+	
+	_runtime_active = TRUE;
+	
+	return TRUE;
+}
+
+void ml_uninit()
+{
+	g_return_if_fail(_runtime_active == TRUE);
+	
+	mono_jit_cleanup(ml_get_domain());
+	
+	ml_set_domain(NULL);
+	
+	_runtime_active = FALSE;
+}
+
+MonoObject* ml_delegate_invoke(MonoObject *method, void **params)
 {
 	MonoObject *ret, *exception;
 	
@@ -29,7 +64,7 @@
 	return ret;
 }
 
-MonoObject* mono_loader_invoke(MonoMethod *method, void *obj, void **params)
+MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params)
 {
 	MonoObject *ret, *exception;
 	
@@ -41,7 +76,7 @@
 	return ret;
 }
 
-MonoClass* mono_loader_find_plugin_class(MonoImage *image)
+MonoClass* ml_find_plugin_class(MonoImage *image)
 {
 	MonoClass *klass, *pklass = NULL;
 	int i, total;
@@ -58,7 +93,7 @@
 	return NULL;
 }
 
-void mono_loader_set_prop_string(MonoObject *obj, char *field, char *data)
+void ml_set_prop_string(MonoObject *obj, char *field, char *data)
 {
 	MonoClass *klass;
 	MonoProperty *prop;
@@ -69,14 +104,14 @@
 	
 	prop = mono_class_get_property_from_name(klass, field);
 	
-	str = mono_string_new(mono_loader_get_domain(), data);
+	str = mono_string_new(ml_get_domain(), data);
 	
 	args[0] = str;
 	
 	mono_property_set_value(prop, obj, args, NULL);
 }
 
-gchar* mono_loader_get_prop_string(MonoObject *obj, char *field)
+gchar* ml_get_prop_string(MonoObject *obj, char *field)
 {
 	MonoClass *klass;
 	MonoProperty *prop;
@@ -91,7 +126,7 @@
 	return mono_string_to_utf8(str);
 }
 
-gboolean mono_loader_is_api_dll(MonoImage *image)
+gboolean ml_is_api_dll(MonoImage *image)
 {	
 	MonoClass *klass;
 	int i, total;
@@ -101,7 +136,7 @@
 		klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i);
 		if (strcmp(mono_class_get_name(klass), "Debug") == 0)
 			if (strcmp(mono_class_get_namespace(klass), "Gaim") == 0) {
-				mono_loader_set_api_image(image);
+				ml_set_api_image(image);
 				return TRUE;
 			}
 	}
@@ -109,12 +144,12 @@
 	return FALSE;
 }
 
-MonoObject* mono_loader_object_from_gaim_type(GaimType type, gpointer data)
+MonoObject* ml_object_from_gaim_type(GaimType type, gpointer data)
 {
 	return NULL;
 }
 
-MonoObject* mono_loader_object_from_gaim_subtype(GaimSubType type, gpointer data)
+MonoObject* ml_object_from_gaim_subtype(GaimSubType type, gpointer data)
 {
 	MonoObject *obj = NULL;
 	
@@ -122,6 +157,9 @@
 		case GAIM_SUBTYPE_BLIST_BUDDY:
 			obj = gaim_blist_build_buddy_object(data);
 		break;
+		case GAIM_SUBTYPE_STATUS:
+			obj = gaim_status_build_status_object(data);
+		break;
 		default:
 		break;
 	}
@@ -131,38 +169,43 @@
 
 static MonoDomain *_domain = NULL;
 
-MonoDomain* mono_loader_get_domain(void)
+MonoDomain* ml_get_domain(void)
 {
 	return _domain;
 }
 
-void mono_loader_set_domain(MonoDomain *d)
+void ml_set_domain(MonoDomain *d)
 {
 	_domain = d;
 }
 
 static MonoImage *_api_image = NULL;
 
-void mono_loader_set_api_image(MonoImage *image)
+void ml_set_api_image(MonoImage *image)
 {
 	_api_image = image;
 }
 
-MonoImage* mono_loader_get_api_image()
+MonoImage* ml_get_api_image()
 {
 	return _api_image;
 }
 
-void mono_loader_init_internal_calls(void)
+void ml_init_internal_calls(void)
 {
 	mono_add_internal_call("Gaim.Debug::_debug", gaim_debug_glue);
 	mono_add_internal_call("Gaim.Signal::_connect", gaim_signal_connect_glue);
 	mono_add_internal_call("Gaim.BuddyList::_get_handle", gaim_blist_get_handle_glue);
 }
 
+void ml_destroy_signal_data(gpointer data, gpointer user_data)
+{
+	g_free(data);
+}
+
 static GHashTable *plugins_hash = NULL;
 
-void mono_loader_add_plugin(GaimMonoPlugin *plugin)
+void ml_add_plugin(GaimMonoPlugin *plugin)
 {
 	if (!plugins_hash)
 		plugins_hash = g_hash_table_new(NULL, NULL);
@@ -170,22 +213,22 @@
 	g_hash_table_insert(plugins_hash, plugin->klass, plugin);
 }
 
-gboolean mono_loader_remove_plugin(GaimMonoPlugin *plugin)
+gboolean ml_remove_plugin(GaimMonoPlugin *plugin)
 {
 	return g_hash_table_remove(plugins_hash, plugin->klass);
 }
 
-gpointer mono_loader_find_plugin(GaimMonoPlugin *plugin)
+gpointer ml_find_plugin(GaimMonoPlugin *plugin)
 {
 	return g_hash_table_lookup(plugins_hash, plugin->klass);
 }
 
-gpointer mono_loader_find_plugin_by_class(MonoClass *klass)
+gpointer ml_find_plugin_by_class(MonoClass *klass)
 {
 	return g_hash_table_lookup(plugins_hash, klass);
 }
 
-GHashTable* mono_loader_get_plugin_hash()
+GHashTable* ml_get_plugin_hash()
 {
 	return plugins_hash;
 }
--- a/plugins/mono/loader/mono-helper.h	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/mono-helper.h	Sat Nov 05 02:09:30 2005 +0000
@@ -13,51 +13,61 @@
 
 typedef struct {
 	GaimPlugin *plugin;
+	
 	MonoAssembly *assm;
 	MonoClass *klass;
 	MonoObject *obj;	
+	
 	MonoMethod *init;
 	MonoMethod *load;
 	MonoMethod *unload;
 	MonoMethod *destroy;
+	
+	GList *signal_data;
 } GaimMonoPlugin;
 
-MonoObject* mono_loader_invoke(MonoMethod *method, void *obj, void **params);
+gboolean ml_init();
+
+void ml_uninit();
 
-MonoObject* mono_loader_delegate_invoke(MonoObject *method, void **params);
+MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params);
 
-MonoClass* mono_loader_find_plugin_class(MonoImage *image);
+MonoObject* ml_delegate_invoke(MonoObject *method, void **params);
 
-gchar* mono_loader_get_prop_string(MonoObject *obj, char *field);
+MonoClass* ml_find_plugin_class(MonoImage *image);
+
+gchar* ml_get_prop_string(MonoObject *obj, char *field);
 
-void mono_loader_set_prop_string(MonoObject *obj, char *field, char *data);
+void ml_set_prop_string(MonoObject *obj, char *field, char *data);
 
-gboolean mono_loader_is_api_dll(MonoImage *image);
+gboolean ml_is_api_dll(MonoImage *image);
 
-MonoDomain* mono_loader_get_domain(void);
+MonoDomain* ml_get_domain(void);
+
+void ml_set_domain(MonoDomain *d);
 
-void mono_loader_set_domain(MonoDomain *d);
+void ml_init_internal_calls(void);
 
-void mono_loader_init_internal_calls(void);
+MonoObject* ml_object_from_gaim_type(GaimType type, gpointer data);
 
-MonoObject* mono_loader_object_from_gaim_type(GaimType type, gpointer data);
+MonoObject* ml_object_from_gaim_subtype(GaimSubType type, gpointer data);
 
-MonoObject* mono_loader_object_from_gaim_subtype(GaimSubType type, gpointer data);
+void ml_set_api_image(MonoImage *image);
 
-void mono_loader_set_api_image(MonoImage *image);
+MonoImage* ml_get_api_image();
 
-MonoImage* mono_loader_get_api_image();
+void ml_destroy_signal_data(gpointer data, gpointer user_data);
 
 /* hash table stuff; probably don't need it anymore */
 
-void mono_loader_add_plugin(GaimMonoPlugin *plugin);
+void ml_add_plugin(GaimMonoPlugin *plugin);
 
-gboolean mono_loader_remove_plugin(GaimMonoPlugin *plugin);
+gboolean ml_remove_plugin(GaimMonoPlugin *plugin);
 
-gpointer mono_loader_find_plugin(GaimMonoPlugin *plugin);
+gpointer ml_find_plugin(GaimMonoPlugin *plugin);
 
-gpointer mono_loader_find_plugin_by_class(MonoClass *klass);
+gpointer ml_find_plugin_by_class(MonoClass *klass);
 
-GHashTable* mono_loader_get_plugin_hash();
+GHashTable* ml_get_plugin_hash();
 
 #endif
--- a/plugins/mono/loader/mono.c	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/mono.c	Sat Nov 05 02:09:30 2005 +0000
@@ -36,7 +36,7 @@
 
 	char *file = plugin->path;
 
-	assm = mono_domain_assembly_open(mono_loader_get_domain(), file);
+	assm = mono_domain_assembly_open(ml_get_domain(), file);
 
 	if (!assm) {
 		return FALSE;
@@ -44,23 +44,25 @@
 
 	gaim_debug(GAIM_DEBUG_INFO, "mono", "Probing plugin\n");
 
-	if (mono_loader_is_api_dll(mono_assembly_get_image(assm))) {
+	if (ml_is_api_dll(mono_assembly_get_image(assm))) {
 		gaim_debug(GAIM_DEBUG_INFO, "mono", "Found our GaimAPI.dll\n");
 		return FALSE;
 	}
 
 	info = g_new0(GaimPluginInfo, 1);
 	mplug = g_new0(GaimMonoPlugin, 1);
+	
+	mplug->signal_data = NULL;
 
 	mplug->assm = assm;
 
-	mplug->klass = mono_loader_find_plugin_class(mono_assembly_get_image(mplug->assm));
+	mplug->klass = ml_find_plugin_class(mono_assembly_get_image(mplug->assm));
 	if (!mplug->klass) {
 		gaim_debug(GAIM_DEBUG_ERROR, "mono", "no plugin class in \'%s\'\n", file);
 		return FALSE;
 	}
 
-	mplug->obj = mono_object_new(mono_loader_get_domain(), mplug->klass);
+	mplug->obj = mono_object_new(ml_get_domain(), mplug->klass);
 	if (!mplug->obj) {
 		gaim_debug(GAIM_DEBUG_ERROR, "mono", "obj not valid\n");
 		return FALSE;
@@ -89,17 +91,17 @@
 		return FALSE;
 	}
 
-	plugin_info = mono_loader_invoke(info_method, mplug->obj, NULL);
+	plugin_info = ml_invoke(info_method, mplug->obj, NULL);
 
 	/* now that the methods are filled out we can populate
 	   the info struct with all the needed info */
 
-	info->name = mono_loader_get_prop_string(plugin_info, "Name");
-	info->version = mono_loader_get_prop_string(plugin_info, "Version");
-	info->summary = mono_loader_get_prop_string(plugin_info, "Summary");
-	info->description = mono_loader_get_prop_string(plugin_info, "Description");
-	info->author = mono_loader_get_prop_string(plugin_info, "Author");
-	info->homepage = mono_loader_get_prop_string(plugin_info, "Homepage");
+	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");
+	info->description = ml_get_prop_string(plugin_info, "Description");
+	info->author = ml_get_prop_string(plugin_info, "Author");
+	info->homepage = ml_get_prop_string(plugin_info, "Homepage");
 
 	info->magic = GAIM_PLUGIN_MAGIC;
 	info->major_version = GAIM_MAJOR_VERSION;
@@ -113,7 +115,7 @@
 	plugin->info = info;
 	info->extra_info = mplug;
 
-	mono_loader_add_plugin(mplug);
+	ml_add_plugin(mplug);
 
 	return gaim_plugin_register(plugin);
 }
@@ -127,7 +129,7 @@
 
 	mplug = (GaimMonoPlugin*)plugin->info->extra_info;
 
-	mono_loader_invoke(mplug->load, mplug->obj, NULL);
+	ml_invoke(mplug->load, mplug->obj, NULL);
 
 	return TRUE;
 }
@@ -142,8 +144,10 @@
 	mplug = (GaimMonoPlugin*)plugin->info->extra_info;
 
 	gaim_signals_disconnect_by_handle((gpointer)mplug->klass);
+	g_list_free(mplug->signal_data);
+	mplug->signal_data = NULL;
 
-	mono_loader_invoke(mplug->unload, mplug->obj, NULL);
+	ml_invoke(mplug->unload, mplug->obj, NULL);
 
 	return TRUE;
 }
@@ -156,7 +160,7 @@
 
 	mplug = (GaimMonoPlugin*)plugin->info->extra_info;
 
-	mono_loader_invoke(mplug->destroy, mplug->obj, NULL);
+	ml_invoke(mplug->destroy, mplug->obj, NULL);
 
 	if (plugin->info) {
 		g_free(plugin->info->name);
@@ -182,7 +186,7 @@
  *****************************************************************************/
 static void plugin_destroy(GaimPlugin *plugin)
 {
-	mono_jit_cleanup(mono_loader_get_domain());
+	ml_uninit();
 }
 
 static GaimPluginLoaderInfo loader_info =
@@ -222,12 +226,8 @@
 
 static void init_plugin(GaimPlugin *plugin)
 {
-	MonoDomain *domain = mono_jit_init("gaim");
-
-	mono_loader_set_domain(domain);
-
-	mono_loader_init_internal_calls();
-
+	ml_init();
+	
 	loader_info.exts = g_list_append(loader_info.exts, "dll");
 }
 
--- a/plugins/mono/loader/signal-glue.c	Sat Nov 05 01:57:00 2005 +0000
+++ b/plugins/mono/loader/signal-glue.c	Sat Nov 05 02:09:30 2005 +0000
@@ -27,16 +27,16 @@
 	
 	va_start(args, num_vals);
 	
-	array = mono_array_new(mono_loader_get_domain(), mono_get_object_class(), num_vals);
+	array = mono_array_new(ml_get_domain(), mono_get_object_class(), num_vals);
 	
 	for (i = 0; i < num_vals; i++) {
 		if (gaim_value_get_type(sig_data->values[i]) == GAIM_TYPE_SUBTYPE) {
 			gaim_obj = va_arg(args, gpointer);
-			obj = mono_loader_object_from_gaim_subtype(gaim_value_get_subtype(sig_data->values[i]), gaim_obj);
+			obj = ml_object_from_gaim_subtype(gaim_value_get_subtype(sig_data->values[i]), gaim_obj);
 			mono_array_set(array, MonoObject*, i, obj);
 		} else {
 			gaim_obj = va_arg(args, gpointer);
-			obj = mono_loader_object_from_gaim_type(gaim_value_get_type(sig_data->values[i]), gaim_obj);
+			obj = ml_object_from_gaim_type(gaim_value_get_type(sig_data->values[i]), gaim_obj);
 			mono_array_set(array, MonoObject*, i, obj);
 		}
 	}
@@ -45,34 +45,47 @@
 	
 	meth_args[0] = array;
 	
-	return mono_loader_delegate_invoke(sig_data->func, meth_args);	
+	return ml_delegate_invoke(sig_data->func, meth_args);	
 }
 
 static void cb_void__pointer(void *arg1, void *data)
 {
-	dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1);
-	
+	dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1);	
 }
 
+static void cb_void__pointer_pointer_pointer(void *arg1, void *arg2, void *arg3, void *data)
+{
+	dispatch_callback((SignalData*)data, ((SignalData*)data)->num_vals, arg1, arg2, arg3);	
+}
+
+
 int gaim_signal_connect_glue(MonoObject* h, MonoObject *plugin, MonoString *signal, MonoObject *func)
 {
 	char *sig;
 	void **instance = NULL;
 	SignalData *sig_data;
+	GaimMonoPlugin *mplug;
+	MonoClass *klass;
 		
 	sig = mono_string_to_utf8(signal);
 	gaim_debug(GAIM_DEBUG_INFO, "mono", "connecting signal: %s\n", sig);
 	
 	instance = (void*)mono_object_unbox(h);
-
+	
 	sig_data = g_new0(SignalData, 1);
 	
 	sig_data->func = func;
 	sig_data->signal = sig;
 	
 	gaim_signal_get_values(*instance, sig, &sig_data->ret_value, &sig_data->num_vals, &sig_data->values);
+	
+	klass = mono_object_get_class(plugin);
+	
+	mplug = ml_find_plugin_by_class(klass);
+	
+	mplug->signal_data = g_list_append(mplug->signal_data, (gpointer)sig_data);
 
-	return gaim_signal_connect(*instance, sig, (gpointer)mono_object_get_class(plugin), get_callback(sig_data), (gpointer)sig_data);
+	return gaim_signal_connect(*instance, sig, (gpointer)klass, get_callback(sig_data), (gpointer)sig_data);
 }
 
 static int determine_index(GaimType type)
@@ -94,6 +107,8 @@
 static gpointer callbacks[]= { 
 										NULL,
 										cb_void__pointer,
+										NULL,
+										cb_void__pointer_pointer_pointer
 									};
 
 static int callbacks_array_size = sizeof(callbacks) / sizeof(GaimCallback);
@@ -106,12 +121,14 @@
 	if (sig_data->ret_value == NULL)
 		index = 0;
 	else
-		index = gaim_value_get_type(sig_data->ret_value);
+		index = determine_index(gaim_value_get_type(sig_data->ret_value));
 	
 	for (i = 0; i < sig_data->num_vals; i++) {
 		index += determine_index(gaim_value_get_type(sig_data->values[i]));
 	}
 	
+	gaim_debug(GAIM_DEBUG_INFO, "mono", "get_callback index = %d\n", index);
+	
 	if (index >= callbacks_array_size || callbacks[index] == NULL) {
 		gaim_debug(GAIM_DEBUG_ERROR, "mono", "couldn't find a callback function for signal: %s\n", sig_data->signal);
 		return NULL;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/mono/loader/status-glue.c	Sat Nov 05 02:09:30 2005 +0000
@@ -0,0 +1,26 @@
+#include "status.h"
+#include "mono-helper.h"
+
+MonoObject* gaim_status_build_status_object(void* data)
+{
+	MonoObject *obj = NULL;
+	MonoClass *klass = NULL;
+			
+	GaimStatus *status = (GaimStatus*)data;
+	
+	klass = mono_class_from_name(ml_get_api_image(), "Gaim", "Status");
+	if (!klass) {
+		gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't build the class!\n");
+	}
+	
+	obj = mono_object_new(ml_get_domain(), klass);
+	if (!obj) {
+		gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't create the object!\n");
+	}
+	
+	mono_runtime_object_init(obj);
+	
+	ml_set_prop_string(obj, "Id", (char*)gaim_status_get_id(status));
+	
+	return obj;
+}