Re: How to cancel a tny_transport_account_send?



Philip Van Hoof wrote:
> On Mon, 2008-01-21 at 15:20 +0100, Sergio Villar Senin wrote:
>> Philip Van Hoof wrote:
>>
>>> Anyway, keep in mind atomicy when cancelling: don't promise the user you
>>> cancelled something if you have just sent the last byte to the SMTP
>>> server. You wont have cancelled the sending of the message.
>>>
>>> It's also quite hard to make any promise to the user about his
>>> cancellation. You never know how far it got. You also don't control what
>>> the SMTP server will do with the partial message.
>> So, would you be in favour of adding the start/stop_operation stuff to
>> the send queue?
> 
> What about convincing me with a fine patch? :)

Actually it's quite simple :-)

Br
Index: tny-camel-send-queue.c
===================================================================
--- tny-camel-send-queue.c	(revision 3283)
+++ tny-camel-send-queue.c	(working copy)
@@ -446,8 +446,13 @@
 
 			if (err == NULL) 
 			{
+				_tny_camel_account_start_camel_operation (TNY_CAMEL_ACCOUNT (priv->trans_account),
+									  NULL, NULL, "Sending message");
+
 				tny_transport_account_send (priv->trans_account, msg, &err);
 
+				_tny_camel_account_stop_camel_operation (TNY_CAMEL_ACCOUNT (priv->trans_account));
+
 				if (err != NULL) {
 					emit_error (self, header, msg, err, i, priv->total);
 					g_hash_table_insert (failed_headers, 


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