1 /* Copyright (c) 2006, Nokia Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of the Nokia Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
18 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
21 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include <glib/gi18n.h>
33 #include <tny-account.h>
34 #include <tny-account-store.h>
35 #include <tny-store-account.h>
36 #include <tny-transport-account.h>
37 #include <tny-device.h>
38 #include <tny-simple-list.h>
39 #include <tny-account-store.h>
40 #include <tny-camel-transport-account.h>
41 #include <tny-camel-imap-store-account.h>
42 #include <tny-camel-pop-store-account.h>
43 #include <modest-marshal.h>
44 #include <modest-protocol-info.h>
45 #include <modest-local-folder-info.h>
47 #include <modest-account-mgr.h>
48 #include <modest-account-mgr-helpers.h>
50 #include "modest-tny-account-store.h"
51 #include "modest-tny-platform-factory.h"
52 #include <tny-gtk-lockable.h>
53 #include <camel/camel.h>
55 /* 'private'/'protected' functions */
56 static void modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass);
57 //static void modest_tny_account_store_init (ModestTnyAccountStore *obj);
58 static void modest_tny_account_store_finalize (GObject *obj);
60 /* implementations for tny-account-store-iface */
61 static void modest_tny_account_store_instance_init (ModestTnyAccountStore *obj);
62 static void modest_tny_account_store_init (gpointer g, gpointer iface_data);
67 ACCOUNT_UPDATE_SIGNAL,
71 typedef struct _ModestTnyAccountStorePrivate ModestTnyAccountStorePrivate;
72 struct _ModestTnyAccountStorePrivate {
76 GHashTable *password_hash;
78 TnySessionCamel *tny_session_camel;
80 ModestAccountMgr *account_mgr;
81 TnyAccount *local_folders;
84 #define MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
85 MODEST_TYPE_TNY_ACCOUNT_STORE, \
86 ModestTnyAccountStorePrivate))
88 static void on_password_requested (ModestTnyAccountStore *account_store,
89 const gchar* account_name,
95 static GObjectClass *parent_class = NULL;
97 static guint signals[LAST_SIGNAL] = {0};
100 modest_tny_account_store_get_type (void)
102 static GType my_type = 0;
105 static const GTypeInfo my_info = {
106 sizeof(ModestTnyAccountStoreClass),
107 NULL, /* base init */
108 NULL, /* base finalize */
109 (GClassInitFunc) modest_tny_account_store_class_init,
110 NULL, /* class finalize */
111 NULL, /* class data */
112 sizeof(ModestTnyAccountStore),
114 (GInstanceInitFunc) modest_tny_account_store_instance_init,
118 static const GInterfaceInfo iface_info = {
119 (GInterfaceInitFunc) modest_tny_account_store_init,
120 NULL, /* interface_finalize */
121 NULL /* interface_data */
124 my_type = g_type_register_static (G_TYPE_OBJECT,
125 "ModestTnyAccountStore",
127 g_type_add_interface_static (my_type, TNY_TYPE_ACCOUNT_STORE,
134 modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass)
136 GObjectClass *gobject_class;
137 gobject_class = (GObjectClass*) klass;
139 parent_class = g_type_class_peek_parent (klass);
140 gobject_class->finalize = modest_tny_account_store_finalize;
142 g_type_class_add_private (gobject_class,
143 sizeof(ModestTnyAccountStorePrivate));
145 signals[ACCOUNT_UPDATE_SIGNAL] =
146 g_signal_new ("account_update",
147 G_TYPE_FROM_CLASS (gobject_class),
149 G_STRUCT_OFFSET(ModestTnyAccountStoreClass, account_update),
151 g_cclosure_marshal_VOID__STRING,
152 G_TYPE_NONE, 1, G_TYPE_STRING);
158 modest_tny_account_store_instance_init (ModestTnyAccountStore *obj)
160 ModestTnyAccountStorePrivate *priv =
161 MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj);
163 priv->cache_dir = NULL;
164 priv->account_mgr = NULL;
165 priv->tny_session_camel = NULL;
168 priv->password_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
171 priv->local_folders = NULL;
175 /* we need these dummy functions, or tinymail will complain */
177 get_password_dummy (TnyAccount *account, const gchar *prompt, gboolean *cancel)
182 forget_password_dummy (TnyAccount *account)
187 /* create a pseudo-account for our local folders */
189 get_local_folders_account (ModestTnyAccountStore *self)
191 TnyStoreAccount *tny_account;
193 gchar *maildir, *url_string;
194 ModestTnyAccountStorePrivate *priv;
196 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
198 tny_account = tny_camel_store_account_new ();
200 g_printerr ("modest: cannot create account for local folders");
204 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account),priv->tny_session_camel);
206 maildir = modest_local_folder_info_get_maildir_path ();
207 url = camel_url_new ("maildir:", NULL);
208 camel_url_set_path (url, maildir);
209 url_string = camel_url_to_string (url, 0);
211 tny_account_set_url_string (TNY_ACCOUNT(tny_account), url_string);
212 tny_account_set_name (TNY_ACCOUNT(tny_account), MODEST_LOCAL_FOLDERS_ACCOUNT_NAME);
213 tny_account_set_id (TNY_ACCOUNT(tny_account), MODEST_LOCAL_FOLDERS_ACCOUNT_NAME);
214 tny_account_set_forget_pass_func (TNY_ACCOUNT(tny_account), forget_password_dummy);
215 tny_account_set_pass_func (TNY_ACCOUNT(tny_account), get_password_dummy);
217 camel_url_free (url);
221 return TNY_ACCOUNT(tny_account);
227 on_account_removed (ModestAccountMgr *acc_mgr, const gchar *account, gboolean server_account,
230 ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
232 g_signal_emit (G_OBJECT(self), signals[ACCOUNT_UPDATE_SIGNAL], 0,
239 on_account_changed (ModestAccountMgr *acc_mgr, const gchar *account, gboolean server_account,
240 const gchar *key, gpointer user_data)
242 ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
244 g_signal_emit (G_OBJECT(self), signals[ACCOUNT_UPDATE_SIGNAL], 0,
249 static ModestTnyAccountStore*
250 get_account_store_for_account (TnyAccount *account)
252 return MODEST_TNY_ACCOUNT_STORE(g_object_get_data (G_OBJECT(account),
258 on_password_requested (ModestTnyAccountStore *account_store,
259 const gchar* account_name,
265 GtkWidget *dialog, *entry, *remember_pass_check;
267 dialog = gtk_dialog_new_with_buttons (_("Password requested"),
276 txt = g_strdup_printf (_("Please enter your password for %s"), account_name);
277 gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
281 entry = gtk_entry_new_with_max_length (40);
282 gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
283 gtk_entry_set_invisible_char (GTK_ENTRY(entry), 0x2022); /* bullet unichar */
285 gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
288 remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
289 gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
292 gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
294 if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
295 *password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
302 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (remember_pass_check)))
307 gtk_widget_destroy (dialog);
311 get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
314 const TnyAccountStore *account_store;
315 ModestTnyAccountStore *self;
316 ModestTnyAccountStorePrivate *priv;
319 gboolean already_asked;
322 key = tny_account_get_id (account);
323 account_store = TNY_ACCOUNT_STORE(get_account_store_for_account (account));
325 self = MODEST_TNY_ACCOUNT_STORE (account_store);
326 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
328 /* is it in the hash? if it's already there, it must be wrong... */
329 pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
330 * type-punned ptrs...*/
331 already_asked = g_hash_table_lookup_extended (priv->password_hash,
334 (gpointer*)&pwd_ptr);
336 /* if the password is not already there, try ModestConf */
337 if (!already_asked) {
338 pwd = modest_account_mgr_get_string (priv->account_mgr,
339 key, MODEST_ACCOUNT_PASSWORD,
341 g_hash_table_insert (priv->password_hash, g_strdup (key), g_strdup (pwd));
344 /* if it was already asked, it must have been wrong, so ask again */
345 if (already_asked || !pwd || strlen(pwd) == 0) {
347 /* we don't have it yet. Get the password from the user */
348 const gchar* name = tny_account_get_name (account);
352 on_password_requested (self, name, &pwd, cancel, &remember);
356 modest_account_mgr_set_string (priv->account_mgr,
357 key, MODEST_ACCOUNT_PASSWORD,
360 /* We need to dup the string even knowing that
361 it's already a dup of the contents of an
362 entry, because it if it's wrong, then camel
364 g_hash_table_insert (priv->password_hash, g_strdup (key), g_strdup(pwd));
366 g_hash_table_remove (priv->password_hash, key);
378 forget_password (TnyAccount *account)
380 ModestTnyAccountStore *self;
381 ModestTnyAccountStorePrivate *priv;
382 const TnyAccountStore *account_store;
386 account_store = TNY_ACCOUNT_STORE(get_account_store_for_account (account));
387 self = MODEST_TNY_ACCOUNT_STORE (account_store);
388 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
389 key = tny_account_get_id (account);
391 /* Do not remove the key, this will allow us to detect that we
392 have already asked for it at least once */
393 pwd = g_hash_table_lookup (priv->password_hash, key);
395 memset (pwd, 0, strlen (pwd));
396 g_hash_table_insert (priv->password_hash, g_strdup (key), NULL);
399 /* Remove from configuration system */
400 modest_account_mgr_unset (priv->account_mgr,
401 key, MODEST_ACCOUNT_PASSWORD,
405 /* create a tnyaccount for the server account connected to the account with name 'key'
408 get_tny_account_from_server_account (ModestTnyAccountStore *self,
409 ModestServerAccountData *account_data, TnyAccountType type)
411 TnyAccount *tny_account;
412 ModestTnyAccountStorePrivate *priv;
414 g_return_val_if_fail (self, NULL);
415 g_return_val_if_fail (account_data, NULL);
417 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
420 if (account_data->proto == MODEST_PROTOCOL_UNKNOWN) {
421 g_printerr ("modest: '%s' does not provide a protocol\n",
422 account_data->account_name);
425 if ((account_data->proto == MODEST_PROTOCOL_TYPE_TRANSPORT && type != TNY_ACCOUNT_TYPE_TRANSPORT) ||
426 (account_data->proto == MODEST_PROTOCOL_TYPE_STORE && type != TNY_ACCOUNT_TYPE_STORE)) {
427 g_printerr ("modest: protocol types do not match <%d,%d>\n", account_data->proto, type);
431 switch (account_data->proto) {
432 case MODEST_PROTOCOL_TRANSPORT_SENDMAIL:
433 case MODEST_PROTOCOL_TRANSPORT_SMTP:
434 tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ()); break;
435 case MODEST_PROTOCOL_STORE_POP:
436 tny_account = TNY_ACCOUNT(tny_camel_pop_store_account_new ()); break;
437 case MODEST_PROTOCOL_STORE_IMAP:
438 tny_account = TNY_ACCOUNT(tny_camel_imap_store_account_new ()); break;
439 case MODEST_PROTOCOL_STORE_MAILDIR:
440 case MODEST_PROTOCOL_STORE_MBOX:
441 tny_account = TNY_ACCOUNT(tny_camel_store_account_new()); break;
443 g_return_val_if_reached (NULL);
447 g_printerr ("modest: could not create tny account for '%s'\n",
448 account_data->account_name);
451 tny_account_set_id (tny_account, account_data->account_name);
454 * FIXME --> bug in tinymail
456 if (type == TNY_ACCOUNT_TYPE_TRANSPORT) {
457 g_printerr ("modest: BUG: cannot create transports accounts... stay tuned\n");
458 g_object_unref (G_OBJECT(tny_account));
462 tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account), priv->tny_session_camel);
463 tny_account_set_forget_pass_func (tny_account, forget_password);
464 tny_account_set_pass_func (tny_account, get_password);
467 tny_account_set_proto (tny_account,
468 modest_protocol_info_get_protocol_name(account_data->proto));
469 g_object_set_data (G_OBJECT(tny_account), "account_store", (gpointer)self);
471 if (account_data->uri)
472 tny_account_set_url_string (TNY_ACCOUNT(tny_account), account_data->uri);
474 if (account_data->options) {
475 GSList *options = account_data->options;
477 tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account),
479 options = g_slist_next (options);
482 if (account_data->username)
483 tny_account_set_user (tny_account, account_data->username);
484 if (account_data->hostname)
485 tny_account_set_hostname (tny_account, account_data->hostname);
493 modest_tny_account_store_finalize (GObject *obj)
495 ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(obj);
496 ModestTnyAccountStorePrivate *priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
498 if (priv->tny_session_camel) {
499 camel_object_unref (CAMEL_OBJECT(priv->tny_session_camel));
500 priv->tny_session_camel = NULL;
503 g_free (priv->cache_dir);
504 priv->cache_dir = NULL;
507 g_object_unref (priv->device);
511 if (priv->password_hash) {
512 g_hash_table_destroy (priv->password_hash);
513 priv->password_hash = NULL;
516 if (priv->account_mgr) {
517 g_object_unref (priv->account_mgr);
518 priv->account_mgr = NULL;
521 G_OBJECT_CLASS(parent_class)->finalize (obj);
525 ModestTnyAccountStore*
526 modest_tny_account_store_new (ModestAccountMgr *account_mgr) {
529 ModestTnyAccountStorePrivate *priv;
531 g_return_val_if_fail (account_mgr, NULL);
533 obj = G_OBJECT(g_object_new(MODEST_TYPE_TNY_ACCOUNT_STORE, NULL));
534 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj);
536 priv->account_mgr = account_mgr;
537 g_object_ref (G_OBJECT(priv->account_mgr));
539 /* The session needs the platform factory */
540 priv->tny_session_camel = tny_session_camel_new (TNY_ACCOUNT_STORE(obj));
541 if (!priv->tny_session_camel) {
542 g_printerr ("modest: cannot create TnySessionCamel instance\n");
543 g_object_unref (obj);
547 tny_session_camel_set_ui_locker (priv->tny_session_camel, tny_gtk_lockable_new ());
548 /* FIXME: unref this in the end? */
550 /* Connect signals */
551 g_signal_connect (G_OBJECT(account_mgr), "account_changed",
552 G_CALLBACK (on_account_changed), obj);
553 g_signal_connect (G_OBJECT(account_mgr), "account_removed",
554 G_CALLBACK (on_account_removed), obj);
556 return MODEST_TNY_ACCOUNT_STORE(obj);
561 get_tny_account_from_account (ModestTnyAccountStore *self, ModestAccountData *account_data,
564 TnyAccount *tny_account = NULL;
565 ModestServerAccountData *server_account = NULL;
567 if (type == TNY_ACCOUNT_TYPE_STORE && account_data->store_account)
568 server_account = account_data->store_account;
569 else if (type == TNY_ACCOUNT_TYPE_TRANSPORT && account_data->transport_account)
570 server_account = account_data->transport_account;
572 if (!server_account) {
573 g_printerr ("modest: no %s account defined for '%s'\n",
574 type == TNY_ACCOUNT_TYPE_STORE ? "store" : "transport",
575 account_data->display_name);
579 tny_account = get_tny_account_from_server_account (self, server_account, type);
581 g_printerr ("modest: failed to create tny account for %s (%s)\n",
582 account_data->account_name, server_account->account_name);
586 /* this name is what shows up in the folder view -- so for some POP/IMAP/... server
587 * account, we set its name to the acount of which it is part */
588 if (account_data->display_name)
589 tny_account_set_name (tny_account, account_data->display_name);
596 modest_tny_account_store_get_accounts (TnyAccountStore *account_store, TnyList *list,
597 TnyGetAccountsRequestType request_type)
600 ModestTnyAccountStore *self;
601 ModestTnyAccountStorePrivate *priv;
602 GSList *accounts, *cursor;
604 g_return_if_fail (account_store);
605 g_return_if_fail (TNY_IS_LIST(list));
606 g_return_if_fail (request_type == TNY_ACCOUNT_STORE_STORE_ACCOUNTS ||
607 request_type == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS ||
608 request_type == TNY_ACCOUNT_STORE_BOTH);
610 self = MODEST_TNY_ACCOUNT_STORE(account_store);
611 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
613 if (request_type == TNY_ACCOUNT_STORE_BOTH) {
614 modest_tny_account_store_get_accounts (account_store, list,
615 TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
616 modest_tny_account_store_get_accounts (account_store, list,
617 TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS);
622 * confusingly, tinymail uses both TnyAccountRequestType and TnyAccountType
624 switch (request_type) {
625 case TNY_ACCOUNT_STORE_STORE_ACCOUNTS : type = TNY_ACCOUNT_TYPE_STORE; break;
626 case TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS: type = TNY_ACCOUNT_TYPE_TRANSPORT; break;
627 default: g_return_if_reached (); /* 'BOTH' is not possible here */
630 accounts = modest_account_mgr_account_names (priv->account_mgr, NULL);
631 for (cursor = accounts; cursor; cursor = cursor->next) {
632 TnyAccount *tny_account = NULL;
633 ModestAccountData *account_data =
634 modest_account_mgr_get_account_data (priv->account_mgr,
635 (gchar*)cursor->data);
636 if (account_data && account_data->is_enabled) {
637 tny_account = get_tny_account_from_account (self, account_data, type);
639 tny_list_prepend (list, G_OBJECT(tny_account));
640 g_object_unref (G_OBJECT(tny_account));
643 g_free (cursor->data);
644 modest_account_mgr_free_account_data (priv->account_mgr, account_data);
646 g_slist_free (accounts);
648 /* also, add the local folder pseudo-account */
649 if (request_type != TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS) {
650 if (!priv->local_folders)
651 priv->local_folders = get_local_folders_account (self);
652 if (!priv->local_folders)
653 g_printerr ("modest: no local folders account\n");
655 tny_list_prepend (list, G_OBJECT(priv->local_folders));
660 modest_tny_account_store_get_cache_dir (TnyAccountStore *self)
662 ModestTnyAccountStorePrivate *priv;
663 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
665 if (!priv->cache_dir)
666 priv->cache_dir = g_build_filename (g_get_home_dir(),
670 return priv->cache_dir;
675 * callers need to unref
678 modest_tny_account_store_get_device (TnyAccountStore *self)
680 ModestTnyAccountStorePrivate *priv;
682 priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
685 priv->device = tny_platform_factory_new_device
686 (modest_tny_platform_factory_get_instance());
688 return g_object_ref (G_OBJECT(priv->device));
694 modest_tny_account_store_alert (TnyAccountStore *self, TnyAlertType type,
697 GtkMessageType gtktype;
698 gboolean retval = FALSE;
703 case TNY_ALERT_TYPE_INFO:
704 gtktype = GTK_MESSAGE_INFO;
706 case TNY_ALERT_TYPE_WARNING:
707 gtktype = GTK_MESSAGE_WARNING;
709 case TNY_ALERT_TYPE_ERROR:
711 gtktype = GTK_MESSAGE_ERROR;
715 dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
716 gtktype, GTK_BUTTONS_YES_NO, prompt);
718 if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
721 gtk_widget_destroy (dialog);
729 modest_tny_account_store_add_store_account (TnyAccountStore *self,
730 TnyStoreAccount *account)
732 /* we should not need this...*/
733 g_printerr ("modest: add_store_account_func not implemented\n");
738 modest_tny_account_store_add_transport_account (TnyAccountStore *self,
739 TnyTransportAccount *account)
741 /* we should not need this...*/
742 g_printerr ("modest: add_transport_account_func not implemented\n");
748 modest_tny_account_store_init (gpointer g, gpointer iface_data)
750 TnyAccountStoreIface *klass;
752 g_return_if_fail (g);
754 klass = (TnyAccountStoreIface *)g;
756 klass->get_accounts_func =
757 modest_tny_account_store_get_accounts;
758 klass->add_transport_account_func =
759 modest_tny_account_store_add_transport_account;
760 klass->add_store_account_func =
761 modest_tny_account_store_add_store_account;
762 klass->get_cache_dir_func =
763 modest_tny_account_store_get_cache_dir;
764 klass->get_device_func =
765 modest_tny_account_store_get_device;
767 modest_tny_account_store_alert;
771 modest_tny_account_store_set_get_pass_func (ModestTnyAccountStore *self,
772 ModestTnyGetPassFunc func)
774 /* not implemented, we use signals */
775 g_printerr ("modest: set_get_pass_func not implemented\n");
779 tny_account_store_get_session (TnyAccountStore *self)
781 g_return_val_if_fail (self, NULL);
782 return MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self)->tny_session_camel;
787 modest_tny_account_store_get_local_folders_account (ModestTnyAccountStore *self)
789 g_return_val_if_fail (self, NULL);
791 return MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self)->local_folders;