Esempio n. 1
0
/* 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);
}
static void
cache_put (CamelImapMessageCache *cache, const char *uid, const char *key,
	   CamelStream *stream)
{
	char *hash_key;
	GPtrArray *subparts;
	gpointer okey, ostream;
	guint32 uidval;

	uidval = strtoul (uid, NULL, 10);
	if (uidval > cache->max_uid)
		cache->max_uid = uidval;

	subparts = g_hash_table_lookup (cache->parts, uid);
	if (!subparts) {
		subparts = g_ptr_array_new ();
		g_hash_table_insert (cache->parts, g_strdup (uid), subparts);
	}

	if (g_hash_table_lookup_extended (cache->parts, key, &okey, &ostream)) {
		if (ostream) {
			camel_object_unhook_event (ostream, "finalize",
						   stream_finalize, cache);
			g_hash_table_remove (cache->cached, ostream);
			camel_object_unref (ostream);
		}
		hash_key = okey;
	} else {
		hash_key = g_strdup (key);
		g_ptr_array_add (subparts, hash_key);
	}

	g_hash_table_insert (cache->parts, hash_key, stream);
	g_hash_table_insert (cache->cached, stream, hash_key);

	if (stream) {
		camel_object_hook_event (CAMEL_OBJECT (stream), "finalize",
					 stream_finalize, cache);
	}
}
static void
camel_offline_folder_init (CamelOfflineFolder *folder, CamelOfflineFolderClass *klass)
{
	camel_object_hook_event (folder, "folder_changed", (CamelObjectEventHookFunc) offline_folder_changed, NULL);
}