… | |
… | |
51 | |
51 | |
52 | static f_plug_api gethook; |
52 | static f_plug_api gethook; |
53 | static f_plug_api registerGlobalEvent; |
53 | static f_plug_api registerGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
54 | static f_plug_api unregisterGlobalEvent; |
55 | static f_plug_api systemDirectory; |
55 | static f_plug_api systemDirectory; |
|
|
56 | static f_plug_api object_set_property; |
56 | |
57 | |
57 | typedef struct |
58 | typedef struct |
58 | { |
59 | { |
59 | object* who; |
60 | object* who; |
60 | object* activator; |
61 | object* activator; |
… | |
… | |
334 | printf (PLUGIN_VERSION " post init\n"); |
335 | printf (PLUGIN_VERSION " post init\n"); |
335 | |
336 | |
336 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
337 | registerGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_register_global_event"); |
337 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
338 | unregisterGlobalEvent = gethook (&rtype, hooktype, "cfapi_system_unregister_global_event"); |
338 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
339 | systemDirectory = gethook (&rtype, hooktype, "cfapi_system_directory"); |
|
|
340 | object_set_property = gethook (&rtype, hooktype, "cfapi_object_set_property"); |
339 | cf_init_plugin (gethook); |
341 | cf_init_plugin (gethook); |
340 | |
342 | |
341 | /* Pick the global events you want to monitor from this plugin */ |
343 | /* Pick the global events you want to monitor from this plugin */ |
342 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
344 | registerGlobalEvent (NULL, EVENT_BORN, PLUGIN_NAME, globalEventListener); |
343 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
345 | registerGlobalEvent (NULL, EVENT_CLOCK, PLUGIN_NAME, globalEventListener); |
… | |
… | |
1067 | cf_object_set_int_property (obj, idx, SvIV (newval)); |
1069 | cf_object_set_int_property (obj, idx, SvIV (newval)); |
1068 | break; |
1070 | break; |
1069 | case CFAPI_LONG: |
1071 | case CFAPI_LONG: |
1070 | cf_object_set_long_property (obj, idx, SvNV (newval)); |
1072 | cf_object_set_long_property (obj, idx, SvNV (newval)); |
1071 | break; |
1073 | break; |
|
|
1074 | case CFAPI_DOUBLE: |
|
|
1075 | { |
|
|
1076 | int unused_type; |
|
|
1077 | object_set_property (&unused_type, obj, idx, (double)SvNV (newval)); |
|
|
1078 | } |
|
|
1079 | break; |
1072 | case CFAPI_STRING: |
1080 | case CFAPI_STRING: |
1073 | cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); |
1081 | cf_object_set_string_property (obj, idx, SvPV_nolen (newval)); |
1074 | break; |
1082 | break; |
1075 | default: |
1083 | default: |
1076 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |
1084 | croak ("unhandled type '%d' in set_property '%d'", type, idx); |