--- a/meson.build Sun Apr 19 05:11:17 2020 -0500
+++ b/meson.build Sun Apr 19 06:50:19 2020 -0500
@@ -5,16 +5,17 @@
- '-DPREFIX="@0@"'.format(get_option('prefix')),
+ '-DGETTEXT_PACKAGE="spasm"', '-DLIBDIR="@0@"'.format(get_option('libdir')),
- '-DPLUGIN_VERSION="@0@"'.format(meson.project_version()),
+ '-DPREFIX="@0@"'.format(get_option('prefix')), + '-DSPASM_VERSION="@0@"'.format(meson.project_version()), JSON_GLIB = dependency('json-glib-1.0')
SOUP = dependency('libsoup-2.4')
-PURPLE3 = dependency('purple-3', version: '>=3.0.0')
+PURPLE = dependency('purple', version: '>=2.13.0') --- a/src/meson.build Sun Apr 19 05:11:17 2020 -0500
+++ b/src/meson.build Sun Apr 19 06:50:19 2020 -0500
@@ -1,18 +1,23 @@
- meson.project_name() + '3',
- dependencies: [PURPLE3, JSON_GLIB, SOUP],
+ dependencies: [PURPLE, JSON_GLIB, SOUP], - install_dir: join_paths(get_option('libdir'), 'purple3'),
+ install_dir: join_paths(get_option('libdir'), 'purple'), --- a/src/spasm-account.c Sun Apr 19 05:11:17 2020 -0500
+++ b/src/spasm-account.c Sun Apr 19 06:50:19 2020 -0500
@@ -173,12 +173,7 @@
- purple_connection_error(
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+ purple_connection_error(connection, err_msg); @@ -191,17 +186,13 @@
spasm_access_token_input_cb(gpointer data, const gchar *access_token) {
PurpleAccount *account = NULL;
- PurpleConnection *connection = NULL;
SpasmAccount *sa = SPASM_ACCOUNT(data);
account = spasm_account_get_account(sa);
purple_account_set_remember_password(account, TRUE);
spasm_account_set_access_token(sa, access_token);
- purple_account_set_password(account, access_token, NULL, NULL);
- connection = spasm_account_get_connection(sa);
- purple_connection_update_progress(connection, "Verifying", 2, 3);
+ purple_account_set_password(account, access_token); spasm_get_user(sa, spasm_login_test_cb, NULL);
@@ -212,7 +203,6 @@
spasm_account_get_connection(sa),
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
"User cancelled authorization"
@@ -223,19 +213,12 @@
spasm_oauth_login(SpasmAccount *sa) {
PurpleAccount *account = NULL;
PurpleConnection *connection = NULL;
- PurpleRequestCommonParameters *cpar = NULL;
gchar *state = NULL, *uri = NULL;
const gchar *username = NULL;
account = spasm_account_get_account(sa);
connection = purple_account_get_connection(account);
- purple_connection_update_progress(
username = purple_account_get_username(account);
state = g_strdup_printf("%s,%s", SPASM_PLUGIN_ID, username);
@@ -253,8 +236,6 @@
purple_notify_uri(connection, uri);
- cpar = purple_request_cpar_from_account(account);
@@ -266,7 +247,9 @@
"OK", G_CALLBACK(spasm_access_token_input_cb),
"Cancel", G_CALLBACK(spasm_access_token_cancel_cb),
@@ -383,12 +366,21 @@
return sa->twitter_connected;
-spasm_account_login_got_password(PurpleAccount *account, const gchar *password,
- GError *error, gpointer data)
- SpasmAccount *sa = SPASM_ACCOUNT(data);
+spasm_account_login(PurpleAccount *account) { + PurpleConnection *pc = NULL; + SpasmAccount *sa = NULL; + const gchar *password = NULL; + pc = purple_account_get_connection(account); + sa = 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); spasm_account_set_access_token(sa, password);
spasm_get_user(sa, spasm_login_test_cb, NULL);
@@ -397,19 +389,3 @@
-spasm_account_login(PurpleAccount *account) {
- PurpleConnection *pc = NULL;
- SpasmAccount *sa = NULL;
- pc = purple_account_get_connection(account);
- sa = 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/src/spasm-chat.c Sun Apr 19 05:11:17 2020 -0500
+++ b/src/spasm-chat.c Sun Apr 19 06:50:19 2020 -0500
@@ -20,6 +20,8 @@
+#include <glib/gi18n-lib.h> @@ -69,19 +71,11 @@
PurpleConnection *purple_connection = spasm_account_get_connection(chat->sa);
- purple_connection_error(
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+ purple_connection_error(purple_connection, error->message); - purple_connection_error(
- PURPLE_CONNECTION_ERROR_OTHER_ERROR,
+ purple_connection_error(purple_connection, _("unknown error")); @@ -137,12 +131,7 @@
error_msg = g_strdup_printf("spasm server closed connection");
- purple_connection_error(
- spasm_account_get_connection(chat->sa),
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ purple_connection_error(spasm_account_get_connection(chat->sa), error_msg); @@ -189,19 +178,10 @@
g_prefix_error(&error, "failed to connect: ");
- purple_connection_error(
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ purple_connection_error(purple_connection, error->message); - purple_connection_error(
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ purple_connection_error(purple_connection, _("unknown error")); @@ -223,7 +203,7 @@
spasm_account_get_name(chat->sa)
- purple_connection_set_state(purple_connection, PURPLE_CONNECTION_CONNECTED);
+ purple_connection_set_state(purple_connection, PURPLE_CONNECTED); chat->input_stream = g_data_input_stream_new(
g_io_stream_get_input_stream(G_IO_STREAM(chat->socket_connection))