/* FIXME: Need a cleanup funciton for when object is deactivated */ void mail_autoreceive_init (EMailSession *session) { GList *accounts = NULL; GList *link; if (auto_active) return; accounts = mail_get_store_accounts(); auto_active = g_hash_table_new (g_str_hash, g_str_equal); g_signal_connect ( source_registry, "source-added", G_CALLBACK (auto_account_added), session); g_signal_connect ( source_registry, "source-enabled", G_CALLBACK (auto_account_added), session); g_signal_connect ( source_registry, "source-removed", G_CALLBACK (auto_account_removed), NULL); g_signal_connect ( source_registry, "source-disabled", G_CALLBACK (auto_account_removed), NULL); g_signal_connect ( source_registry, "source-changed", G_CALLBACK (auto_account_changed), session); link = accounts; while (link) { auto_account_added ( source_registry, (ESource *) link->data, session); link = link->next; } if (1) { auto_online (session); /* also flush outbox on start */ mail_send (session); } /* Accounts shouldn't free, that is what runs the account. */ g_list_free (accounts); /* FIXME: Check for online status and sync after online */ }
/* FIXME: Need a cleanup funciton for when object is deactivated */ void mail_autoreceive_init(void) { EAccountList *accounts; EIterator *iter; if (auto_active) return; accounts = mail_config_get_accounts (); auto_active = g_hash_table_new(g_str_hash, g_str_equal); g_signal_connect(accounts, "account-added", G_CALLBACK(auto_account_added), NULL); g_signal_connect(accounts, "account-removed", G_CALLBACK(auto_account_removed), NULL); g_signal_connect(accounts, "account-changed", G_CALLBACK(auto_account_changed), NULL); for (iter = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(iter);e_iterator_next(iter)) auto_account_added(accounts, (EAccount *)e_iterator_get(iter), NULL); camel_object_hook_event(mail_component_peek_session(NULL), "online", auto_online, NULL); }