--- a/libpurple/protocol.c Mon Jan 11 01:08:47 2021 -0600 +++ b/libpurple/protocol.c Mon Jan 11 01:51:14 2021 -0600 @@ -402,110 +402,3 @@ #undef DEFINE_PROTOCOL_FUNC_WITH_RETURN #undef DEFINE_PROTOCOL_FUNC - -/************************************************************************** - * Protocol Chat Interface API - **************************************************************************/ -#define DEFINE_PROTOCOL_FUNC(protocol,funcname,...) \ - PurpleProtocolChatInterface *chat_iface = \ - PURPLE_PROTOCOL_CHAT_GET_IFACE(protocol); \ - if (chat_iface && chat_iface->funcname) \ - chat_iface->funcname(__VA_ARGS__); - -#define DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol,defaultreturn,funcname,...) \ - PurpleProtocolChatInterface *chat_iface = \ - PURPLE_PROTOCOL_CHAT_GET_IFACE(protocol); \ - if (chat_iface && chat_iface->funcname) \ - return chat_iface->funcname(__VA_ARGS__); \ - else \ - return defaultreturn; - -GType -purple_protocol_chat_iface_get_type(void) -{ - static GType type = 0; - - if (G_UNLIKELY(type == 0)) { - static const GTypeInfo info = { - .class_size = sizeof(PurpleProtocolChatInterface), - }; - - type = g_type_register_static(G_TYPE_INTERFACE, - "PurpleProtocolChatInterface", &info, 0); - } - return type; -} - -GList * -purple_protocol_chat_iface_info(PurpleProtocol *protocol, PurpleConnection *gc) -{ - DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, info, gc); -} - -GHashTable * -purple_protocol_chat_iface_info_defaults(PurpleProtocol *protocol, - PurpleConnection *gc, const char *chat_name) -{ - DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, info_defaults, gc, - chat_name); -} - -void -purple_protocol_chat_iface_join(PurpleProtocol *protocol, PurpleConnection *gc, - GHashTable *components) -{ - DEFINE_PROTOCOL_FUNC(protocol, join, gc, components); -} - -void -purple_protocol_chat_iface_reject(PurpleProtocol *protocol, - PurpleConnection *gc, GHashTable *components) -{ - DEFINE_PROTOCOL_FUNC(protocol, reject, gc, components); -} - -char * -purple_protocol_chat_iface_get_name(PurpleProtocol *protocol, - GHashTable *components) -{ - DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, get_name, components); -} - -void -purple_protocol_chat_iface_invite(PurpleProtocol *protocol, - PurpleConnection *gc, int id, const char *message, const char *who) -{ - DEFINE_PROTOCOL_FUNC(protocol, invite, gc, id, message, who); -} - -void -purple_protocol_chat_iface_leave(PurpleProtocol *protocol, PurpleConnection *gc, - int id) -{ - DEFINE_PROTOCOL_FUNC(protocol, leave, gc, id); -} - -int -purple_protocol_chat_iface_send(PurpleProtocol *protocol, PurpleConnection *gc, - int id, PurpleMessage *msg) -{ - DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, 0, send, gc, id, msg); -} - -char * -purple_protocol_chat_iface_get_user_real_name(PurpleProtocol *protocol, - PurpleConnection *gc, int id, const char *who) -{ - DEFINE_PROTOCOL_FUNC_WITH_RETURN(protocol, NULL, get_user_real_name, gc, id, - who); -} - -void -purple_protocol_chat_iface_set_topic(PurpleProtocol *protocol, - PurpleConnection *gc, int id, const char *topic) -{ - DEFINE_PROTOCOL_FUNC(protocol, set_topic, gc, id, topic); -} - -#undef DEFINE_PROTOCOL_FUNC_WITH_RETURN -#undef DEFINE_PROTOCOL_FUNC