Re: TNY_HEADER_FLAG_CACHED and TNY_HEADER_FLAG_PARTIAL



The Internet connection is restored, and this has been committed

On Sun, 2007-01-14 at 04:21 +0100, Philip Van Hoof wrote:
> Hey Dirk-Jan, and the mailing list,
> 
> Today there's something wrong with my Internet connection. My ISP is
> somehow redirecting all detected HTTP traffic to a page that explains
> that "their world wide web service is experiencing difficulties". Sigh.
> 
> All other ports work perfectly. I can of course setup a bunch of proxies
> on one of my servers and stuff like that. However. It's not that urgent
> and I can E-mail the diff, right?
> 
> This diff implements setting the two new flags:
> 
> TNY_HEADER_FLAG_CACHED and TNY_HEADER_FLAG_PARTIAL
> 
> The first means that the message is cached, the second one means that
> the message is partially cached. The second one is only on of the first
> one is on and the message is indeed partially cached.
> 
> A requirement was to make it possible to know whether (1) header-only is
> received, (2) full e-mail or (3) emails without attachments.
> 
> This maps to:
> 
> (1): TNY_HEADER_FLAG_CACHED is off and TNY_HEADER_FLAG_PARTIAL is off
> (2): TNY_HEADER_FLAG_CACHED is on and TNY_HEADER_FLAG_PARTIAL is off
> (3): TNY_HEADER_FLAG_CACHED is on and TNY_HEADER_FLAG_PARTIAL is on
> 
> A next requirement is to make it possible to limit the amount of E-mails
> and the individual message size of the E-mail.
> 
> Maybe we should do some chatting about this, Dirk-Jan? :-) Like how the
> API for this should look?
> 
> My current idea is to add a size attribute to the CamelMessageInfoBase
> structure and perhaps reflect that to a an API like "ssize_t
> tny_header_get_msg_size (TnyHeader *self)" or something like that.
> 
> The possibility to choose whether or not to download it, can be
> implemented in a TnyMsgReceiveStrategy: 
> 
> Yes it can, that type is not only implementable so that you can classify
> between partial and full. You can also implement a "don't-receive-it"
> strategy of course. For example one that returns a message that says
> "this message is too big, it won't fit on this device. Consider turning
> on partial retrieval.".
> 
> 
> TnyCamelRefuseMsgReceiveStrategy inherits TnyCamelFullMsgReceiveStrategy
> {
> 	TnyMsg * perform_get_msg (TnyHeader *header)
> 	{
> 
> 		if (tny_header_get_msg_size (header) > 10000)
> 		{
> 			if (!refuse_msg)
> 				refuse_msg = create_refuse_msg ();
> 			return refuse_msg;
> 		} else
> 			return super->perform_get_msg (header);
> 	}
> 
> }
> 
> TnyFolder *folder = ...
> TnyCamelRefuseMsgReceiveStrategy *s = new ...
> TnyMsg *msg; TnyHeader *header = ...;
> TnyMsgView *view = ...;
> 
> tny_folder_set_msg_receive_strategy (folder, s);
> msg = tny_folder_get_msg (folder, header);
> 
> tny_msg_view_set_msg (view, msg);
> 
> 
> Yadi yada ... in other words: let's talk about this? Monday?
> 
> 
> _______________________________________________
> tinymail-devel-list mailing list
> tinymail-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/tinymail-devel-list
-- 
Philip Van Hoof, software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://www.pvanhoof.be/blog







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