"Fossies" - the Fresh Open Source Software archive

Member "evolution-brutus-1.2.35/camel/camel-brutus-folder.h" of archive evolution-brutus-1.2.35.tar.gz:


/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/*
 *    Camel Brutus folder class.
 *
 *    Authors:
 *        Jules Colding <colding@42tools.com>
 *
 *    Copyright (C) 2005-2007 OMC Denmark ApS.
 *
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA 02111-1307 USA
 */

#ifndef CAMEL_BRUTUS_FOLDER_H
#define CAMEL_BRUTUS_FOLDER_H 1

#include <camel/camel-mime-message.h>
#include <camel/camel-folder.h>
#include <camel/camel-offline-folder.h>
#include <camel/camel-folder-summary.h>
#include <camel/camel-internet-address.h>
#include <camel/camel-data-cache.h>
#include <camel/camel-multipart.h>

#include "camel-brutus-store.h"

#include <idl_output/IMAPIFolder.h>

G_BEGIN_DECLS

#define FOLDER_MESSAGE_CACHE "message_cache"
#define MESSAGE_CACHE_TIMEOUT 86400 /* 24 hours */

#define CAMEL_BRUTUS_FOLDER_TYPE     (camel_brutus_folder_get_type ())
#define CAMEL_BRUTUS_FOLDER(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_BRUTUS_FOLDER_TYPE, CamelBrutusFolder))
#define CAMEL_BRUTUS_FOLDER_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_BRUTUS_FOLDER_TYPE, CamelBrutusFolderClass))
#define CAMEL_IS_BRUTUS_FOLDER(o)    (CAMEL_CHECK_TYPE((o), CAMEL_BRUTUS_FOLDER_TYPE))

typedef struct _CamelBrutusFolder CamelBrutusFolder;
typedef struct _CamelBrutusFolderClass CamelBrutusFolderClass;

struct _CamelBrutusFolder {
	CamelOfflineFolder parent_object;

	CamelFolderSearch *search;

	GMutex *summary_mutex;   // serialize folder summary operations
	GMutex *cache_mutex;     // serialize message cache operations
	GMutex *finalize_mutex;  // will signal to the caching thread that it shall terminate

	GThread *offline_caching_thread; // thread to monitor sync_offline being checked

	// message cache
	CamelDataCache *msg_cache;

	// Message stores are misinterpreted as real folders by Evolution. 
	// We must therefore be able to destinguish the real folders. 
	gboolean is_a_folder;

	// TRUE if this is an online folder. Offline folders are
	// strictly read-only
	gboolean online;

	// Brutus objects
	BRUTUS_IMAPISession mapi_session;
	BRUTUS_IMAPIFolder mapi_folder;

	// Must ping this before trying to establish any kind of
	// CORBA connection or we will just wait for ever 
	// in pthread_cond_wait()
	gchar *brutus_server;

	char session_key[37]; // uuid to distinguish between different run-time sessions in the summary header
};

struct _CamelBrutusFolderClass {
	CamelOfflineFolderClass parent_class;

	/* Virtual methods */
};

/* Standard Camel function */
extern CamelType camel_brutus_folder_get_type(void);

extern CamelFolder *camel_brutus_folder_new_offline(CamelStore *store,
						    const char *folder_name,
						    guint32 flags,
						    CamelException *ex);

extern CamelFolder *camel_brutus_folder_new(CamelStore *store,
					    const char *folder_name,
					    guint32 flags,
					    CamelException *ex);

extern CamelFolder *camel_brutus_folder_wrap(CamelStore *store,
					     BRUTUS_IMAPIFolder mapi_folder,
					     CamelException *ex);

G_END_DECLS

#endif /* CAMEL_BRUTUS_FOLDER_H */