/* Evolution Mail Data Interface
*
* Copyright (C) 2005 Novell, Inc.
*
* Authors: Michael Zucchi <notzed@novell.com>
*/
#ifndef _EVOLUTION_DATASERVER_MAIL_IDL_
#define _EVOLUTION_DATASERVER_MAIL_IDL_
#include <Bonobo.idl>
module Evolution {
module Mail {
/* ********************************************************************** */
// NB: tiny subset of omg properties service
typedef string PropertyName;
typedef sequence <PropertyName> PropertyNames;
struct Property {
PropertyName name;
any value;
};
typedef sequence <Property> Properties;
/* ********************************************************************** */
// exceptions
enum ErrorType {
SYSTEM_ERROR,
CAMEL_ERROR,
FAILED,
NOT_SUPPORTED,
NO_PERMISSION
};
exception MailException {
ErrorType id;
string desc;
};
/* ********************************************************************** */
// Main interfaces
interface Folder;
typedef sequence<Folder> Folders;
struct FolderInfo {
string name;
string full_name;
Folder folder;
};
typedef sequence <FolderInfo> FolderInfos;
interface Store;
typedef sequence<Store> Stores;
struct StoreInfo {
string name;
string uid;
Store store;
};
typedef sequence <StoreInfo> StoreInfos;
interface Session;
// **********************************************************************
// MessageInfo wrappers
typedef string UserFlag;
typedef sequence <UserFlag> UserFlags;
struct UserTag {
string name;
string value; // value == "" == unset
};
typedef sequence <UserTag> UserTags;
struct MessageInfo {
string uid;
string subject;
string to;
string from;
long flags; // CamelMessageInfo flag bits
UserFlags userFlags;
UserTags userTags;
};
typedef sequence <MessageInfo> MessageInfos;
// Used to pass to altering functions
struct MessageInfoSet {
string uid;
long flagSet; // values bits to set in the flags
long flagMask; // mask of bits to change in the flags
UserFlags userFlagSet;
UserFlags userFlagUnset;
UserTags userTags;
};
typedef sequence <MessageInfoSet> MessageInfoSets;
/* ********************************************************************** */
/* Messages are passed as full rfc822 encoded messages in a stream */
typedef sequence <octet>Buffer;
interface MessageStream : Bonobo::Unknown {
Buffer next(in long size)
raises (MailException);
void dispose();
};
interface MessageIterator : Bonobo::Unknown {
MessageInfos next(in long limit)
raises (MailException);
void dispose();
};
/* ********************************************************************** */
enum ChangeType {
ADDED,
REMOVED,
CHANGED
};
// ??
struct SessionChange {
ChangeType type;
StoreInfos stores;
};
typedef sequence <SessionChange> SessionChanges;
struct StoreChange {
ChangeType type;
FolderInfos folders;
};
typedef sequence <StoreChange> StoreChanges;
struct FolderChange {
ChangeType type;
MessageInfos messages;
};
typedef sequence <FolderChange> FolderChanges;
/* ********************************************************************** */
/* listeners */
interface SessionListener : Bonobo::Unknown {
oneway void changed(in Session session, in SessionChanges changes);
oneway void shutdown(in Session session);
// We need to use gnome-keyring instead of an interface like this?
// Or does gnome-keyring run off this?
//string getPassword(in Session session, string uri, string domain, string item, string prompt, long flags);
};
interface StoreListener : Bonobo::Unknown {
oneway void changed(in Store store, in StoreChanges changes);
};
interface FolderListener : Bonobo::Unknown {
oneway void changed(in Folder folder, in FolderChanges changes);
};
/* ********************************************************************** */
// If this is done, then Session shouldn't have add/removeListener anymore
// interface Factory : Bonobo::Unknown {
// Session getSession(in string base, in SessionListener listener);
// };
interface Session : Bonobo::Unknown {
boolean getProperties(in PropertyNames names, out Properties props);
StoreInfos getStores(in string pattern, in StoreListener listener)
raises (MailException);
void addListener(in SessionListener listener);
void removeListener(in SessionListener listener);
};
interface Store : Bonobo::Unknown {
boolean getProperties(in PropertyNames names, out Properties props);
FolderInfos getFolders(in string pattern, in FolderListener listener)
raises (MailException);
void sendMessage(in MessageStream msg)
raises (MailException);
};
interface Folder : Bonobo::Unknown {
boolean getProperties(in PropertyNames names, out Properties props);
MessageIterator getMessages(in string pattern)
raises (MailException);
void changeMessages(in MessageInfoSets infos)
raises (MailException);
MessageStream getMessage(in string uid)
raises (MailException);
void appendMessage(in MessageInfoSet info, in MessageStream msg)
raises (MailException);
};
};
};
#endif