2 * @file signals.c Signal API
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
28 #include "dbus-maybe.h"
33 /* must include this to use G_VA_COPY */
43 gulong next_signal_id
;
51 PurpleSignalMarshalFunc marshal
;
55 PurpleValue
*ret_value
;
60 gulong next_handler_id
;
72 } PurpleSignalHandlerData
;
74 static GHashTable
*instance_table
= NULL
;
77 destroy_instance_data(PurpleInstanceData
*instance_data
)
79 g_hash_table_destroy(instance_data
->signals
);
81 g_free(instance_data
);
85 destroy_signal_data(PurpleSignalData
*signal_data
)
87 g_list_foreach(signal_data
->handlers
, (GFunc
)g_free
, NULL
);
88 g_list_free(signal_data
->handlers
);
90 if (signal_data
->values
!= NULL
)
94 for (i
= 0; i
< signal_data
->num_values
; i
++)
95 purple_value_destroy((PurpleValue
*)signal_data
->values
[i
]);
97 g_free(signal_data
->values
);
100 if (signal_data
->ret_value
!= NULL
)
101 purple_value_destroy(signal_data
->ret_value
);
106 purple_signal_register(void *instance
, const char *signal
,
107 PurpleSignalMarshalFunc marshal
,
108 PurpleValue
*ret_value
, int num_values
, ...)
110 PurpleInstanceData
*instance_data
;
111 PurpleSignalData
*signal_data
;
114 g_return_val_if_fail(instance
!= NULL
, 0);
115 g_return_val_if_fail(signal
!= NULL
, 0);
116 g_return_val_if_fail(marshal
!= NULL
, 0);
119 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
121 if (instance_data
== NULL
)
123 instance_data
= g_new0(PurpleInstanceData
, 1);
125 instance_data
->instance
= instance
;
126 instance_data
->next_signal_id
= 1;
128 instance_data
->signals
=
129 g_hash_table_new_full(g_str_hash
, g_str_equal
, g_free
,
130 (GDestroyNotify
)destroy_signal_data
);
132 g_hash_table_insert(instance_table
, instance
, instance_data
);
135 signal_data
= g_new0(PurpleSignalData
, 1);
136 signal_data
->id
= instance_data
->next_signal_id
;
137 signal_data
->marshal
= marshal
;
138 signal_data
->next_handler_id
= 1;
139 signal_data
->ret_value
= ret_value
;
140 signal_data
->num_values
= num_values
;
146 signal_data
->values
= g_new0(PurpleValue
*, num_values
);
148 va_start(args
, num_values
);
150 for (i
= 0; i
< num_values
; i
++)
151 signal_data
->values
[i
] = va_arg(args
, PurpleValue
*);
156 g_hash_table_insert(instance_data
->signals
,
157 g_strdup(signal
), signal_data
);
159 instance_data
->next_signal_id
++;
160 instance_data
->signal_count
++;
162 return signal_data
->id
;
166 purple_signal_unregister(void *instance
, const char *signal
)
168 PurpleInstanceData
*instance_data
;
170 g_return_if_fail(instance
!= NULL
);
171 g_return_if_fail(signal
!= NULL
);
174 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
176 g_return_if_fail(instance_data
!= NULL
);
178 g_hash_table_remove(instance_data
->signals
, signal
);
180 instance_data
->signal_count
--;
182 if (instance_data
->signal_count
== 0)
184 /* Unregister the instance. */
185 g_hash_table_remove(instance_table
, instance
);
190 purple_signals_unregister_by_instance(void *instance
)
194 g_return_if_fail(instance
!= NULL
);
196 found
= g_hash_table_remove(instance_table
, instance
);
199 * Makes things easier (more annoying?) for developers who don't have
200 * things registering and unregistering in the right order :)
202 g_return_if_fail(found
);
206 purple_signal_get_values(void *instance
, const char *signal
,
207 PurpleValue
**ret_value
,
208 int *num_values
, PurpleValue
***values
)
210 PurpleInstanceData
*instance_data
;
211 PurpleSignalData
*signal_data
;
213 g_return_if_fail(instance
!= NULL
);
214 g_return_if_fail(signal
!= NULL
);
215 g_return_if_fail(num_values
!= NULL
);
216 g_return_if_fail(values
!= NULL
);
218 /* Get the instance data */
220 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
222 g_return_if_fail(instance_data
!= NULL
);
224 /* Get the signal data */
226 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
228 g_return_if_fail(signal_data
!= NULL
);
230 *num_values
= signal_data
->num_values
;
231 *values
= signal_data
->values
;
233 if (ret_value
!= NULL
)
234 *ret_value
= signal_data
->ret_value
;
237 static gint
handler_priority(void * a
, void * b
) {
238 PurpleSignalHandlerData
*ah
= (PurpleSignalHandlerData
*)a
;
239 PurpleSignalHandlerData
*bh
= (PurpleSignalHandlerData
*)b
;
240 if (ah
->priority
> bh
->priority
) return 1;
241 if (ah
->priority
< bh
->priority
) return -1;
246 signal_connect_common(void *instance
, const char *signal
, void *handle
,
247 PurpleCallback func
, void *data
, int priority
, gboolean use_vargs
)
249 PurpleInstanceData
*instance_data
;
250 PurpleSignalData
*signal_data
;
251 PurpleSignalHandlerData
*handler_data
;
253 g_return_val_if_fail(instance
!= NULL
, 0);
254 g_return_val_if_fail(signal
!= NULL
, 0);
255 g_return_val_if_fail(handle
!= NULL
, 0);
256 g_return_val_if_fail(func
!= NULL
, 0);
258 /* Get the instance data */
260 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
262 if (instance_data
== NULL
)
264 purple_debug_warning("signals", "Something tried to register a callback "
265 "for the '%s' signal, but we do not have any signals "
266 "registered with the given handle\n", signal
);
267 g_return_val_if_reached(0);
270 /* Get the signal data */
272 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
274 if (signal_data
== NULL
)
276 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
277 "Signal data for %s not found!\n", signal
);
281 /* Create the signal handler data */
282 handler_data
= g_new0(PurpleSignalHandlerData
, 1);
283 handler_data
->id
= signal_data
->next_handler_id
;
284 handler_data
->cb
= func
;
285 handler_data
->handle
= handle
;
286 handler_data
->data
= data
;
287 handler_data
->use_vargs
= use_vargs
;
288 handler_data
->priority
= priority
;
290 signal_data
->handlers
= g_list_insert_sorted(signal_data
->handlers
, handler_data
, (GCompareFunc
)handler_priority
);
291 signal_data
->handler_count
++;
292 signal_data
->next_handler_id
++;
294 return handler_data
->id
;
298 purple_signal_connect_priority(void *instance
, const char *signal
, void *handle
,
299 PurpleCallback func
, void *data
, int priority
)
301 return signal_connect_common(instance
, signal
, handle
, func
, data
, priority
, FALSE
);
305 purple_signal_connect(void *instance
, const char *signal
, void *handle
,
306 PurpleCallback func
, void *data
)
308 return signal_connect_common(instance
, signal
, handle
, func
, data
, PURPLE_SIGNAL_PRIORITY_DEFAULT
, FALSE
);
312 purple_signal_connect_priority_vargs(void *instance
, const char *signal
, void *handle
,
313 PurpleCallback func
, void *data
, int priority
)
315 return signal_connect_common(instance
, signal
, handle
, func
, data
, priority
, TRUE
);
319 purple_signal_connect_vargs(void *instance
, const char *signal
, void *handle
,
320 PurpleCallback func
, void *data
)
322 return signal_connect_common(instance
, signal
, handle
, func
, data
, PURPLE_SIGNAL_PRIORITY_DEFAULT
, TRUE
);
326 purple_signal_disconnect(void *instance
, const char *signal
,
327 void *handle
, PurpleCallback func
)
329 PurpleInstanceData
*instance_data
;
330 PurpleSignalData
*signal_data
;
331 PurpleSignalHandlerData
*handler_data
;
333 gboolean found
= FALSE
;
335 g_return_if_fail(instance
!= NULL
);
336 g_return_if_fail(signal
!= NULL
);
337 g_return_if_fail(handle
!= NULL
);
338 g_return_if_fail(func
!= NULL
);
340 /* Get the instance data */
342 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
344 g_return_if_fail(instance_data
!= NULL
);
346 /* Get the signal data */
348 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
350 if (signal_data
== NULL
)
352 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
353 "Signal data for %s not found!\n", signal
);
357 /* Find the handler data. */
358 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l
->next
)
360 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
362 if (handler_data
->handle
== handle
&& handler_data
->cb
== func
)
364 g_free(handler_data
);
366 signal_data
->handlers
= g_list_delete_link(signal_data
->handlers
,
368 signal_data
->handler_count
--;
376 /* See note somewhere about this actually helping developers.. */
377 g_return_if_fail(found
);
381 * TODO: Make this all more efficient by storing a list of handlers, keyed
385 disconnect_handle_from_signals(const char *signal
,
386 PurpleSignalData
*signal_data
, void *handle
)
389 PurpleSignalHandlerData
*handler_data
;
391 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
393 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
396 if (handler_data
->handle
== handle
)
398 g_free(handler_data
);
400 signal_data
->handler_count
--;
401 signal_data
->handlers
= g_list_delete_link(signal_data
->handlers
,
408 disconnect_handle_from_instance(void *instance
,
409 PurpleInstanceData
*instance_data
,
412 g_hash_table_foreach(instance_data
->signals
,
413 (GHFunc
)disconnect_handle_from_signals
, handle
);
417 purple_signals_disconnect_by_handle(void *handle
)
419 g_return_if_fail(handle
!= NULL
);
421 g_hash_table_foreach(instance_table
,
422 (GHFunc
)disconnect_handle_from_instance
, handle
);
426 purple_signal_emit(void *instance
, const char *signal
, ...)
430 g_return_if_fail(instance
!= NULL
);
431 g_return_if_fail(signal
!= NULL
);
433 va_start(args
, signal
);
434 purple_signal_emit_vargs(instance
, signal
, args
);
439 purple_signal_emit_vargs(void *instance
, const char *signal
, va_list args
)
441 PurpleInstanceData
*instance_data
;
442 PurpleSignalData
*signal_data
;
443 PurpleSignalHandlerData
*handler_data
;
447 g_return_if_fail(instance
!= NULL
);
448 g_return_if_fail(signal
!= NULL
);
451 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
453 g_return_if_fail(instance_data
!= NULL
);
456 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
458 if (signal_data
== NULL
)
460 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
461 "Signal data for %s not found!\n", signal
);
465 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
469 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
471 /* This is necessary because a va_list may only be
473 G_VA_COPY(tmp
, args
);
475 if (handler_data
->use_vargs
)
477 ((void (*)(va_list, void *))handler_data
->cb
)(tmp
,
482 signal_data
->marshal(handler_data
->cb
, tmp
,
483 handler_data
->data
, NULL
);
490 purple_dbus_signal_emit_purple(signal
, signal_data
->num_values
,
491 signal_data
->values
, args
);
492 #endif /* HAVE_DBUS */
497 purple_signal_emit_return_1(void *instance
, const char *signal
, ...)
502 g_return_val_if_fail(instance
!= NULL
, NULL
);
503 g_return_val_if_fail(signal
!= NULL
, NULL
);
505 va_start(args
, signal
);
506 ret_val
= purple_signal_emit_vargs_return_1(instance
, signal
, args
);
513 purple_signal_emit_vargs_return_1(void *instance
, const char *signal
,
516 PurpleInstanceData
*instance_data
;
517 PurpleSignalData
*signal_data
;
518 PurpleSignalHandlerData
*handler_data
;
522 g_return_val_if_fail(instance
!= NULL
, NULL
);
523 g_return_val_if_fail(signal
!= NULL
, NULL
);
526 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
528 g_return_val_if_fail(instance_data
!= NULL
, NULL
);
531 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
533 if (signal_data
== NULL
)
535 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
536 "Signal data for %s not found!\n", signal
);
541 G_VA_COPY(tmp
, args
);
542 purple_dbus_signal_emit_purple(signal
, signal_data
->num_values
,
543 signal_data
->values
, tmp
);
545 #endif /* HAVE_DBUS */
547 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
549 void *ret_val
= NULL
;
553 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
555 G_VA_COPY(tmp
, args
);
556 if (handler_data
->use_vargs
)
558 ret_val
= ((void *(*)(va_list, void *))handler_data
->cb
)(
559 tmp
, handler_data
->data
);
563 signal_data
->marshal(handler_data
->cb
, tmp
,
564 handler_data
->data
, &ret_val
);
576 purple_signals_init()
578 g_return_if_fail(instance_table
== NULL
);
581 g_hash_table_new_full(g_direct_hash
, g_direct_equal
,
582 NULL
, (GDestroyNotify
)destroy_instance_data
);
586 purple_signals_uninit()
588 g_return_if_fail(instance_table
!= NULL
);
590 g_hash_table_destroy(instance_table
);
591 instance_table
= NULL
;
594 /**************************************************************************
596 **************************************************************************/
598 purple_marshal_VOID(PurpleCallback cb
, va_list args
, void *data
,
601 ((void (*)(void *))cb
)(data
);
605 purple_marshal_VOID__INT(PurpleCallback cb
, va_list args
, void *data
,
608 gint arg1
= va_arg(args
, gint
);
610 ((void (*)(gint
, void *))cb
)(arg1
, data
);
614 purple_marshal_VOID__INT_INT(PurpleCallback cb
, va_list args
, void *data
,
617 gint arg1
= va_arg(args
, gint
);
618 gint arg2
= va_arg(args
, gint
);
620 ((void (*)(gint
, gint
, void *))cb
)(arg1
, arg2
, data
);
624 purple_marshal_VOID__POINTER(PurpleCallback cb
, va_list args
, void *data
,
627 void *arg1
= va_arg(args
, void *);
629 ((void (*)(void *, void *))cb
)(arg1
, data
);
633 purple_marshal_VOID__POINTER_UINT(PurpleCallback cb
, va_list args
,
634 void *data
, void **return_val
)
636 void *arg1
= va_arg(args
, void *);
637 guint arg2
= va_arg(args
, guint
);
639 ((void (*)(void *, guint
, void *))cb
)(arg1
, arg2
, data
);
642 void purple_marshal_VOID__POINTER_INT_INT(PurpleCallback cb
, va_list args
,
643 void *data
, void **return_val
)
645 void *arg1
= va_arg(args
, void *);
646 gint arg2
= va_arg(args
, gint
);
647 gint arg3
= va_arg(args
, gint
);
649 ((void (*)(void *, gint
, gint
, void *))cb
)(arg1
, arg2
, arg3
, data
);
652 void purple_marshal_VOID__POINTER_INT_POINTER(PurpleCallback cb
, va_list args
,
653 void *data
, void **return_val
)
655 void *arg1
= va_arg(args
, void *);
656 gint arg2
= va_arg(args
, gint
);
657 void *arg3
= va_arg(args
, void *);
659 ((void (*)(void *, gint
, void *, void *))cb
)(arg1
, arg2
, arg3
, data
);
663 purple_marshal_VOID__POINTER_POINTER(PurpleCallback cb
, va_list args
,
664 void *data
, void **return_val
)
666 void *arg1
= va_arg(args
, void *);
667 void *arg2
= va_arg(args
, void *);
669 ((void (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
673 purple_marshal_VOID__POINTER_POINTER_UINT(PurpleCallback cb
, va_list args
,
674 void *data
, void **return_val
)
676 void *arg1
= va_arg(args
, void *);
677 void *arg2
= va_arg(args
, void *);
678 guint arg3
= va_arg(args
, guint
);
680 ((void (*)(void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, data
);
684 purple_marshal_VOID__POINTER_POINTER_UINT_UINT(PurpleCallback cb
, va_list args
,
685 void *data
, void **return_val
)
687 void *arg1
= va_arg(args
, void *);
688 void *arg2
= va_arg(args
, void *);
689 guint arg3
= va_arg(args
, guint
);
690 guint arg4
= va_arg(args
, guint
);
692 ((void (*)(void *, void *, guint
, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
696 purple_marshal_VOID__POINTER_POINTER_POINTER(PurpleCallback cb
, va_list args
,
697 void *data
, void **return_val
)
699 void *arg1
= va_arg(args
, void *);
700 void *arg2
= va_arg(args
, void *);
701 void *arg3
= va_arg(args
, void *);
703 ((void (*)(void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, data
);
707 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
712 void *arg1
= va_arg(args
, void *);
713 void *arg2
= va_arg(args
, void *);
714 void *arg3
= va_arg(args
, void *);
715 void *arg4
= va_arg(args
, void *);
717 ((void (*)(void *, void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
721 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
726 void *arg1
= va_arg(args
, void *);
727 void *arg2
= va_arg(args
, void *);
728 void *arg3
= va_arg(args
, void *);
729 void *arg4
= va_arg(args
, void *);
730 void *arg5
= va_arg(args
, void *);
732 ((void (*)(void *, void *, void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, arg4
, arg5
, data
);
736 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
741 void *arg1
= va_arg(args
, void *);
742 void *arg2
= va_arg(args
, void *);
743 void *arg3
= va_arg(args
, void *);
744 guint arg4
= va_arg(args
, guint
);
746 ((void (*)(void *, void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
750 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
755 void *arg1
= va_arg(args
, void *);
756 void *arg2
= va_arg(args
, void *);
757 void *arg3
= va_arg(args
, void *);
758 void *arg4
= va_arg(args
, void *);
759 guint arg5
= va_arg(args
, guint
);
761 ((void (*)(void *, void *, void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, arg5
, data
);
765 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(PurpleCallback cb
,
770 void *arg1
= va_arg(args
, void *);
771 void *arg2
= va_arg(args
, void *);
772 void *arg3
= va_arg(args
, void *);
773 guint arg4
= va_arg(args
, guint
);
774 guint arg5
= va_arg(args
, guint
);
776 ((void (*)(void *, void *, void *, guint
, guint
, void *))cb
)(
777 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
781 purple_marshal_INT__INT(PurpleCallback cb
, va_list args
, void *data
,
785 gint arg1
= va_arg(args
, gint
);
787 ret_val
= ((gint (*)(gint
, void *))cb
)(arg1
, data
);
789 if (return_val
!= NULL
)
790 *return_val
= GINT_TO_POINTER(ret_val
);
794 purple_marshal_INT__INT_INT(PurpleCallback cb
, va_list args
, void *data
,
798 gint arg1
= va_arg(args
, gint
);
799 gint arg2
= va_arg(args
, gint
);
801 ret_val
= ((gint (*)(gint
, gint
, void *))cb
)(arg1
, arg2
, data
);
803 if (return_val
!= NULL
)
804 *return_val
= GINT_TO_POINTER(ret_val
);
808 purple_marshal_INT__POINTER_POINTER(PurpleCallback cb
, va_list args
, void *data
,
812 void *arg1
= va_arg(args
, void *);
813 void *arg2
= va_arg(args
, void *);
815 ret_val
= ((gint (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
817 if (return_val
!= NULL
)
818 *return_val
= GINT_TO_POINTER(ret_val
);
822 purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER(
823 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
826 void *arg1
= va_arg(args
, void *);
827 void *arg2
= va_arg(args
, void *);
828 void *arg3
= va_arg(args
, void *);
829 void *arg4
= va_arg(args
, void *);
830 void *arg5
= va_arg(args
, void *);
833 ((gint (*)(void *, void *, void *, void *, void *, void *))cb
)(
834 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
836 if (return_val
!= NULL
)
837 *return_val
= GINT_TO_POINTER(ret_val
);
841 purple_marshal_BOOLEAN__POINTER(PurpleCallback cb
, va_list args
, void *data
,
845 void *arg1
= va_arg(args
, void *);
847 ret_val
= ((gboolean (*)(void *, void *))cb
)(arg1
, data
);
849 if (return_val
!= NULL
)
850 *return_val
= GINT_TO_POINTER(ret_val
);
854 purple_marshal_BOOLEAN__POINTER_POINTER(PurpleCallback cb
, va_list args
,
855 void *data
, void **return_val
)
858 void *arg1
= va_arg(args
, void *);
859 void *arg2
= va_arg(args
, void *);
861 ret_val
= ((gboolean (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
863 if (return_val
!= NULL
)
864 *return_val
= GINT_TO_POINTER(ret_val
);
868 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER(PurpleCallback cb
, va_list args
,
869 void *data
, void **return_val
)
872 void *arg1
= va_arg(args
, void *);
873 void *arg2
= va_arg(args
, void *);
874 void *arg3
= va_arg(args
, void *);
876 ret_val
= ((gboolean (*)(void *, void *, void *, void *))cb
)(arg1
, arg2
,
879 if (return_val
!= NULL
)
880 *return_val
= GINT_TO_POINTER(ret_val
);
884 purple_marshal_BOOLEAN__POINTER_POINTER_UINT(PurpleCallback cb
,
890 void *arg1
= va_arg(args
, void *);
891 void *arg2
= va_arg(args
, void *);
892 guint arg3
= va_arg(args
, guint
);
894 ret_val
= ((gboolean (*)(void *, void *, guint
, void *))cb
)(
895 arg1
, arg2
, arg3
, data
);
897 if (return_val
!= NULL
)
898 *return_val
= GINT_TO_POINTER(ret_val
);
902 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
908 void *arg1
= va_arg(args
, void *);
909 void *arg2
= va_arg(args
, void *);
910 void *arg3
= va_arg(args
, void *);
911 guint arg4
= va_arg(args
, guint
);
913 ret_val
= ((gboolean (*)(void *, void *, void *, guint
, void *))cb
)(
914 arg1
, arg2
, arg3
, arg4
, data
);
916 if (return_val
!= NULL
)
917 *return_val
= GINT_TO_POINTER(ret_val
);
921 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
927 void *arg1
= va_arg(args
, void *);
928 void *arg2
= va_arg(args
, void *);
929 void *arg3
= va_arg(args
, void *);
930 void *arg4
= va_arg(args
, void *);
932 ret_val
= ((gboolean (*)(void *, void *, void *, void *, void *))cb
)(
933 arg1
, arg2
, arg3
, arg4
, data
);
935 if (return_val
!= NULL
)
936 *return_val
= GINT_TO_POINTER(ret_val
);
940 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER(
941 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
944 void *arg1
= va_arg(args
, void *);
945 void *arg2
= va_arg(args
, void *);
946 void *arg3
= va_arg(args
, void *);
947 void *arg4
= va_arg(args
, void *);
948 void *arg5
= va_arg(args
, void *);
951 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb
)(
952 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
954 if (return_val
!= NULL
)
955 *return_val
= GINT_TO_POINTER(ret_val
);
959 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT(
960 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
963 void *arg1
= va_arg(args
, void *);
964 void *arg2
= va_arg(args
, void *);
965 void *arg3
= va_arg(args
, void *);
966 void *arg4
= va_arg(args
, void *);
967 guint arg5
= va_arg(args
, guint
);
970 ((gboolean (*)(void *, void *, void *, void *, guint
, void *))cb
)(
971 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
973 if (return_val
!= NULL
)
974 *return_val
= GINT_TO_POINTER(ret_val
);
978 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER(
979 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
982 void *arg1
= va_arg(args
, void *);
983 void *arg2
= va_arg(args
, void *);
984 void *arg3
= va_arg(args
, void *);
985 void *arg4
= va_arg(args
, void *);
986 void *arg5
= va_arg(args
, void *);
987 void *arg6
= va_arg(args
, void *);
990 ((gboolean (*)(void *, void *, void *, void *, void *, void *, void *))cb
)(
991 arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, data
);
993 if (return_val
!= NULL
)
994 *return_val
= GINT_TO_POINTER(ret_val
);
998 purple_marshal_BOOLEAN__INT_POINTER(PurpleCallback cb
, va_list args
, void *data
,
1002 gint arg1
= va_arg(args
, gint
);
1003 void *arg2
= va_arg(args
, void *);
1005 ret_val
= ((gboolean (*)(gint
, void *, void *))cb
)(arg1
, arg2
, data
);
1007 if (return_val
!= NULL
)
1008 *return_val
= GINT_TO_POINTER(ret_val
);
1012 purple_marshal_POINTER__POINTER(
1013 PurpleCallback cb
, va_list args
, void *data
,
1017 void *arg1
= va_arg(args
, void *);
1019 ret_val
= ((gpointer(*)(void *, void *))cb
)(arg1
, data
);
1021 if (return_val
!= NULL
)
1022 *return_val
= ret_val
;
1027 purple_marshal_POINTER__POINTER_INT(
1028 PurpleCallback cb
, va_list args
, void *data
,
1032 void *arg1
= va_arg(args
, void *);
1033 gint arg2
= va_arg(args
, gint
);
1035 ret_val
= ((gpointer(*)(void *, gint
, void *))cb
)(arg1
, arg2
, data
);
1037 if (return_val
!= NULL
)
1038 *return_val
= ret_val
;
1042 purple_marshal_POINTER__POINTER_INT64(
1043 PurpleCallback cb
, va_list args
, void *data
,
1047 void *arg1
= va_arg(args
, void *);
1048 gint64 arg2
= va_arg(args
, gint64
);
1050 ret_val
= ((gpointer(*)(void *, gint64
, void *))cb
)(arg1
, arg2
, data
);
1052 if (return_val
!= NULL
)
1053 *return_val
= ret_val
;
1057 purple_marshal_POINTER__POINTER_INT_BOOLEAN(
1058 PurpleCallback cb
, va_list args
, void *data
,
1062 void *arg1
= va_arg(args
, void *);
1063 gint arg2
= va_arg(args
, gint
);
1064 gboolean arg3
= va_arg(args
, gboolean
);
1066 ret_val
= ((gpointer(*)(void *, gint
, gboolean
, void *))cb
)(arg1
, arg2
, arg3
, data
);
1068 if (return_val
!= NULL
)
1069 *return_val
= ret_val
;
1073 purple_marshal_POINTER__POINTER_INT64_BOOLEAN(
1074 PurpleCallback cb
, va_list args
, void *data
,
1078 void *arg1
= va_arg(args
, void *);
1079 gint64 arg2
= va_arg(args
, gint64
);
1080 gboolean arg3
= va_arg(args
, gboolean
);
1082 ret_val
= ((gpointer(*)(void *, gint64
, gboolean
, void *))cb
)(arg1
, arg2
, arg3
, data
);
1084 if (return_val
!= NULL
)
1085 *return_val
= ret_val
;
1089 purple_marshal_POINTER__POINTER_POINTER(PurpleCallback cb
, va_list args
, void *data
,
1093 void *arg1
= va_arg(args
, void *);
1094 void *arg2
= va_arg(args
, void *);
1096 ret_val
= ((gpointer (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
1098 if (return_val
!= NULL
)
1099 *return_val
= ret_val
;