libpurple/protocol.h

branch
soc.2013.gobjectification.plugins
changeset 36570
d2c0bdfdad71
parent 36569
264e4c0cc0d1
child 36580
a356adba59e6
equal deleted inserted replaced
36569:264e4c0cc0d1 36570:d2c0bdfdad71
501 void (*get_public_alias)(PurpleConnection *gc, 501 void (*get_public_alias)(PurpleConnection *gc,
502 PurpleGetPublicAliasSuccessCallback success_cb, 502 PurpleGetPublicAliasSuccessCallback success_cb,
503 PurpleGetPublicAliasFailureCallback failure_cb); 503 PurpleGetPublicAliasFailureCallback failure_cb);
504 }; 504 };
505 505
506 /**
507 * Defines a protocol type using the CamelCase type name of the protocol and
508 * the function prefix for the *_get_type(), *_base_init(), *_base_finalize()
509 * and *_interface_init() functions of the protocol.
510 */
511 #define PURPLE_PROTOCOL_DEFINE(TypeName, func_prefix) \
512 GType func_prefix##_get_type(void) { \
513 static GType type = 0; \
514 if (type == 0) { \
515 static const GTypeInfo info = { \
516 .instance_size = sizeof(TypeName), \
517 .class_size = sizeof(TypeName##Class), \
518 .base_init = (GBaseInitFunc)func_prefix##_base_init, \
519 .base_finalize = (GBaseFinalizeFunc)func_prefix##_base_finalize, \
520 }; \
521 static const GInterfaceInfo iface_info = { \
522 .interface_init = (GInterfaceInitFunc)func_prefix##_interface_init, \
523 }; \
524 type = g_type_register_static(PURPLE_TYPE_PROTOCOL, #TypeName, \
525 &info, 0); \
526 g_type_add_interface_static(type, PURPLE_TYPE_PROTOCOL, &iface_info); \
527 } \
528 return type; \
529 }
530
506 G_BEGIN_DECLS 531 G_BEGIN_DECLS
507 532
508 /**************************************************************************/ 533 /**************************************************************************/
509 /** @name Protocol API */ 534 /** @name Protocol API */
510 /**************************************************************************/ 535 /**************************************************************************/

mercurial