3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 /* must include this to use G_VA_COPY */
36 gulong next_signal_id
;
44 PurpleSignalMarshalFunc marshal
;
53 gulong next_handler_id
;
65 } PurpleSignalHandlerData
;
67 static GHashTable
*instance_table
= NULL
;
70 destroy_instance_data(PurpleInstanceData
*instance_data
)
72 g_hash_table_destroy(instance_data
->signals
);
74 g_free(instance_data
);
78 destroy_signal_data(PurpleSignalData
*signal_data
)
80 g_list_free_full(signal_data
->handlers
, g_free
);
81 g_free(signal_data
->value_types
);
86 purple_signal_register(void *instance
, const char *signal
,
87 PurpleSignalMarshalFunc marshal
,
88 GType ret_type
, int num_values
, ...)
90 PurpleInstanceData
*instance_data
;
91 PurpleSignalData
*signal_data
;
94 g_return_val_if_fail(instance
!= NULL
, 0);
95 g_return_val_if_fail(signal
!= NULL
, 0);
96 g_return_val_if_fail(marshal
!= NULL
, 0);
99 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
101 if (instance_data
== NULL
)
103 instance_data
= g_new0(PurpleInstanceData
, 1);
105 instance_data
->instance
= instance
;
106 instance_data
->next_signal_id
= 1;
108 instance_data
->signals
=
109 g_hash_table_new_full(g_str_hash
, g_str_equal
, g_free
,
110 (GDestroyNotify
)destroy_signal_data
);
112 g_hash_table_insert(instance_table
, instance
, instance_data
);
115 signal_data
= g_new0(PurpleSignalData
, 1);
116 signal_data
->id
= instance_data
->next_signal_id
;
117 signal_data
->marshal
= marshal
;
118 signal_data
->next_handler_id
= 1;
119 signal_data
->ret_type
= ret_type
;
120 signal_data
->num_values
= num_values
;
126 signal_data
->value_types
= g_new0(GType
, num_values
);
128 va_start(args
, num_values
);
130 for (i
= 0; i
< num_values
; i
++)
131 signal_data
->value_types
[i
] = va_arg(args
, GType
);
136 g_hash_table_insert(instance_data
->signals
,
137 g_strdup(signal
), signal_data
);
139 instance_data
->next_signal_id
++;
140 instance_data
->signal_count
++;
142 return signal_data
->id
;
146 purple_signal_unregister(void *instance
, const char *signal
)
148 PurpleInstanceData
*instance_data
;
150 g_return_if_fail(instance
!= NULL
);
151 g_return_if_fail(signal
!= NULL
);
154 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
156 g_return_if_fail(instance_data
!= NULL
);
158 g_hash_table_remove(instance_data
->signals
, signal
);
160 instance_data
->signal_count
--;
162 if (instance_data
->signal_count
== 0)
164 /* Unregister the instance. */
165 g_hash_table_remove(instance_table
, instance
);
170 purple_signals_unregister_by_instance(void *instance
)
172 g_return_if_fail(instance
!= NULL
);
174 g_hash_table_remove(instance_table
, instance
);
177 * Makes things easier (more annoying?) for developers who don't have
178 * things registering and unregistering in the right order :)
180 /* g_return_if_fail(found); */
184 purple_signal_get_types(void *instance
, const char *signal
,
186 int *num_values
, GType
**value_types
)
188 PurpleInstanceData
*instance_data
;
189 PurpleSignalData
*signal_data
;
191 g_return_if_fail(instance
!= NULL
);
192 g_return_if_fail(signal
!= NULL
);
193 g_return_if_fail(num_values
!= NULL
);
194 g_return_if_fail(value_types
!= NULL
);
196 /* Get the instance data */
198 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
200 g_return_if_fail(instance_data
!= NULL
);
202 /* Get the signal data */
204 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
206 g_return_if_fail(signal_data
!= NULL
);
208 *num_values
= signal_data
->num_values
;
209 *value_types
= signal_data
->value_types
;
211 if (ret_type
!= NULL
)
212 *ret_type
= signal_data
->ret_type
;
215 static gint
handler_priority(void * a
, void * b
) {
216 PurpleSignalHandlerData
*ah
= (PurpleSignalHandlerData
*)a
;
217 PurpleSignalHandlerData
*bh
= (PurpleSignalHandlerData
*)b
;
218 if (ah
->priority
> bh
->priority
) return 1;
219 if (ah
->priority
< bh
->priority
) return -1;
224 signal_connect_common(void *instance
, const char *signal
, void *handle
,
225 PurpleCallback func
, void *data
, int priority
, gboolean use_vargs
)
227 PurpleInstanceData
*instance_data
;
228 PurpleSignalData
*signal_data
;
229 PurpleSignalHandlerData
*handler_data
;
231 g_return_val_if_fail(instance
!= NULL
, 0);
232 g_return_val_if_fail(signal
!= NULL
, 0);
233 g_return_val_if_fail(handle
!= NULL
, 0);
234 g_return_val_if_fail(func
!= NULL
, 0);
236 /* Get the instance data */
238 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
240 if (instance_data
== NULL
)
242 purple_debug_warning("signals", "Something tried to register a callback "
243 "for the '%s' signal, but we do not have any signals "
244 "registered with the given handle\n", signal
);
245 g_return_val_if_reached(0);
248 /* Get the signal data */
250 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
252 if (signal_data
== NULL
)
254 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
255 "Signal data for %s not found!\n", signal
);
259 /* Create the signal handler data */
260 handler_data
= g_new0(PurpleSignalHandlerData
, 1);
261 handler_data
->id
= signal_data
->next_handler_id
;
262 handler_data
->cb
= func
;
263 handler_data
->handle
= handle
;
264 handler_data
->data
= data
;
265 handler_data
->use_vargs
= use_vargs
;
266 handler_data
->priority
= priority
;
268 signal_data
->handlers
= g_list_insert_sorted(signal_data
->handlers
, handler_data
, (GCompareFunc
)handler_priority
);
269 signal_data
->handler_count
++;
270 signal_data
->next_handler_id
++;
272 return handler_data
->id
;
276 purple_signal_connect_priority(void *instance
, const char *signal
, void *handle
,
277 PurpleCallback func
, void *data
, int priority
)
279 return signal_connect_common(instance
, signal
, handle
, func
, data
, priority
, FALSE
);
283 purple_signal_connect(void *instance
, const char *signal
, void *handle
,
284 PurpleCallback func
, void *data
)
286 return signal_connect_common(instance
, signal
, handle
, func
, data
, PURPLE_SIGNAL_PRIORITY_DEFAULT
, FALSE
);
290 purple_signal_connect_priority_vargs(void *instance
, const char *signal
, void *handle
,
291 PurpleCallback func
, void *data
, int priority
)
293 return signal_connect_common(instance
, signal
, handle
, func
, data
, priority
, TRUE
);
297 purple_signal_connect_vargs(void *instance
, const char *signal
, void *handle
,
298 PurpleCallback func
, void *data
)
300 return signal_connect_common(instance
, signal
, handle
, func
, data
, PURPLE_SIGNAL_PRIORITY_DEFAULT
, TRUE
);
304 purple_signal_disconnect(void *instance
, const char *signal
,
305 void *handle
, PurpleCallback func
)
307 PurpleInstanceData
*instance_data
;
308 PurpleSignalData
*signal_data
;
309 PurpleSignalHandlerData
*handler_data
;
311 gboolean found
= FALSE
;
313 g_return_if_fail(instance
!= NULL
);
314 g_return_if_fail(signal
!= NULL
);
315 g_return_if_fail(handle
!= NULL
);
316 g_return_if_fail(func
!= NULL
);
318 /* Get the instance data */
320 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
322 g_return_if_fail(instance_data
!= NULL
);
324 /* Get the signal data */
326 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
328 if (signal_data
== NULL
)
330 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
331 "Signal data for %s not found!\n", signal
);
335 /* Find the handler data. */
336 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l
->next
)
338 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
340 if (handler_data
->handle
== handle
&& handler_data
->cb
== func
)
342 g_free(handler_data
);
344 signal_data
->handlers
= g_list_delete_link(signal_data
->handlers
,
346 signal_data
->handler_count
--;
354 /* See note somewhere about this actually helping developers.. */
355 g_return_if_fail(found
);
359 * TODO: Make this all more efficient by storing a list of handlers, keyed
363 disconnect_handle_from_signals(const char *signal
,
364 PurpleSignalData
*signal_data
, void *handle
)
367 PurpleSignalHandlerData
*handler_data
;
369 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
371 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
374 if (handler_data
->handle
== handle
)
376 g_free(handler_data
);
378 signal_data
->handler_count
--;
379 signal_data
->handlers
= g_list_delete_link(signal_data
->handlers
,
386 disconnect_handle_from_instance(void *instance
,
387 PurpleInstanceData
*instance_data
,
390 g_hash_table_foreach(instance_data
->signals
,
391 (GHFunc
)disconnect_handle_from_signals
, handle
);
395 purple_signals_disconnect_by_handle(void *handle
)
397 g_return_if_fail(handle
!= NULL
);
399 g_hash_table_foreach(instance_table
,
400 (GHFunc
)disconnect_handle_from_instance
, handle
);
404 purple_signal_emit(void *instance
, const char *signal
, ...)
408 g_return_if_fail(instance
!= NULL
);
409 g_return_if_fail(signal
!= NULL
);
411 va_start(args
, signal
);
412 purple_signal_emit_vargs(instance
, signal
, args
);
417 purple_signal_emit_vargs(void *instance
, const char *signal
, va_list args
)
419 PurpleInstanceData
*instance_data
;
420 PurpleSignalData
*signal_data
;
421 PurpleSignalHandlerData
*handler_data
;
425 g_return_if_fail(instance
!= NULL
);
426 g_return_if_fail(signal
!= NULL
);
429 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
431 g_return_if_fail(instance_data
!= NULL
);
434 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
436 if (signal_data
== NULL
)
438 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
439 "Signal data for %s not found!\n", signal
);
443 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
447 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
449 /* This is necessary because a va_list may only be
451 G_VA_COPY(tmp
, args
);
453 if (handler_data
->use_vargs
)
455 ((void (*)(va_list, void *))handler_data
->cb
)(tmp
,
460 signal_data
->marshal(handler_data
->cb
, tmp
,
461 handler_data
->data
, NULL
);
469 purple_signal_emit_return_1(void *instance
, const char *signal
, ...)
474 g_return_val_if_fail(instance
!= NULL
, NULL
);
475 g_return_val_if_fail(signal
!= NULL
, NULL
);
477 va_start(args
, signal
);
478 ret_val
= purple_signal_emit_vargs_return_1(instance
, signal
, args
);
485 purple_signal_emit_vargs_return_1(void *instance
, const char *signal
,
488 PurpleInstanceData
*instance_data
;
489 PurpleSignalData
*signal_data
;
490 PurpleSignalHandlerData
*handler_data
;
494 g_return_val_if_fail(instance
!= NULL
, NULL
);
495 g_return_val_if_fail(signal
!= NULL
, NULL
);
498 (PurpleInstanceData
*)g_hash_table_lookup(instance_table
, instance
);
500 g_return_val_if_fail(instance_data
!= NULL
, NULL
);
503 (PurpleSignalData
*)g_hash_table_lookup(instance_data
->signals
, signal
);
505 if (signal_data
== NULL
)
507 purple_debug(PURPLE_DEBUG_ERROR
, "signals",
508 "Signal data for %s not found!\n", signal
);
512 for (l
= signal_data
->handlers
; l
!= NULL
; l
= l_next
)
514 void *ret_val
= NULL
;
518 handler_data
= (PurpleSignalHandlerData
*)l
->data
;
520 G_VA_COPY(tmp
, args
);
521 if (handler_data
->use_vargs
)
523 ret_val
= ((void *(*)(va_list, void *))handler_data
->cb
)(
524 tmp
, handler_data
->data
);
528 signal_data
->marshal(handler_data
->cb
, tmp
,
529 handler_data
->data
, &ret_val
);
541 purple_signals_init()
543 g_return_if_fail(instance_table
== NULL
);
546 g_hash_table_new_full(g_direct_hash
, g_direct_equal
,
547 NULL
, (GDestroyNotify
)destroy_instance_data
);
551 purple_signals_uninit()
553 g_return_if_fail(instance_table
!= NULL
);
555 g_hash_table_destroy(instance_table
);
556 instance_table
= NULL
;
559 /**************************************************************************
561 **************************************************************************/
563 purple_marshal_VOID(PurpleCallback cb
, va_list args
, void *data
,
566 ((void (*)(void *))cb
)(data
);
570 purple_marshal_VOID__INT(PurpleCallback cb
, va_list args
, void *data
,
573 gint arg1
= va_arg(args
, gint
);
575 ((void (*)(gint
, void *))cb
)(arg1
, data
);
579 purple_marshal_VOID__INT_INT(PurpleCallback cb
, va_list args
, void *data
,
582 gint arg1
= va_arg(args
, gint
);
583 gint arg2
= va_arg(args
, gint
);
585 ((void (*)(gint
, gint
, void *))cb
)(arg1
, arg2
, data
);
589 purple_marshal_VOID__POINTER(PurpleCallback cb
, va_list args
, void *data
,
592 void *arg1
= va_arg(args
, void *);
594 ((void (*)(void *, void *))cb
)(arg1
, data
);
598 purple_marshal_VOID__POINTER_UINT(PurpleCallback cb
, va_list args
,
599 void *data
, void **return_val
)
601 void *arg1
= va_arg(args
, void *);
602 guint arg2
= va_arg(args
, guint
);
604 ((void (*)(void *, guint
, void *))cb
)(arg1
, arg2
, data
);
607 void purple_marshal_VOID__POINTER_INT_INT(PurpleCallback cb
, va_list args
,
608 void *data
, void **return_val
)
610 void *arg1
= va_arg(args
, void *);
611 gint arg2
= va_arg(args
, gint
);
612 gint arg3
= va_arg(args
, gint
);
614 ((void (*)(void *, gint
, gint
, void *))cb
)(arg1
, arg2
, arg3
, data
);
617 void purple_marshal_VOID__POINTER_INT_POINTER(PurpleCallback cb
, va_list args
,
618 void *data
, void **return_val
)
620 void *arg1
= va_arg(args
, void *);
621 gint arg2
= va_arg(args
, gint
);
622 void *arg3
= va_arg(args
, void *);
624 ((void (*)(void *, gint
, void *, void *))cb
)(arg1
, arg2
, arg3
, data
);
628 purple_marshal_VOID__POINTER_POINTER(PurpleCallback cb
, va_list args
,
629 void *data
, void **return_val
)
631 void *arg1
= va_arg(args
, void *);
632 void *arg2
= va_arg(args
, void *);
634 ((void (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
638 purple_marshal_VOID__POINTER_POINTER_UINT(PurpleCallback cb
, va_list args
,
639 void *data
, void **return_val
)
641 void *arg1
= va_arg(args
, void *);
642 void *arg2
= va_arg(args
, void *);
643 guint arg3
= va_arg(args
, guint
);
645 ((void (*)(void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, data
);
649 purple_marshal_VOID__POINTER_POINTER_UINT_UINT(PurpleCallback cb
, va_list args
,
650 void *data
, void **return_val
)
652 void *arg1
= va_arg(args
, void *);
653 void *arg2
= va_arg(args
, void *);
654 guint arg3
= va_arg(args
, guint
);
655 guint arg4
= va_arg(args
, guint
);
657 ((void (*)(void *, void *, guint
, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
661 purple_marshal_VOID__POINTER_UINT_UINT(PurpleCallback cb
, va_list args
,
662 void *data
, void **return_val
)
664 void *arg1
= va_arg(args
, void *);
665 guint arg2
= va_arg(args
, guint
);
666 guint arg3
= va_arg(args
, guint
);
668 ((void (*)(void *, guint
, guint
, void *))cb
)(arg1
, arg2
, arg3
, data
);
672 purple_marshal_VOID__POINTER_POINTER_POINTER(PurpleCallback cb
, va_list args
,
673 void *data
, void **return_val
)
675 void *arg1
= va_arg(args
, void *);
676 void *arg2
= va_arg(args
, void *);
677 void *arg3
= va_arg(args
, void *);
679 ((void (*)(void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, data
);
683 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
688 void *arg1
= va_arg(args
, void *);
689 void *arg2
= va_arg(args
, void *);
690 void *arg3
= va_arg(args
, void *);
691 void *arg4
= va_arg(args
, void *);
693 ((void (*)(void *, void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
697 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
702 void *arg1
= va_arg(args
, void *);
703 void *arg2
= va_arg(args
, void *);
704 void *arg3
= va_arg(args
, void *);
705 void *arg4
= va_arg(args
, void *);
706 void *arg5
= va_arg(args
, void *);
708 ((void (*)(void *, void *, void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, arg4
, arg5
, data
);
712 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
717 void *arg1
= va_arg(args
, void *);
718 void *arg2
= va_arg(args
, void *);
719 void *arg3
= va_arg(args
, void *);
720 guint arg4
= va_arg(args
, guint
);
722 ((void (*)(void *, void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, data
);
726 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
731 void *arg1
= va_arg(args
, void *);
732 void *arg2
= va_arg(args
, void *);
733 void *arg3
= va_arg(args
, void *);
734 void *arg4
= va_arg(args
, void *);
735 guint arg5
= va_arg(args
, guint
);
737 ((void (*)(void *, void *, void *, void *, guint
, void *))cb
)(arg1
, arg2
, arg3
, arg4
, arg5
, data
);
741 purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT(PurpleCallback cb
,
746 void *arg1
= va_arg(args
, void *);
747 void *arg2
= va_arg(args
, void *);
748 void *arg3
= va_arg(args
, void *);
749 guint arg4
= va_arg(args
, guint
);
750 guint arg5
= va_arg(args
, guint
);
752 ((void (*)(void *, void *, void *, guint
, guint
, void *))cb
)(
753 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
757 purple_marshal_INT__INT(PurpleCallback cb
, va_list args
, void *data
,
761 gint arg1
= va_arg(args
, gint
);
763 ret_val
= ((gint (*)(gint
, void *))cb
)(arg1
, data
);
765 if (return_val
!= NULL
)
766 *return_val
= GINT_TO_POINTER(ret_val
);
770 purple_marshal_INT__INT_INT(PurpleCallback cb
, va_list args
, void *data
,
774 gint arg1
= va_arg(args
, gint
);
775 gint arg2
= va_arg(args
, gint
);
777 ret_val
= ((gint (*)(gint
, gint
, void *))cb
)(arg1
, arg2
, data
);
779 if (return_val
!= NULL
)
780 *return_val
= GINT_TO_POINTER(ret_val
);
784 purple_marshal_INT__POINTER_POINTER(PurpleCallback cb
, va_list args
, void *data
,
788 void *arg1
= va_arg(args
, void *);
789 void *arg2
= va_arg(args
, void *);
791 ret_val
= ((gint (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
793 if (return_val
!= NULL
)
794 *return_val
= GINT_TO_POINTER(ret_val
);
798 purple_marshal_INT__POINTER_POINTER_POINTER(
799 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
802 void *arg1
= va_arg(args
, void *);
803 void *arg2
= va_arg(args
, void *);
804 void *arg3
= va_arg(args
, void *);
806 ret_val
= ((gint (*)(void *, void *, void *, void *))cb
)(arg1
, arg2
, arg3
, data
);
808 if (return_val
!= NULL
)
809 *return_val
= GINT_TO_POINTER(ret_val
);
813 purple_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER(
814 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
817 void *arg1
= va_arg(args
, void *);
818 void *arg2
= va_arg(args
, void *);
819 void *arg3
= va_arg(args
, void *);
820 void *arg4
= va_arg(args
, void *);
821 void *arg5
= va_arg(args
, void *);
824 ((gint (*)(void *, void *, void *, void *, void *, void *))cb
)(
825 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
827 if (return_val
!= NULL
)
828 *return_val
= GINT_TO_POINTER(ret_val
);
832 purple_marshal_BOOLEAN__POINTER(PurpleCallback cb
, va_list args
, void *data
,
836 void *arg1
= va_arg(args
, void *);
838 ret_val
= ((gboolean (*)(void *, void *))cb
)(arg1
, data
);
840 if (return_val
!= NULL
)
841 *return_val
= GINT_TO_POINTER(ret_val
);
845 purple_marshal_BOOLEAN__POINTER_POINTER(PurpleCallback cb
, va_list args
,
846 void *data
, void **return_val
)
849 void *arg1
= va_arg(args
, void *);
850 void *arg2
= va_arg(args
, void *);
852 ret_val
= ((gboolean (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
854 if (return_val
!= NULL
)
855 *return_val
= GINT_TO_POINTER(ret_val
);
859 purple_marshal_BOOLEAN__POINTER_BOOLEAN(PurpleCallback cb
, va_list args
,
860 void *data
, void **return_val
)
863 void *arg1
= va_arg(args
, void *);
864 gboolean arg2
= va_arg(args
, gboolean
);
866 ret_val
= ((gboolean (*)(void *, gboolean
, void *))cb
)(arg1
, arg2
, data
);
868 if (return_val
!= NULL
)
869 *return_val
= GINT_TO_POINTER(ret_val
);
873 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER(PurpleCallback cb
, va_list args
,
874 void *data
, void **return_val
)
877 void *arg1
= va_arg(args
, void *);
878 void *arg2
= va_arg(args
, void *);
879 void *arg3
= va_arg(args
, void *);
881 ret_val
= ((gboolean (*)(void *, void *, void *, void *))cb
)(arg1
, arg2
,
884 if (return_val
!= NULL
)
885 *return_val
= GINT_TO_POINTER(ret_val
);
889 purple_marshal_BOOLEAN__POINTER_POINTER_UINT(PurpleCallback cb
,
895 void *arg1
= va_arg(args
, void *);
896 void *arg2
= va_arg(args
, void *);
897 guint arg3
= va_arg(args
, guint
);
899 ret_val
= ((gboolean (*)(void *, void *, guint
, void *))cb
)(
900 arg1
, arg2
, arg3
, data
);
902 if (return_val
!= NULL
)
903 *return_val
= GINT_TO_POINTER(ret_val
);
907 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_UINT(PurpleCallback cb
,
913 void *arg1
= va_arg(args
, void *);
914 void *arg2
= va_arg(args
, void *);
915 void *arg3
= va_arg(args
, void *);
916 guint arg4
= va_arg(args
, guint
);
918 ret_val
= ((gboolean (*)(void *, void *, void *, guint
, void *))cb
)(
919 arg1
, arg2
, arg3
, arg4
, data
);
921 if (return_val
!= NULL
)
922 *return_val
= GINT_TO_POINTER(ret_val
);
926 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER(PurpleCallback cb
,
932 void *arg1
= va_arg(args
, void *);
933 void *arg2
= va_arg(args
, void *);
934 void *arg3
= va_arg(args
, void *);
935 void *arg4
= va_arg(args
, void *);
937 ret_val
= ((gboolean (*)(void *, void *, void *, void *, void *))cb
)(
938 arg1
, arg2
, arg3
, arg4
, data
);
940 if (return_val
!= NULL
)
941 *return_val
= GINT_TO_POINTER(ret_val
);
945 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER(
946 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
949 void *arg1
= va_arg(args
, void *);
950 void *arg2
= va_arg(args
, void *);
951 void *arg3
= va_arg(args
, void *);
952 void *arg4
= va_arg(args
, void *);
953 void *arg5
= va_arg(args
, void *);
956 ((gboolean (*)(void *, void *, void *, void *, void *, void *))cb
)(
957 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
959 if (return_val
!= NULL
)
960 *return_val
= GINT_TO_POINTER(ret_val
);
964 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_UINT(
965 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
968 void *arg1
= va_arg(args
, void *);
969 void *arg2
= va_arg(args
, void *);
970 void *arg3
= va_arg(args
, void *);
971 void *arg4
= va_arg(args
, void *);
972 guint arg5
= va_arg(args
, guint
);
975 ((gboolean (*)(void *, void *, void *, void *, guint
, void *))cb
)(
976 arg1
, arg2
, arg3
, arg4
, arg5
, data
);
978 if (return_val
!= NULL
)
979 *return_val
= GINT_TO_POINTER(ret_val
);
983 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER_POINTER(
984 PurpleCallback cb
, va_list args
, void *data
, void **return_val
)
987 void *arg1
= va_arg(args
, void *);
988 void *arg2
= va_arg(args
, void *);
989 void *arg3
= va_arg(args
, void *);
990 void *arg4
= va_arg(args
, void *);
991 void *arg5
= va_arg(args
, void *);
992 void *arg6
= va_arg(args
, void *);
995 ((gboolean (*)(void *, void *, void *, void *, void *, void *, void *))cb
)(
996 arg1
, arg2
, arg3
, arg4
, arg5
, arg6
, data
);
998 if (return_val
!= NULL
)
999 *return_val
= GINT_TO_POINTER(ret_val
);
1003 purple_marshal_BOOLEAN__INT_POINTER(PurpleCallback cb
, va_list args
, void *data
,
1007 gint arg1
= va_arg(args
, gint
);
1008 void *arg2
= va_arg(args
, void *);
1010 ret_val
= ((gboolean (*)(gint
, void *, void *))cb
)(arg1
, arg2
, data
);
1012 if (return_val
!= NULL
)
1013 *return_val
= GINT_TO_POINTER(ret_val
);
1017 purple_marshal_POINTER__POINTER(
1018 PurpleCallback cb
, va_list args
, void *data
,
1022 void *arg1
= va_arg(args
, void *);
1024 ret_val
= ((gpointer(*)(void *, void *))cb
)(arg1
, data
);
1026 if (return_val
!= NULL
)
1027 *return_val
= ret_val
;
1032 purple_marshal_POINTER__POINTER_INT(
1033 PurpleCallback cb
, va_list args
, void *data
,
1037 void *arg1
= va_arg(args
, void *);
1038 gint arg2
= va_arg(args
, gint
);
1040 ret_val
= ((gpointer(*)(void *, gint
, void *))cb
)(arg1
, arg2
, data
);
1042 if (return_val
!= NULL
)
1043 *return_val
= ret_val
;
1047 purple_marshal_POINTER__POINTER_INT64(
1048 PurpleCallback cb
, va_list args
, void *data
,
1052 void *arg1
= va_arg(args
, void *);
1053 gint64 arg2
= va_arg(args
, gint64
);
1055 ret_val
= ((gpointer(*)(void *, gint64
, void *))cb
)(arg1
, arg2
, data
);
1057 if (return_val
!= NULL
)
1058 *return_val
= ret_val
;
1062 purple_marshal_POINTER__POINTER_INT_BOOLEAN(
1063 PurpleCallback cb
, va_list args
, void *data
,
1067 void *arg1
= va_arg(args
, void *);
1068 gint arg2
= va_arg(args
, gint
);
1069 gboolean arg3
= va_arg(args
, gboolean
);
1071 ret_val
= ((gpointer(*)(void *, gint
, gboolean
, void *))cb
)(arg1
, arg2
, arg3
, data
);
1073 if (return_val
!= NULL
)
1074 *return_val
= ret_val
;
1078 purple_marshal_POINTER__POINTER_INT64_BOOLEAN(
1079 PurpleCallback cb
, va_list args
, void *data
,
1083 void *arg1
= va_arg(args
, void *);
1084 gint64 arg2
= va_arg(args
, gint64
);
1085 gboolean arg3
= va_arg(args
, gboolean
);
1087 ret_val
= ((gpointer(*)(void *, gint64
, gboolean
, void *))cb
)(arg1
, arg2
, arg3
, data
);
1089 if (return_val
!= NULL
)
1090 *return_val
= ret_val
;
1094 purple_marshal_POINTER__POINTER_POINTER_BOOLEAN(
1095 PurpleCallback cb
, va_list args
, void *data
,
1099 void *arg1
= va_arg(args
, void *);
1100 void *arg2
= va_arg(args
, void *);
1101 gboolean arg3
= va_arg(args
, gboolean
);
1103 ret_val
= ((gpointer(*)(void *, void *, gboolean
, void *))cb
)(arg1
, arg2
, arg3
, data
);
1105 if (return_val
!= NULL
)
1106 *return_val
= ret_val
;
1110 purple_marshal_POINTER__POINTER_POINTER(PurpleCallback cb
, va_list args
, void *data
,
1114 void *arg1
= va_arg(args
, void *);
1115 void *arg2
= va_arg(args
, void *);
1117 ret_val
= ((gpointer (*)(void *, void *, void *))cb
)(arg1
, arg2
, data
);
1119 if (return_val
!= NULL
)
1120 *return_val
= ret_val
;