[gnome-online-accounts/wip/rishi/libsecret-workaround: 5/10] imap-auth-login, imap-smtp: Remove unused code paths
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/rishi/libsecret-workaround: 5/10] imap-auth-login, imap-smtp: Remove unused code paths
- Date: Tue, 4 Jul 2017 17:53:28 +0000 (UTC)
commit e05d717dc261e6350175b4a74aa464df46745f24
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jul 4 19:51:25 2017 +0200
imap-auth-login, imap-smtp: Remove unused code paths
We never used these code paths. Removing them simplifies our use of
libsecret.
src/goabackend/goaimapauthlogin.c | 77 ++-------------------------------
src/goabackend/goaimapauthlogin.h | 5 +--
src/goabackend/goaimapsmtpprovider.c | 6 +-
3 files changed, 9 insertions(+), 79 deletions(-)
---
diff --git a/src/goabackend/goaimapauthlogin.c b/src/goabackend/goaimapauthlogin.c
index 083d653..0f2eef8 100644
--- a/src/goabackend/goaimapauthlogin.c
+++ b/src/goabackend/goaimapauthlogin.c
@@ -46,8 +46,6 @@ struct _GoaImapAuthLogin
{
GoaMailAuth parent_instance;
- GoaProvider *provider;
- GoaObject *object;
gboolean greeting_absent;
gchar *username;
gchar *password;
@@ -223,8 +221,6 @@ goa_imap_auth_login_finalize (GObject *object)
{
GoaImapAuthLogin *self = GOA_IMAP_AUTH_LOGIN (object);
- g_clear_object (&self->provider);
- g_clear_object (&self->object);
g_free (self->username);
g_free (self->password);
@@ -241,14 +237,6 @@ goa_imap_auth_login_get_property (GObject *object,
switch (prop_id)
{
- case PROP_PROVIDER:
- g_value_set_object (value, self->provider);
- break;
-
- case PROP_OBJECT:
- g_value_set_object (value, self->object);
- break;
-
case PROP_USERNAME:
g_value_set_string (value, self->username);
break;
@@ -273,14 +261,6 @@ goa_imap_auth_login_set_property (GObject *object,
switch (prop_id)
{
- case PROP_PROVIDER:
- self->provider = g_value_dup_object (value);
- break;
-
- case PROP_OBJECT:
- self->object = g_value_dup_object (value);
- break;
-
case PROP_USERNAME:
self->username = g_value_dup_string (value);
break;
@@ -395,11 +375,8 @@ goa_imap_auth_login_class_init (GoaImapAuthLoginClass *klass)
/**
* goa_imap_auth_login_new:
- * @provider: (allow-none): A #GoaLoginProvider or %NULL.
- * @object: (allow-none): An account object or %NULL.
* @username: The user name to use.
- * @password: (allow-none): The password to use or %NULL to look it up
- * (see the #GoaImapAuthLogin:password property).
+ * @password: The password to use.
*
* Creates a new #GoaMailAuth to be used for username/password
* authentication using LOGIN over IMAP.
@@ -408,17 +385,13 @@ goa_imap_auth_login_class_init (GoaImapAuthLoginClass *klass)
* g_object_unref().
*/
GoaMailAuth *
-goa_imap_auth_login_new (GoaProvider *provider,
- GoaObject *object,
- const gchar *username,
+goa_imap_auth_login_new (const gchar *username,
const gchar *password)
{
- g_return_val_if_fail (provider == NULL || GOA_IS_PROVIDER (provider), NULL);
- g_return_val_if_fail (object == NULL || GOA_IS_OBJECT (object), NULL);
g_return_val_if_fail (username != NULL, NULL);
+ g_return_val_if_fail (password != NULL && password[0] != '\0', NULL);
+
return GOA_MAIL_AUTH (g_object_new (GOA_TYPE_IMAP_AUTH_LOGIN,
- "provider", provider,
- "object", object,
"user-name", username,
"password", password,
NULL));
@@ -448,47 +421,7 @@ goa_imap_auth_login_run_sync (GoaMailAuth *auth,
gboolean ret = FALSE;
gchar *password = NULL;
- if (self->password != NULL)
- {
- password = imap_auth_escape_backslash (self->password);
- }
- else if (self->provider != NULL && self->object != NULL)
- {
- GVariant *credentials;
- gchar *value;
-
- credentials = goa_utils_lookup_credentials_sync (self->provider,
- self->object,
- cancellable,
- error);
- if (credentials == NULL)
- {
- g_prefix_error (error, "Error looking up credentials for IMAP LOGIN in keyring: ");
- goto out;
- }
- if (!g_variant_lookup (credentials, "imap-password", "s", &value))
- {
- g_set_error (error,
- GOA_ERROR,
- GOA_ERROR_FAILED,
- "Did not find imap-password in credentials");
- g_variant_unref (credentials);
- goto out;
- }
-
- password = imap_auth_escape_backslash (value);
-
- g_free (value);
- g_variant_unref (credentials);
- }
- else
- {
- g_set_error (error,
- GOA_ERROR,
- GOA_ERROR_FAILED,
- "Cannot do IMAP LOGIN without a password");
- goto out;
- }
+ password = imap_auth_escape_backslash (self->password);
input = goa_mail_auth_get_input (auth);
output = goa_mail_auth_get_output (auth);
diff --git a/src/goabackend/goaimapauthlogin.h b/src/goabackend/goaimapauthlogin.h
index 306430f..fe76a9c 100644
--- a/src/goabackend/goaimapauthlogin.h
+++ b/src/goabackend/goaimapauthlogin.h
@@ -28,7 +28,6 @@
#include <glib-object.h>
#include "goamailauth.h"
-#include "goaprovider.h"
G_BEGIN_DECLS
@@ -39,9 +38,7 @@ G_BEGIN_DECLS
typedef struct _GoaImapAuthLogin GoaImapAuthLogin;
GType goa_imap_auth_login_get_type (void) G_GNUC_CONST;
-GoaMailAuth *goa_imap_auth_login_new (GoaProvider *provider,
- GoaObject *object,
- const gchar *user_name,
+GoaMailAuth *goa_imap_auth_login_new (const gchar *user_name,
const gchar *password);
G_END_DECLS
diff --git a/src/goabackend/goaimapsmtpprovider.c b/src/goabackend/goaimapsmtpprovider.c
index 3161c1a..8a2677e 100644
--- a/src/goabackend/goaimapsmtpprovider.c
+++ b/src/goabackend/goaimapsmtpprovider.c
@@ -343,7 +343,7 @@ ensure_credentials_sync (GoaProvider *provider,
imap_username = goa_util_lookup_keyfile_string (object, "ImapUserName");
imap_tls_type = get_tls_type_from_object (object, "ImapUseSsl", "ImapUseTls");
- imap_auth = goa_imap_auth_login_new (NULL, NULL, imap_username, imap_password);
+ imap_auth = goa_imap_auth_login_new (imap_username, imap_password);
if (!goa_mail_client_check_sync (mail_client,
imap_server,
imap_tls_type,
@@ -963,7 +963,7 @@ add_account (GoaProvider *provider,
imap_username = gtk_entry_get_text (GTK_ENTRY (data.imap_username));
g_cancellable_reset (data.cancellable);
- imap_auth = goa_imap_auth_login_new (NULL, NULL, imap_username, imap_password);
+ imap_auth = goa_imap_auth_login_new (imap_username, imap_password);
goa_mail_client_check (mail_client,
imap_server,
imap_tls_type,
@@ -1318,7 +1318,7 @@ refresh_account (GoaProvider *provider,
imap_password = gtk_entry_get_text (GTK_ENTRY (data.imap_password));
g_cancellable_reset (data.cancellable);
- imap_auth = goa_imap_auth_login_new (NULL, NULL, imap_username, imap_password);
+ imap_auth = goa_imap_auth_login_new (imap_username, imap_password);
goa_mail_client_check (mail_client,
imap_server,
imap_tls_type,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]