[Commits] [SCM] claws branch, master, updated. 3.11.1-131-gde3e09e
holger at claws-mail.org
holger at claws-mail.org
Sun Jun 14 14:48:15 CEST 2015
The branch, master has been updated
via de3e09ee3239e11ce065f47d5466d08806e31ee6 (commit)
via 6e63b752f6bedb28d25e1e14695a3d710168128e (commit)
via aaa86dbd5cdceb5204313a068d0fc0ad067252d0 (commit)
via c69ab3b4cdc16eb5c271afb4c028e1c2f8beffc7 (commit)
via 63e39e3b8c9baa0745c4ce7088d619c7bb05778c (commit)
via 7d3b4a6e716846d386341001bf9d98ef960d779c (commit)
from 0043e1ee2ebdec97d3f9a8ce65469592b2d3c3bf (commit)
Summary of changes:
configure.ac | 17 +-
src/plugins/gdata/cm_gdata_contacts.c | 293 +++++++++++++++++++++--------
src/plugins/gdata/cm_gdata_prefs.c | 12 --
src/plugins/gdata/gdata_plugin.c | 4 +-
tools/jhbuild/sample.jhbuildrc-claws-mail | 5 +-
5 files changed, 220 insertions(+), 111 deletions(-)
- Log -----------------------------------------------------------------
commit de3e09ee3239e11ce065f47d5466d08806e31ee6
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 14 14:42:19 2015 +0200
Update sample jhbuildrc file
diff --git a/tools/jhbuild/sample.jhbuildrc-claws-mail b/tools/jhbuild/sample.jhbuildrc-claws-mail
index c8adb47..d271004 100644
--- a/tools/jhbuild/sample.jhbuildrc-claws-mail
+++ b/tools/jhbuild/sample.jhbuildrc-claws-mail
@@ -25,7 +25,8 @@ prefix = '/opt/claws-mail'
#os.environ['CFLAGS'] = '-g -O0'
# module-specific autofoo args
-#module_autogenargs['claws-mail'] = autogenargs + "--disable-manual"
+#module_autogenargs['claws-mail'] = " ".join([autogenargs, "--disable-manual"])
+#module_autogenargs['libgdata'] = " ".join([autogenargs, "--disable-tests"])
# path for building (if None, build in-tree)
#buildroot = None
@@ -39,7 +40,7 @@ skip = [
]
# speficif branches/tags of modules that should be built
-#branches['libgdata'] = (None, 'LIBGDATA_0_10_1')
+#branches['libgdata'] = (None, 'LIBGDATA_0_17_1')
# module specific extra environment variables
#module_extra_env = { "clutter-gtk" : {"LDFLAGS" : "-lm -lgthread-2.0"} }
commit 6e63b752f6bedb28d25e1e14695a3d710168128e
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 14 14:41:38 2015 +0200
Gdata plugin: Remove now obsolete CM_GDATA_CLIENT_ID macro def
diff --git a/configure.ac b/configure.ac
index 811982f..d8e3260 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1115,9 +1115,6 @@ AC_CHECK_LIB([archive], [archive_read_new],
dnl libgdata *******************************************************************
PKG_CHECK_MODULES(GDATA, libgdata >= 0.17.1, HAVE_GDATA=yes, HAVE_GDATA=no)
-if test x"$HAVE_GDATA" = xyes; then
- AC_DEFINE(CM_GDATA_CLIENT_ID, ["Claws Mail GData plugin"], [client id])
-fi
AC_SUBST(GDATA_CFLAGS)
AC_SUBST(GDATA_LIBS)
commit aaa86dbd5cdceb5204313a068d0fc0ad067252d0
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 14 14:40:52 2015 +0200
GData plugin: Remove now obsolete password pref
diff --git a/src/plugins/gdata/cm_gdata_prefs.c b/src/plugins/gdata/cm_gdata_prefs.c
index a2082fd..683706b 100644
--- a/src/plugins/gdata/cm_gdata_prefs.c
+++ b/src/plugins/gdata/cm_gdata_prefs.c
@@ -38,7 +38,6 @@ typedef struct
{
PrefsPage page;
GtkWidget *entry_username;
- GtkWidget *entry_password;
GtkWidget *spin_max_num_results;
GtkWidget *spin_max_cache_age;
} CmGDataPage;
@@ -51,9 +50,6 @@ PrefParam cm_gdata_param[] =
{"username", NULL, &cm_gdata_config.username, P_STRING,
&gdata_page.entry_username, prefs_set_data_from_entry, prefs_set_entry},
- {"password", NULL, &cm_gdata_config.password, P_PASSWORD,
- &gdata_page.entry_password, prefs_set_data_from_entry, prefs_set_entry},
-
{ "max_num_results", "1000", &cm_gdata_config.max_num_results, P_INT,
&gdata_page.spin_max_num_results, prefs_set_data_from_spinbtn, prefs_set_spinbtn},
@@ -88,14 +84,6 @@ static void gdata_create_prefs_page(PrefsPage *page, GtkWindow *window, gpointer
gtk_widget_set_size_request(entry, 250, -1);
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 4, 4);
gdata_page.entry_username = entry;
- label = gtk_label_new(_("Password:"));
- gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 4, 4);
- entry = gtk_entry_new();
- gtk_widget_set_size_request(entry, 250, -1);
- gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
- gdata_page.entry_password = entry;
- gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 4, 4);
gtk_container_add(GTK_CONTAINER(frame), table);
table = gtk_table_new(2, 2, FALSE);
commit c69ab3b4cdc16eb5c271afb4c028e1c2f8beffc7
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 14 14:28:20 2015 +0200
GData plugin: Switch from ClientLogin to OAuth2
Google has recently removed ClientLogin support.
The switch to OAuth2 fixes bug #3432 and makes the plugin work
again, but with a degraded user experience. The authorization
needs to be redone on every program start. Improving that is
pending on https://bugzilla.gnome.org/show_bug.cgi?id=750746
diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index 8a57198..b8175e6 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#ifdef HAVE_CONFIG_H
# include "config.h"
# include "claws-features.h"
@@ -24,20 +23,30 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
#include "cm_gdata_contacts.h"
#include "cm_gdata_prefs.h"
-#include <gtk/gtk.h>
#include "addr_compl.h"
#include "main.h"
#include "prefs_common.h"
+#include "mainwindow.h"
#include "common/log.h"
#include "common/xml.h"
+#include "common/utils.h"
+#include "common/passcrypt.h"
+#include "gtk/gtkutils.h"
#include <gdata/gdata.h>
#define GDATA_CONTACTS_FILENAME "gdata_cache.xml"
+#define GDATA_C1 "EOnuQt4fxED3WrO//iub3KLQMScIxXiT0VBD8RZUeKjkcm1zEBVMboeWDLYyqjJKZaL4oaZ24umWygbj19T2oJR6ZpjbCw=="
+#define GDATA_C2 "QYjIgZblg/4RMCnEqNQypcHZba9ePqAN"
+#define GDATA_C3 "XHEZEgO06YbWfQWOyYhE/ny5Q10aNOZlkQ=="
+
+
typedef struct
{
const gchar *family_name;
@@ -55,6 +64,9 @@ typedef struct
CmGDataContactsCache contacts_cache;
gboolean cm_gdata_contacts_query_running = FALSE;
gchar *contacts_group_id = NULL;
+GDataOAuth2Authorizer *authorizer = NULL;
+GDataContactsService *service = NULL;
+
static void protect_fields_against_NULL(Contact *contact)
{
@@ -69,6 +81,114 @@ static void protect_fields_against_NULL(Contact *contact)
contact->family_name = g_strdup("");
}
+typedef struct
+{
+ const gchar *auth_uri;
+ GtkWidget *entry;
+} AuthCodeQueryButtonData;
+
+
+static void auth_uri_link_button_clicked_cb(GtkButton *button, gpointer data)
+{
+ AuthCodeQueryButtonData *auth_code_query_data = data;
+ open_uri(auth_code_query_data->auth_uri, prefs_common_get_uri_cmd());
+ gtk_widget_grab_focus(auth_code_query_data->entry);
+}
+
+static void auth_code_entry_changed_cb(GtkEditable *entry, gpointer data)
+{
+ gtk_widget_set_sensitive(GTK_WIDGET(data), gtk_entry_get_text_length(GTK_ENTRY(entry)) > 0);
+}
+
+
+/* Returns the authorization code as newly allocated string, or NULL */
+gchar* ask_user_for_auth_code(const gchar *auth_uri)
+{
+ GtkWidget *dialog;
+ GtkWidget *vbox;
+ GtkWidget *table;
+ GtkWidget *link_button;
+ GtkWidget *label;
+ GtkWidget *entry;
+ gchar *str;
+ gchar *retval = NULL;
+ MainWindow *mainwin;
+ gint dlg_res;
+ GtkWidget *btn_ok;
+ AuthCodeQueryButtonData *auth_code_query_data;
+
+ mainwin = mainwindow_get_mainwindow();
+ dialog = gtk_message_dialog_new_with_markup(mainwin ? GTK_WINDOW(mainwin->window) : NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_NONE,
+ "<span weight=\"bold\" size=\"larger\">%s</span>", _("GData plugin: Authorization required"));
+ gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+ _("You need to authorize Claws Mail to access your Google contact list to use the GData plugin."
+ "\n\nVisit Google's authorization page by pressing the button below. After you "
+ "confirmed the authorization, you will get an authorization code. Enter that code "
+ "in the field below to grant Claws Mail access to your Google contact list."));
+ gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ btn_ok = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_OK, GTK_RESPONSE_OK);
+ gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);
+ gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
+
+ gtk_widget_set_sensitive(btn_ok, FALSE);
+
+ table = gtk_table_new(2, 3, FALSE);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 8);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 8);
+
+ str = g_strconcat("<b>", _("Step 1:"), "</b>", NULL);
+ label = gtk_label_new(str);
+ g_free(str);
+ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, 0, 0, 0, 0);
+
+ link_button = gtk_button_new_with_label(_("Click here to open the Google authorization page in a browser"));
+ auth_code_query_data = g_new0(AuthCodeQueryButtonData,1);
+ gtk_table_attach(GTK_TABLE(table), link_button, 1, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+
+ str = g_strconcat("<b>", _("Step 2:"), "</b>", NULL);
+ label = gtk_label_new(str);
+ g_free(str);
+ gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, 0, 0, 0, 0);
+
+ gtk_table_attach(GTK_TABLE(table), gtk_label_new(_("Enter code:")), 1, 2, 1, 2, 0, 0, 0, 0);
+
+ entry = gtk_entry_new();
+ g_signal_connect(G_OBJECT(entry), "changed", (GCallback)auth_code_entry_changed_cb, (gpointer)btn_ok);
+ gtk_table_attach(GTK_TABLE(table), entry, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+
+ auth_code_query_data->auth_uri = auth_uri;
+ auth_code_query_data->entry = entry;
+ g_signal_connect(G_OBJECT(link_button), "clicked", (GCallback)auth_uri_link_button_clicked_cb, (gpointer)auth_code_query_data);
+
+ vbox = gtk_vbox_new(FALSE, 4);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog))), vbox, FALSE, FALSE, 0);
+
+ gtk_widget_show_all(dialog);
+
+ dlg_res = gtk_dialog_run(GTK_DIALOG(dialog));
+ switch(dlg_res)
+ {
+ case GTK_RESPONSE_DELETE_EVENT:
+ case GTK_RESPONSE_CANCEL:
+ break;
+ case GTK_RESPONSE_OK:
+ retval = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+ break;
+ }
+
+ g_free(auth_code_query_data);
+ gtk_widget_destroy(dialog);
+
+ return retval;
+}
+
static void write_cache_to_file(void)
{
@@ -225,7 +345,7 @@ static void cm_gdata_query_contacts_ready(GDataContactsService *service, GAsyncR
g_free(tmpstr2);
}
-static void query_after_auth(GDataContactsService *service)
+static void query_contacts(GDataContactsService *service)
{
GDataContactsQuery *query;
@@ -289,52 +409,63 @@ static void cm_gdata_query_groups_ready(GDataContactsService *service, GAsyncRes
log_message(LOG_PROTOCOL, _("GData plugin: Groups received\n"));
- query_after_auth(service);
+ query_contacts(service);
}
-static void query_for_contacts_group_id(GDataClientLoginAuthorizer *authorizer)
+static void query_for_contacts_group_id(GDataAuthorizer *authorizer)
{
- GDataContactsService *service;
-
log_message(LOG_PROTOCOL, _("GData plugin: Starting async groups query\n"));
- service = gdata_contacts_service_new(GDATA_AUTHORIZER(authorizer));
gdata_contacts_service_query_groups_async(service, NULL, NULL, NULL, NULL, NULL,
(GAsyncReadyCallback)cm_gdata_query_groups_ready, NULL);
+}
- g_object_unref(service);
+
+static void query_after_auth()
+{
+ if(!contacts_group_id)
+ query_for_contacts_group_id(GDATA_AUTHORIZER(authorizer));
+ else
+ query_contacts(service);
}
-static void cm_gdata_auth_ready(GDataClientLoginAuthorizer *authorizer, GAsyncResult *res, gpointer data)
+
+static void cm_gdata_auth_ready(GDataOAuth2Authorizer *authorizer, GAsyncResult *res, gpointer data)
{
GError *error = NULL;
- if(gdata_client_login_authorizer_authenticate_finish(authorizer, res, &error) == FALSE)
+ if(gdata_oauth2_authorizer_request_authorization_finish(authorizer, res, &error) == FALSE)
{
- log_error(LOG_PROTOCOL, _("GData plugin: Authentication error: %s\n"), error->message);
+ /* Notify the user of all errors except cancellation errors */
+ if(!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ log_error(LOG_PROTOCOL, _("GData plugin: Authorization error: %s\n"), error->message);
+ }
g_error_free(error);
cm_gdata_contacts_query_running = FALSE;
return;
}
- log_message(LOG_PROTOCOL, _("GData plugin: Authenticated\n"));
+ log_message(LOG_PROTOCOL, _("GData plugin: Authorization successful\n"));
- if(!contacts_group_id)
- {
- query_for_contacts_group_id(authorizer);
- }
- else {
- GDataContactsService *service;
- service = gdata_contacts_service_new(GDATA_AUTHORIZER(authorizer));
- query_after_auth(service);
- g_object_unref(service);
- }
+ query_after_auth();
}
-static void query()
+/* returns allocated string which must be freed */
+static guchar* decode(const gchar *in)
{
+ guchar *tmp;
+ gsize len;
- GDataClientLoginAuthorizer *authorizer;
+ tmp = g_base64_decode(in, &len);
+ passcrypt_decrypt(tmp, len);
+ return tmp;
+}
+
+static void query()
+{
+ gchar *auth_uri;
+ gchar *auth_code;
if(cm_gdata_contacts_query_running)
{
@@ -342,13 +473,54 @@ static void query()
return;
}
- log_message(LOG_PROTOCOL, _("GData plugin: Starting async authentication\n"));
+ if(!authorizer)
+ {
+ gchar *c1 = decode(GDATA_C1);
+ gchar *c2 = decode(GDATA_C2);
+ gchar *c3 = decode(GDATA_C3);
+
+ authorizer = gdata_oauth2_authorizer_new(c1, c2, c3, GDATA_TYPE_CONTACTS_SERVICE);
+
+ g_free(c1);
+ g_free(c2);
+ g_free(c3);
+ }
+ g_return_if_fail(authorizer);
+
+ if(!service)
+ {
+ service = gdata_contacts_service_new(GDATA_AUTHORIZER(authorizer));
+ }
+ g_return_if_fail(service);
+
+ if(!gdata_service_is_authorized(GDATA_SERVICE(service)))
+ {
+ log_message(LOG_PROTOCOL, _("GData plugin: Starting async authorization\n"));
+
+ auth_uri = gdata_oauth2_authorizer_build_authentication_uri(authorizer, cm_gdata_config.username, FALSE);
+ g_return_if_fail(auth_uri);
- authorizer = gdata_client_login_authorizer_new(CM_GDATA_CLIENT_ID, GDATA_TYPE_CONTACTS_SERVICE);
- gdata_client_login_authorizer_authenticate_async(authorizer, cm_gdata_config.username, cm_gdata_config.password, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
- cm_gdata_contacts_query_running = TRUE;
+ auth_code = ask_user_for_auth_code(auth_uri);
- g_object_unref(authorizer);
+ if(auth_code)
+ {
+ cm_gdata_contacts_query_running = TRUE;
+ log_message(LOG_PROTOCOL, _("GData plugin: Got authorization code, requesting authorization\n"));
+ gdata_oauth2_authorizer_request_authorization_async(authorizer, auth_code, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
+ memset(auth_code, 0, strlen(auth_code));
+ g_free(auth_code);
+ }
+ else
+ {
+ log_warning(LOG_PROTOCOL, _("GData plugin: No authorization code received, authorization request cancelled\n"));
+ }
+
+ g_free(auth_uri);
+ }
+ else
+ {
+ query_after_auth();
+ }
}
@@ -388,14 +560,9 @@ gboolean cm_gdata_update_contacts_cache(void)
{
debug_print("GData plugin: Offline mode\n");
}
- else if(!cm_gdata_config.username || *(cm_gdata_config.username) == '\0' || !cm_gdata_config.password)
- {
- /* noop if no credentials are given */
- debug_print("GData plugin: Empty username or password\n");
- }
else
{
- debug_print("GData plugin: Querying contacts");
+ debug_print("GData plugin: Querying contacts\n");
query();
}
return TRUE;
@@ -409,6 +576,18 @@ void cm_gdata_contacts_done(void)
write_cache_to_file();
if(contacts_cache.contacts && !claws_is_exiting())
clear_contacts_cache();
+
+ if(authorizer)
+ {
+ g_object_unref(G_OBJECT(authorizer));
+ authorizer = NULL;
+ }
+
+ if(service)
+ {
+ g_object_unref(G_OBJECT(service));
+ service = NULL;
+ }
}
void cm_gdata_load_contacts_cache_from_file(void)
commit 63e39e3b8c9baa0745c4ce7088d619c7bb05778c
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 14 11:40:47 2015 +0200
GData plugin: Change debug output order during plugin load
diff --git a/src/plugins/gdata/gdata_plugin.c b/src/plugins/gdata/gdata_plugin.c
index 5985f1d..b3e6a39 100644
--- a/src/plugins/gdata/gdata_plugin.c
+++ b/src/plugins/gdata/gdata_plugin.c
@@ -123,13 +123,13 @@ gint plugin_init(gchar **error)
cm_gdata_prefs_init();
+ debug_print("GData plugin loaded\n");
+
/* contacts cache */
cm_gdata_load_contacts_cache_from_file();
cm_gdata_update_contacts_update_timer();
cm_gdata_update_contacts_cache();
- debug_print("GData plugin loaded\n");
-
return 0;
}
commit 7d3b4a6e716846d386341001bf9d98ef960d779c
Author: Holger Berndt <hb at claws-mail.org>
Date: Sat May 30 19:26:35 2015 +0200
GData plugin: Drop support for libgdata < 0.9
diff --git a/configure.ac b/configure.ac
index a14af50..811982f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1114,21 +1114,9 @@ AC_CHECK_LIB([archive], [archive_read_new],
)
dnl libgdata *******************************************************************
-dnl Plugin handles compatibility back to 0.6.4 so there are multiple checks.
-PKG_CHECK_MODULES(GDATA, libgdata >= 0.9.1, HAVE_GDATA=yes, HAVE_GDATA=no)
+PKG_CHECK_MODULES(GDATA, libgdata >= 0.17.1, HAVE_GDATA=yes, HAVE_GDATA=no)
if test x"$HAVE_GDATA" = xyes; then
- AC_DEFINE(HAVE_GDATA_VERSION_0_9_1, 1, [at least version 0.9.1 of libgdata is available])
- AC_DEFINE(HAVE_GDATA_VERSION_0_9, 1, [at least version 0.9 of libgdata is available])
-else
- PKG_CHECK_MODULES(GDATA, libgdata >= 0.9, HAVE_GDATA=yes, HAVE_GDATA=no)
-fi
-if test x"$HAVE_GDATA" = xyes; then
- AC_DEFINE(HAVE_GDATA_VERSION_0_9, 1, [at least version 0.9 of libgdata is available])
-else
- PKG_CHECK_MODULES(GDATA, libgdata >= 0.6.4, HAVE_GDATA=yes, HAVE_GDATA=no)
-fi
-if test x"$HAVE_GDATA" = xyes; then
- AC_DEFINE(CM_GDATA_CLIENT_ID, ["Claws Mail GData plugin"], [client id])
+ AC_DEFINE(CM_GDATA_CLIENT_ID, ["Claws Mail GData plugin"], [client id])
fi
AC_SUBST(GDATA_CFLAGS)
AC_SUBST(GDATA_LIBS)
diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index adc4400..8a57198 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -235,15 +235,11 @@ static void query_after_auth(GDataContactsService *service)
gdata_contacts_query_set_group(query, contacts_group_id);
gdata_query_set_max_results(GDATA_QUERY(query), cm_gdata_config.max_num_results);
gdata_contacts_service_query_contacts_async(service, GDATA_QUERY(query), NULL, NULL, NULL,
-#ifdef HAVE_GDATA_VERSION_0_9_1
- NULL,
-#endif
- (GAsyncReadyCallback)cm_gdata_query_contacts_ready, NULL);
+ NULL, (GAsyncReadyCallback)cm_gdata_query_contacts_ready, NULL);
g_object_unref(query);
}
-#ifdef HAVE_GDATA_VERSION_0_9_1
static void cm_gdata_query_groups_ready(GDataContactsService *service, GAsyncResult *res, gpointer data)
{
GDataFeed *feed;
@@ -295,23 +291,17 @@ static void cm_gdata_query_groups_ready(GDataContactsService *service, GAsyncRes
query_after_auth(service);
}
-#endif
-#ifdef HAVE_GDATA_VERSION_0_9
static void query_for_contacts_group_id(GDataClientLoginAuthorizer *authorizer)
{
GDataContactsService *service;
-#ifdef HAVE_GDATA_VERSION_0_9_1
log_message(LOG_PROTOCOL, _("GData plugin: Starting async groups query\n"));
service = gdata_contacts_service_new(GDATA_AUTHORIZER(authorizer));
gdata_contacts_service_query_groups_async(service, NULL, NULL, NULL, NULL, NULL,
(GAsyncReadyCallback)cm_gdata_query_groups_ready, NULL);
-#else
- service = gdata_contacts_service_new(GDATA_AUTHORIZER(authorizer));
- query_after_auth(service);
-#endif
+
g_object_unref(service);
}
@@ -340,32 +330,11 @@ static void cm_gdata_auth_ready(GDataClientLoginAuthorizer *authorizer, GAsyncRe
g_object_unref(service);
}
}
-#else
-static void cm_gdata_auth_ready(GDataContactsService *service, GAsyncResult *res, gpointer data)
-{
- GError *error = NULL;
-
- if(!gdata_service_authenticate_finish(GDATA_SERVICE(service), res, &error))
- {
- log_error(LOG_PROTOCOL, _("GData plugin: Authentication error: %s\n"), error->message);
- g_error_free(error);
- cm_gdata_contacts_query_running = FALSE;
- return;
- }
-
- log_message(LOG_PROTOCOL, _("GData plugin: Authenticated\n"));
- query_after_auth(service);
-}
-#endif
static void query()
{
-#ifdef HAVE_GDATA_VERSION_0_9
GDataClientLoginAuthorizer *authorizer;
-#else
- GDataContactsService *service;
-#endif
if(cm_gdata_contacts_query_running)
{
@@ -375,24 +344,11 @@ static void query()
log_message(LOG_PROTOCOL, _("GData plugin: Starting async authentication\n"));
-#ifdef HAVE_GDATA_VERSION_0_9
authorizer = gdata_client_login_authorizer_new(CM_GDATA_CLIENT_ID, GDATA_TYPE_CONTACTS_SERVICE);
gdata_client_login_authorizer_authenticate_async(authorizer, cm_gdata_config.username, cm_gdata_config.password, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
cm_gdata_contacts_query_running = TRUE;
-#else
- service = gdata_contacts_service_new(CM_GDATA_CLIENT_ID);
- cm_gdata_contacts_query_running = TRUE;
- gdata_service_authenticate_async(GDATA_SERVICE(service), cm_gdata_config.username, cm_gdata_config.password, NULL,
- (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
-#endif
-
-#ifdef HAVE_GDATA_VERSION_0_9
g_object_unref(authorizer);
-#else
- g_object_unref(service);
-#endif
-
}
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list