pidgin/pidgin

Use G_DECLARE_FINAL_TYPE for the IRCProtocol

13 months ago, Gary Kramlich
f214e91df169
Parents f1b7c03f6cc7
Children e4b7dd31c64c
Use G_DECLARE_FINAL_TYPE for the IRCProtocol

Testing Done:
Connected an IRC account.

Reviewed at https://reviews.imfreedom.org/r/616/
--- a/libpurple/protocols/irc/irc.c Fri Apr 16 02:26:36 2021 -0500
+++ b/libpurple/protocols/irc/irc.c Fri Apr 16 02:27:14 2021 -0500
@@ -31,6 +31,10 @@
#define PING_TIMEOUT 60
+struct _IRCProtocol {
+ PurpleProtocol parent;
+};
+
static void irc_ison_buddy_init(char *name, struct irc_buddy *ib, GList **list);
static const char *irc_blist_icon(PurpleAccount *a, PurpleBuddy *b);
--- a/libpurple/protocols/irc/irc.h Fri Apr 16 02:26:36 2021 -0500
+++ b/libpurple/protocols/irc/irc.h Fri Apr 16 02:27:14 2021 -0500
@@ -32,12 +32,8 @@
#include <purple.h>
-#define IRC_TYPE_PROTOCOL (irc_protocol_get_type())
-#define IRC_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IRC_TYPE_PROTOCOL, IRCProtocol))
-#define IRC_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IRC_TYPE_PROTOCOL, IRCProtocolClass))
-#define IRC_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IRC_TYPE_PROTOCOL))
-#define IRC_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IRC_TYPE_PROTOCOL))
-#define IRC_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IRC_TYPE_PROTOCOL, IRCProtocolClass))
+#define IRC_TYPE_PROTOCOL (irc_protocol_get_type())
+G_DECLARE_FINAL_TYPE(IRCProtocol, irc_protocol, IRC, PROTOCOL, PurpleProtocol)
#define IRC_DEFAULT_SERVER "irc.freenode.net"
#define IRC_DEFAULT_PORT 6667
@@ -59,16 +55,6 @@
enum { IRC_USEROPT_SERVER, IRC_USEROPT_PORT, IRC_USEROPT_CHARSET };
enum irc_state { IRC_STATE_NEW, IRC_STATE_ESTABLISHED };
-typedef struct
-{
- PurpleProtocol parent;
-} IRCProtocol;
-
-typedef struct
-{
- PurpleProtocolClass parent_class;
-} IRCProtocolClass;
-
struct irc_conn {
PurpleAccount *account;
GHashTable *msgs;
@@ -124,14 +110,12 @@
char *name;
gboolean online;
gboolean flag;
- gboolean new_online_status;
+ gboolean new_online_status;
int ref;
};
typedef int (*IRCCmdCallback) (struct irc_conn *irc, const char *cmd, const char *target, const char **args);
-G_MODULE_EXPORT GType irc_protocol_get_type(void);
-
int irc_send(struct irc_conn *irc, const char *buf);
int irc_send_len(struct irc_conn *irc, const char *buf, int len);
gboolean irc_blist_timeout(struct irc_conn *irc);