Oh no! Philip is on crack again!



A sample Tinymail 2.0 API ...

So this is a mockup of what I have in mind ... at a very high level:

So this is zooming out at big-city/country size.

Indeed, Header is gone. That should be an implementation detail of
Message. And I also think that this would be doable too. A year ago or
so me and Dirk-Jan where discussing this, and it was his idea to simply
get rid of Header and make it an implementation detail of Message.


Some pointers:

http://svn.gnome.org/viewvc/libgee/trunk/gee/collection.vala
http://svn.gnome.org/viewvc/libgee/trunk/gee/iterable.vala
http://svn.gnome.org/viewvc/libgee/trunk/gee/iterator.vala
http://svn.gnome.org/viewvc/glib/trunk/gio/ginputstream.h
http://svn.gnome.org/viewvc/glib/trunk/gio/goutputstream.h
http://svn.gnome.org/viewvc/glib/trunk/gio/gcancellable.h
http://svn.gnome.org/viewvc/glib/trunk/gio/gasyncresult.h


namespace TinyMail {

	public class MimePart: Gee.Iterable <MimePart> {
		string Filename { get; }
		string Description { get; }
		string ContentId { get; }
		string ContentType { get; }
		gboolean IsAttachment { get; }

		void DecodeToStream (GIO.OutputStream stream);
		void DecodeToStreamAsync (GIO.OutputStream stream, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
	}

	public class WritableMimePart: MimePart, Gee.Collection <MimePart> {
		void SetFilename (string filename);
		void SetDescription (string desc);
		void SetContentId (string contentid);
		void SetContentType (string type);

		// Note: adding and removing parts is API in Gee.Collection

		void Construct (GIO.InputStream stream, string mimetype, string transferencoding);
	}

	public class WritableMessage: Message, WritableMimePart {
		void SetFrom (string str);
		void SetTo (string str);
		void SetCc (string str);
		...
	}

	public interface Message: MimePart {
		string From { get; }
		string To { get; }
		string Cc { get; }
		...
	}

	private class MessageIterator: Gee.Iterator <Message> {
	}

	public class MessageContainerChangeSet {
		GetAdded (Gee.Collection <Message> list);
		GetRemoved (Gee.Collection <Message> list);
	}

	public interface MessageContainer: Gee.Iterable <Message> {
		signal void Changed (MessageContainerChangeSet change_set);
	}

	public abstract class SearchResult: MessageContainer {
	}

	public abstract class Folder: MessageContainer, Gee.Collection <Message> {
		void SyncronizeAsync (GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
		void RefreshAsync (GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);

		void AddAsync (Message message, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
		void RemoveAsync (Gee.List <Message> messages, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
		void TransferAsync (Gee.List <Message> messages, Folder target, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
		void CopyAsync (Gee.List <Message> messages, FolderStore target, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
	}

	public interface MessageContainerStore {
		signal void Changed (MessageContainerStoreChangeSet change_set);
	}

	public class MessageContainerRename {
		string From { get; }
		MessageContainer To { get; }
	}

	public class MessageContainerStoreChangeSet {
		void GetAdded (Gee.Collection <MessageContainer> list);
		void GetRemoved (Gee.Collection <MessageContainer> list);
		void GetRenamed (Gee.Collection <MessageContainerRename> list);
	}

	public interface FolderStore: MessageContainerStore {
		void GetFoldersAsync (Gee.Container list, GIO.Cancellable cancel, GIO.AsyncReadyCallback callback);
	}

	public interface PasswordRequester {
		string RequestPassword ();
		void ForgetIncorrectPassword ();
	}

	public interface Account: PasswordRequester {
		string Name { get; set; }
		string Proto { get; set; }
		string User { get; set; }
		string Host { get; set; }
		int port { get; set; }
		string AuthMech { get; set; }
		string UrlString { get; set; }
	}

	public class Query {
		public ArrayList InFolders;
		public string Subject;
		public string From;
		public string To;
		public string Cc;
		public string Bcc;
		public time_t Sent;
		public time_t Received;
	}

	public interface StoreAccount: FolderStore {
		SearchResult Find (Query query);
	}


	public interface TransportAccount {
		void Send (Message message);
	}

	public interface SendQueue {
		Folder Outbox { get; }
		Folder Sentbox { get; }
	}
}


-- 
Philip Van Hoof, freelance software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://pvanhoof.be/blog
http://codeminded.be






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]