-/* modest-tny-account-store.c */
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
-/* insert (c)/licensing information) */
+/* modest-tny-account-store.c */
#include <string.h>
/* Password Status */
enum {
PW_NOT_INVALID,
- PW_INVALID,
+ PW_INVALID
};
static const gchar *transport_protocols[] = { "smtp", NULL };
ModestAccountMgr *modest_acc_mgr;
gint pw_invalid;
+ ModestTnyGetPassFunc get_pass_func;
};
#define MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_TNY_ACCOUNT_STORE, \
priv->tny_session_camel = NULL;
/* Meaning: if not indicated otherwise, we have valid password data */
priv->pw_invalid = PW_NOT_INVALID;
+ priv->get_pass_func = NULL;
}
account_store = tny_account_iface_get_account_store(account);
self = MODEST_TNY_ACCOUNT_STORE (account_store);
- priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+ priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
if (priv->pw_invalid==PW_NOT_INVALID) {
retval = modest_account_mgr_get_server_account_string (priv->modest_acc_mgr,
MODEST_ACCOUNT_PASSWORD,
NULL);
} else {
- g_signal_emit(G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0, key);
- priv->pw_invalid=PW_NOT_INVALID;
- retval=NULL;
+ retval = priv->get_pass_func(account, prompt, cancel);
+ if (!*cancel)
+ {
+ priv->pw_invalid=PW_NOT_INVALID;
+ modest_account_mgr_set_server_account_string(priv->modest_acc_mgr,
+ key,
+ MODEST_ACCOUNT_PASSWORD,
+ retval,
+ NULL);
+ }
}
return retval;
}
}
tny_account_iface_set_pass_func (tny_account, get_password);
- tny_account_iface_set_forget_pass_func (tny_account, forget_password);
+ tny_account_iface_set_forget_pass_func (tny_account, forget_password);
return tny_account;
}
klass->get_device_func =
modest_tny_account_store_get_device;
}
+
+void
+modest_tny_account_store_set_get_pass_func (ModestTnyAccountStore *self, ModestTnyGetPassFunc func) {
+
+ ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+ priv->get_pass_func=func;
+}
+