--- a/meson.build Mon Nov 12 14:35:10 2018 -0600
+++ b/meson.build Mon Sep 30 22:55:04 2019 -0500
@@ -8,6 +8,7 @@
@@ -20,17 +21,17 @@
-PURPLE = dependency('purple', version: '>=2.0.0')
JSON_GLIB = dependency('json-glib-1.0')
SOUP = dependency('libsoup-2.4')
+PURPLE3 = dependency('purple-3', version: '>=3.0.0')
+ meson.project_name() + '3', - dependencies: [PURPLE, JSON_GLIB, SOUP],
+ dependencies: [PURPLE3, JSON_GLIB, SOUP], - install_dir: PURPLE.get_pkgconfig_variable('plugindir'),
+ install_dir: join_paths(get_option('libdir'), 'purple3'), --- a/spasm-account.c Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm-account.c Mon Sep 30 22:55:04 2019 -0500
@@ -17,8 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "spasm-account.h"
@@ -172,7 +171,11 @@
- purple_connection_error(connection, err_msg);
+ purple_connection_error( + PURPLE_CONNECTION_ERROR_OTHER_ERROR, @@ -193,7 +196,7 @@
purple_account_set_remember_password(account, TRUE);
_purple_spasm_account_set_access_token(sa, access_token);
- purple_account_set_password(account, access_token);
+ purple_account_set_password(account, access_token, NULL, NULL); connection = purple_spasm_account_get_connection(sa);
purple_connection_update_progress(connection, "Verifying", 2, 3);
@@ -207,6 +210,7 @@
purple_spasm_account_get_connection(sa),
+ PURPLE_CONNECTION_ERROR_OTHER_ERROR, "User cancelled authorization"
@@ -217,6 +221,7 @@
_purple_spasm_oauth_login(PurpleSpasmAccount *sa) {
PurpleAccount *account = NULL;
PurpleConnection *connection = NULL;
+ PurpleRequestCommonParameters *cpar = NULL; gchar *state = NULL, *uri = NULL;
const gchar *username = NULL;
@@ -246,6 +251,8 @@
purple_notify_uri(connection, uri);
+ cpar = purple_request_cpar_from_account(account); @@ -257,9 +264,7 @@
"OK", G_CALLBACK(_purple_spasm_access_token_input_cb),
"Cancel", G_CALLBACK(_purple_spasm_access_token_cancel_cb),
@@ -293,7 +298,7 @@
g_return_val_if_fail(sa, NULL);
- return g_object_ref(G_OBJECT(sa->session));
+ return SOUP_SESSION(g_object_ref(sa->session)); @@ -376,21 +381,12 @@
return sa->twitter_connected;
-purple_spasm_account_login(PurpleAccount *account) {
- PurpleConnection *pc = NULL;
- PurpleSpasmAccount *sa = NULL;
- const gchar *password = NULL;
- pc = purple_account_get_connection(account);
+spasm_account_login_got_password(PurpleAccount *account, const gchar *password, + GError *error, gpointer data) + PurpleSpasmAccount *sa = PURPLE_SPASM_ACCOUNT(data); - sa = purple_spasm_account_new(account, pc);
- purple_connection_set_protocol_data(pc, sa);
- purple_connection_set_state(pc, PURPLE_CONNECTING);
- /* try to load the password */
- password = purple_account_get_password(account);
_purple_spasm_account_set_access_token(sa, password);
purple_spasm_get_user(sa, _purple_spasm_login_test_cb, NULL);
@@ -399,3 +395,19 @@
+purple_spasm_account_login(PurpleAccount *account) { + PurpleConnection *pc = NULL; + PurpleSpasmAccount *sa = NULL; + pc = purple_account_get_connection(account); + sa = purple_spasm_account_new(account, pc); + purple_connection_set_protocol_data(pc, sa); + purple_connection_set_state(pc, PURPLE_CONNECTION_CONNECTING); + /* try to load the password */ + purple_account_get_password(account, spasm_account_login_got_password, sa); --- a/spasm-account.h Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm-account.h Mon Sep 30 22:55:04 2019 -0500
@@ -1,6 +1,6 @@
* PurpleSpasm - A Twitch Protocol Plugin
- * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ * Copyright (C) 2017-2019 Gary Kramlich <grim@reaperworld.com> * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -26,8 +26,7 @@
#include <libsoup/soup.h>
#define PURPLE_SPASM_ACCOUNT(obj) ((PurpleSpasmAccount *)(obj))
--- a/spasm-chat.c Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm-chat.c Mon Sep 30 22:55:04 2019 -0500
@@ -1,6 +1,6 @@
* PurpleSpasm - A Twitch Protocol Plugin
- * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ * Copyright (C) 2017-2019 Gary Kramlich <grim@reaperworld.com> * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -22,8 +22,7 @@
/******************************************************************************
@@ -70,11 +69,19 @@
PurpleConnection *purple_connection = purple_spasm_account_get_connection(chat->sa);
- purple_connection_error(purple_connection, error->message);
+ purple_connection_error( + PURPLE_CONNECTION_ERROR_OTHER_ERROR, - purple_connection_error(purple_connection, "unknown error");
+ purple_connection_error( + PURPLE_CONNECTION_ERROR_OTHER_ERROR, @@ -124,12 +131,15 @@
"spasm lost connection with server : %s",
error_msg = g_strdup_printf("spasm server closed connection");
purple_spasm_account_get_connection(chat->sa),
+ PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -179,11 +189,19 @@
g_prefix_error(&error, "failed to connect: ");
- purple_connection_error(purple_connection, error->message);
+ purple_connection_error( + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - purple_connection_error(purple_connection, "unknown error");
+ purple_connection_error( + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, @@ -205,7 +223,7 @@
purple_spasm_account_get_name(chat->sa)
- purple_connection_set_state(purple_connection, PURPLE_CONNECTED);
+ purple_connection_set_state(purple_connection, PURPLE_CONNECTION_CONNECTED); chat->input_stream = g_data_input_stream_new(
g_io_stream_get_input_stream(G_IO_STREAM(chat->socket_connection))
@@ -256,14 +274,7 @@
purple_spasm_chat_service_info(PurpleConnection *connection) {
- struct proto_chat_entry *pce;
- pce = g_new0(struct proto_chat_entry, 1);
- pce->label = "_Channel:";
- pce->identifier = "channel";
- return g_list_append(NULL, pce);
--- a/spasm-rest.c Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm-rest.c Mon Sep 30 22:55:04 2019 -0500
@@ -19,7 +19,7 @@
#include <libsoup/soup.h>
--- a/spasm-user.c Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm-user.c Mon Sep 30 22:55:04 2019 -0500
@@ -19,7 +19,7 @@
#include <json-glib/json-glib.h>
--- a/spasm.c Mon Nov 12 14:35:10 2018 -0600
+++ b/spasm.c Mon Sep 30 22:55:04 2019 -0500
@@ -21,58 +21,25 @@
#include "spasm-account.h"
+#include "spasm-protocol.h" /******************************************************************************
*****************************************************************************/
+static PurpleProtocol *spasm = NULL; /******************************************************************************
*****************************************************************************/
-_purple_spasm_list_icon(PurpleAccount *account, PurpleBuddy *buddy) {
-_purple_spasm_close(PurpleConnection *connection) {
-_purple_spasm_get_status_types(PurpleAccount *account) {
- PurpleStatusType *status;
- status = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, "online", "Online", TRUE, TRUE, FALSE);
- types = g_list_append(types, status);
- status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, NULL, "Offline", TRUE, TRUE, FALSE);
- types = g_list_append(types, status);
-_purple_spasm_set_status(PurpleAccount *account, PurpleStatus *status) {
/******************************************************************************
*****************************************************************************/
static PurplePluginProtocolInfo prpl_info = {
.struct_size = sizeof(PurplePluginProtocolInfo),
@@ -94,27 +61,47 @@
.chat_send = purple_spasm_chat_service_send,
.set_chat_topic = purple_spasm_chat_service_set_topic,
-static PurplePluginInfo info = {
- .magic = PURPLE_PLUGIN_MAGIC,
- .major_version = PURPLE_MAJOR_VERSION,
- .minor_version = PURPLE_MINOR_VERSION,
- .type = PURPLE_PLUGIN_PROTOCOL,
- .priority = PURPLE_PRIORITY_DEFAULT,
+/****************************************************************************** + *****************************************************************************/ +G_MODULE_EXPORT GPluginPluginInfo * +gplugin_query(GError **error) { + const gchar * const authors [] = { "Gary Kramlich <grim@reaperworld.com>", NULL }; - .id = PURPLE_SPASM_PLUGIN_ID,
- .version = PLUGIN_VERSION,
- .extra_info = &prpl_info,
+ return GPLUGIN_PLUGIN_INFO(purple_plugin_info_new( + "id", PURPLE_SPASM_PLUGIN_ID, + "version", PLUGIN_VERSION, + "abi-version", PURPLE_ABI_VERSION, + "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL | PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD, - .summary = "Twitch.tv Protocol Plugin",
- .description = "Implements the Twitch.tv chat protocol",
- .author = "Gary Kramlich <grim@reaperworld.com>",
- .homepage = "https://bitbucket.org/rw_grim/purple-spasm",
-_purple_spasm_init(PurplePlugin *plugin) {
+ "summary", "Twitch.tv Protocol Plugin", + "description", "Implements the Twitch.tv chat protocol", + "website", "https://bitbucket.org/rw_grim/purple-spasm", -PURPLE_INIT_PLUGIN(purple_spasm, _purple_spasm_init, info);
+G_MODULE_EXPORT gboolean +gplugin_load(GPluginPlugin *plugin, GError **error) { + spasm_protocol_register(G_TYPE_MODULE(plugin)); + spasm = purple_protocols_add(SPASM_TYPE_PROTOCOL, error); + g_warning("instance was null"); +G_MODULE_EXPORT gboolean +gplugin_unload(GPluginPlugin *plugin, GError **error) {