+ }
+
+ /* Do this here, in case create_per_account_local_outbox_folders() needs it. */
+ if (type == TNY_ACCOUNT_TYPE_TRANSPORT) {
+ /* Store the cache: */
+ priv->transport_accounts = accounts;
+ }
+
+ /* We also create a per-account local outbox folder (a _store_ account)
+ * for each _transport_ account. */
+ if (type == TNY_ACCOUNT_TYPE_TRANSPORT) {
+ /* Now would be a good time to create the per-account local outbox folder
+ * _store_ accounts corresponding to each transport account: */
+ if (!priv->store_accounts_outboxes) {
+ create_per_account_local_outbox_folders (self);
+ }
+ }
+
+ /* But we only return the per-account local outbox folder when
+ * _store_ accounts are requested. */
+ if (type == TNY_ACCOUNT_TYPE_STORE) {
+ /* Create them if necessary,
+ * (which also requires creating the transport accounts,
+ * if necessary.) */
+ if (!priv->store_accounts_outboxes) {
+ create_per_account_local_outbox_folders (self);
+ }
+
+ /* Add them to the TnyList: */
+ if (priv->store_accounts_outboxes) {
+ GSList *iter = NULL;
+ for (iter = priv->store_accounts_outboxes; iter; iter = g_slist_next (iter)) {
+ TnyAccount *outbox_account = (TnyAccount*)iter->data;
+ if (list && outbox_account)
+ tny_list_prepend (list, G_OBJECT(outbox_account));
+
+ accounts = g_slist_append (accounts, outbox_account);
+ }
+ }
+ }
+
+ if (type == TNY_ACCOUNT_TYPE_STORE) {
+ /* Store the cache: */
+ priv->store_accounts = accounts;
+ }