From: David Woodhouse Date: Thu, 5 Apr 2018 13:48:39 +0000 (+0100) Subject: Stop using purple headers, make cxn->prpl_conn a 'void *'. X-Git-Tag: v0.9~36 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7e1560ab56437c9cde8857e5214fb9d9f47df5b9;p=pidgin-chime.git Stop using purple headers, make cxn->prpl_conn a 'void *'. It's only used by the login code now, which is going to be cleaned up. For now though let's just make it a void pointer. --- diff --git a/Makefile.am b/Makefile.am index ab1f79b..f7908d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,8 +33,8 @@ CHIME_SRCS = chime/chime-connection.c chime/chime-connection.h \ noinst_LTLIBRARIES = libchime.la libchime_la_SOURCES = $(CHIME_SRCS) $(WEBSOCKET_SRCS) $(PROTOBUF_SRCS) -libchime_la_CFLAGS = $(PURPLE_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(LIBXML_CFLAGS) $(PROTOBUF_CFLAGS) $(MARKDOWN_CFLAGS) $(GSTREAMER_CFLAGS) -Ichime -libchime_la_LIBADD = $(PURPLE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(LIBXML_LIBS) $(PROTOBUF_LIBS) $(MARKDOWN_LIBS) $(GSTREAMER_LIBS) +libchime_la_CFLAGS = $(SOUP_CFLAGS) $(JSON_CFLAGS) $(LIBXML_CFLAGS) $(PROTOBUF_CFLAGS) $(MARKDOWN_CFLAGS) $(GSTREAMER_CFLAGS) -Ichime +libchime_la_LIBADD = $(SOUP_LIBS) $(JSON_LIBS) $(LIBXML_LIBS) $(PROTOBUF_LIBS) $(MARKDOWN_LIBS) $(GSTREAMER_LIBS) libchime_la_LDFLAGS = -module -avoid-version -no-undefined libchimeprpl_la_SOURCES = $(PRPL_SRCS) $(LOGIN_SRCS) diff --git a/chime/chime-connection-private.h b/chime/chime-connection-private.h index 06b7e5e..14f2dd7 100644 --- a/chime/chime-connection-private.h +++ b/chime/chime-connection-private.h @@ -28,6 +28,9 @@ #include +#include +#include + #ifndef USE_LIBSOUP_WEBSOCKETS #include "chime-websocket-connection.h" @@ -228,7 +231,6 @@ void chime_jugg_subscribe(ChimeConnection *cxn, const gchar *channel, void chime_jugg_unsubscribe(ChimeConnection *cxn, const gchar *channel, const gchar *klass, JuggernautCallback cb, gpointer cb_data); -void chime_purple_keepalive(PurpleConnection *conn); /* chime-rooms.c */ void chime_init_rooms(ChimeConnection *cxn); diff --git a/chime/chime-connection.c b/chime/chime-connection.c index 59ba14e..f2b8901 100644 --- a/chime/chime-connection.c +++ b/chime/chime-connection.c @@ -336,14 +336,14 @@ chime_connection_init(ChimeConnection *self) #define SIGNIN_DEFAULT "https://signin.id.ue1.app.chime.aws/" ChimeConnection * -chime_connection_new(PurpleConnection *connection, const gchar *server, +chime_connection_new(void *prpl_conn, const gchar *server, const gchar *device_token, const gchar *session_token) { if (!server || !*server) server = SIGNIN_DEFAULT; return g_object_new (CHIME_TYPE_CONNECTION, - "purple-connection", connection, + "purple-connection", prpl_conn, "server", server ? server : SIGNIN_DEFAULT, "device-token", device_token, "session-token", session_token, diff --git a/chime/chime-connection.h b/chime/chime-connection.h index 83970ff..21f668f 100644 --- a/chime/chime-connection.h +++ b/chime/chime-connection.h @@ -19,7 +19,6 @@ #define __CHIME_CONNECTION_H__ #include -#include #include #include @@ -31,7 +30,7 @@ G_DECLARE_FINAL_TYPE (ChimeConnection, chime_connection, CHIME, CONNECTION, GObj struct _ChimeConnection { GObject parent_instance; - PurpleConnection *prpl_conn; + void *prpl_conn; }; #define CHIME_ERROR (chime_error_quark()) @@ -58,7 +57,7 @@ typedef void (*ChimeSoupMessageCallback)(ChimeConnection *cxn, JsonNode *node, gpointer cb_data); -ChimeConnection *chime_connection_new (PurpleConnection *connection, +ChimeConnection *chime_connection_new (void *prpl_conn, const gchar *server, const gchar *device_token, const gchar *session_token); diff --git a/login-amazon.c b/login-amazon.c index 33234ea..ebf51a1 100644 --- a/login-amazon.c +++ b/login-amazon.c @@ -136,8 +136,7 @@ static void request_credentials_with_fields(struct login_amzn *state, gboolean r PASS_TITLE, text, retry ? PASS_FAIL : NULL, fields, PASS_OK, G_CALLBACK(gather_credentials_and_send), PASS_CANCEL, G_CALLBACK(chime_login_cancel_ui), - login_connection(state)->prpl_conn->account, - NULL, NULL, state); + login_account(state), NULL, NULL, state); } static void request_credentials_with_input(struct login_amzn *state, gboolean retry) @@ -151,8 +150,7 @@ static void request_credentials_with_input(struct login_amzn *state, gboolean re FALSE, TRUE, (gchar *) "password", PASS_OK, G_CALLBACK(send_credentials), PASS_CANCEL, G_CALLBACK(chime_login_cancel_ui), - login_connection(state)->prpl_conn->account, - NULL, NULL, state); + login_account(state), NULL, NULL, state); } static void request_credentials(struct login_amzn *state, gboolean retry) diff --git a/login-private.h b/login-private.h index 85bd978..f639e99 100644 --- a/login-private.h +++ b/login-private.h @@ -59,8 +59,12 @@ void chime_login_warpdrive(SoupSession *sessioin, SoupMessage *msg, gpointer dat (((struct login *) (state))->session) #define login_connection(state) \ (((struct login *) (state))->connection) -#define login_account_email(state) \ - (((struct login *) (state))->connection->prpl_conn->account->username) +#define login_prplconn(state) \ + ((PurpleConnection *)login_connection(state)->prpl_conn) +#define login_account(state) \ + (login_prplconn(state)->account) +#define login_account_email(state) \ + (login_account(state)->username) #define login_fail_on_error(msg, state) \ do { \ diff --git a/login-warpdrive.c b/login-warpdrive.c index eb80e53..052eba1 100644 --- a/login-warpdrive.c +++ b/login-warpdrive.c @@ -342,8 +342,7 @@ static void request_credentials_with_fields(struct login_wd *state, gboolean ret retry ? AUTH_FAIL : NULL, fields, AUTH_SEND, G_CALLBACK(gather_credentials_and_send), AUTH_CANCEL, G_CALLBACK(chime_login_cancel_ui), - login_connection(state)->prpl_conn->account, - NULL, NULL, state); + login_account(state), NULL, NULL, state); } static void request_password_with_input(struct login_wd *state, const gchar *username) @@ -360,8 +359,7 @@ static void request_password_with_input(struct login_wd *state, const gchar *use NULL, FALSE, TRUE, (gchar *) "password", AUTH_SEND, G_CALLBACK(send_credentials), AUTH_CANCEL, G_CALLBACK(chime_login_cancel_ui), - login_connection(state)->prpl_conn->account, - NULL, NULL, state); + login_account(state), NULL, NULL, state); } static void request_username_with_input(struct login_wd *state, gboolean retry) @@ -371,8 +369,7 @@ static void request_username_with_input(struct login_wd *state, gboolean retry) NULL, FALSE, FALSE, NULL, _("OK"), G_CALLBACK(request_password_with_input), AUTH_CANCEL, G_CALLBACK(chime_login_cancel_ui), - login_connection(state)->prpl_conn->account, - NULL, NULL, state); + login_account(state), NULL, NULL, state); } static void request_credentials(struct login_wd *state, gboolean retry) diff --git a/prpl/chime.h b/prpl/chime.h index add68ea..219702a 100644 --- a/prpl/chime.h +++ b/prpl/chime.h @@ -20,6 +20,8 @@ #include +#include + #include #include