11660
|
1 #include <string.h>
|
|
2 #include "blist.h"
|
|
3 #include "mono-helper.h"
|
|
4
|
|
5 MonoObject* gaim_blist_get_handle_glue(void)
|
|
6 {
|
|
7 void *handle = gaim_blist_get_handle();
|
|
8
|
|
9 return mono_value_box(mono_loader_get_domain(), mono_get_intptr_class(), &handle);
|
|
10 }
|
|
11
|
|
12 MonoObject* gaim_blist_build_buddy_object(void* data)
|
|
13 {
|
|
14 MonoObject *obj = NULL;
|
|
15 MonoClass *klass = NULL;
|
|
16
|
|
17 GaimBuddy *buddy = (GaimBuddy*)data;
|
|
18
|
|
19 klass = mono_class_from_name(mono_loader_get_api_image(), "Gaim", "Buddy");
|
|
20 if (!klass) {
|
|
21 gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't build the class!\n");
|
|
22 }
|
|
23
|
|
24 obj = mono_object_new(mono_loader_get_domain(), klass);
|
|
25 if (!obj) {
|
|
26 gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't create the object!\n");
|
|
27 }
|
|
28
|
|
29 mono_runtime_object_init(obj);
|
|
30
|
|
31 mono_loader_set_prop_string(obj, "Name", (char*)gaim_buddy_get_name(buddy));
|
|
32 mono_loader_set_prop_string(obj, "Alias", (char*)gaim_buddy_get_alias(buddy));
|
|
33
|
|
34 return obj;
|
|
35 }
|