pidgin/pidgin

Parents 9b65f18443aa
Children 32c1f097d4e8
Use the G_DECLARE_*_TYPE macros for JabberProtocol and XMPPProtocol

Testing Done:
Connected an XMPP account.

Reviewed at https://reviews.imfreedom.org/r/618/
--- a/libpurple/protocols/jabber/jabber.h Mon Apr 19 20:53:41 2021 -0500
+++ b/libpurple/protocols/jabber/jabber.h Mon Apr 19 20:55:45 2021 -0500
@@ -75,12 +75,9 @@
#define CAPS0115_NODE "https://pidgin.im/"
-#define JABBER_TYPE_PROTOCOL (jabber_protocol_get_type())
-#define JABBER_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), JABBER_TYPE_PROTOCOL, JabberProtocol))
-#define JABBER_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), JABBER_TYPE_PROTOCOL, JabberProtocolClass))
-#define JABBER_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), JABBER_TYPE_PROTOCOL))
-#define JABBER_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), JABBER_TYPE_PROTOCOL))
-#define JABBER_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), JABBER_TYPE_PROTOCOL, JabberProtocolClass))
+#define JABBER_TYPE_PROTOCOL (jabber_protocol_get_type())
+G_DECLARE_DERIVABLE_TYPE(JabberProtocol, jabber_protocol, JABBER, PROTOCOL,
+ PurpleProtocol)
#define JABBER_DEFAULT_REQUIRE_TLS "require_starttls"
@@ -97,15 +94,9 @@
JABBER_STREAM_CONNECTED
} JabberStreamState;
-typedef struct
-{
- PurpleProtocol parent;
-} JabberProtocol;
-
-typedef struct
-{
+struct _JabberProtocolClass {
PurpleProtocolClass parent_class;
-} JabberProtocolClass;
+};
struct _JabberStream
{
@@ -304,7 +295,6 @@
/**
* Returns the GType for the JabberProtocol object.
*/
-G_MODULE_EXPORT GType jabber_protocol_get_type(void);
void jabber_stream_features_parse(JabberStream *js, PurpleXmlNode *packet);
void jabber_process_packet(JabberStream *js, PurpleXmlNode **packet);
--- a/libpurple/protocols/jabber/xmpp.c Mon Apr 19 20:53:41 2021 -0500
+++ b/libpurple/protocols/jabber/xmpp.c Mon Apr 19 20:55:45 2021 -0500
@@ -28,6 +28,10 @@
#include "xmpp.h"
+struct _XMPPProtocol {
+ JabberProtocol parent;
+};
+
static GList *
xmpp_protocol_get_account_options(PurpleProtocol *protocol) {
PurpleAccountOption *option;
@@ -145,4 +149,4 @@
"options", options,
NULL
));
-}
\ No newline at end of file
+}
--- a/libpurple/protocols/jabber/xmpp.h Mon Apr 19 20:53:41 2021 -0500
+++ b/libpurple/protocols/jabber/xmpp.h Mon Apr 19 20:55:45 2021 -0500
@@ -27,22 +27,9 @@
#define XMPP_PROTOCOL_ID "prpl-jabber"
-#define XMPP_TYPE_PROTOCOL (xmpp_protocol_get_type())
-#define XMPP_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XMPP_TYPE_PROTOCOL, XMPPProtocol))
-#define XMPP_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XMPP_TYPE_PROTOCOL, XMPPProtocolClass))
-#define XMPP_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XMPP_TYPE_PROTOCOL))
-#define XMPP_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XMPP_TYPE_PROTOCOL))
-#define XMPP_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XMPP_TYPE_PROTOCOL, XMPPProtocolClass))
-
-typedef struct
-{
- JabberProtocol parent;
-} XMPPProtocol;
-
-typedef struct
-{
- JabberProtocolClass parent_class;
-} XMPPProtocolClass;
+#define XMPP_TYPE_PROTOCOL (xmpp_protocol_get_type())
+G_DECLARE_FINAL_TYPE(XMPPProtocol, xmpp_protocol, XMPP, PROTOCOL,
+ JabberProtocol)
/**
* Registers the XMPPProtocol type in the type system.
@@ -56,6 +43,5 @@
/**
* Returns the GType for the XMPPProtocol object.
*/
-G_MODULE_EXPORT GType xmpp_protocol_get_type(void);
#endif /* PURPLE_JABBER_XMPP_H */