+static void
+modest_transport_account_decorator_cancel (TnyAccount *self)
+{
+ TnyTransportAccount *conn_specific_account = NULL;
+ ModestTnyAccountStore *store = modest_runtime_get_account_store ();
+ const gchar *account_name;
+
+ g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT (self));
+
+ account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (self);
+ if (account_name) {
+ conn_specific_account = (TnyTransportAccount *)
+ modest_tny_account_store_get_smtp_specific_transport_account_for_open_connection (store, account_name);
+ }
+
+ /* Cancel sending in the connection specific transport account */
+ if (conn_specific_account) {
+ tny_account_cancel (TNY_ACCOUNT (conn_specific_account));
+ g_object_unref (conn_specific_account);
+ }
+
+ /* Also cancel the transport account, we could not be sure
+ which one was used to send each email */
+ TNY_CAMEL_ACCOUNT_CLASS(parent_class)->cancel (self);
+}
+