gboolean poke_all;
TnyFolderObserver *inbox_observer;
guint update_timeout;
+ RetrieveAllCallback retrieve_all_cb;
} UpdateAccountInfo;
ModestAccountMgr *mgr;
ModestAccountRetrieveType retrieve_type;
TnyList *new_headers = NULL;
- gboolean headers_only;
+ gboolean headers_only, ignore_limit;
TnyTransportAccount *transport_account;
ModestTnySendQueue *send_queue;
/* Order by date */
g_ptr_array_sort (new_headers_array, (GCompareFunc) compare_headers_by_date);
- /* TODO: Ask the user, instead of just failing,
- * showing mail_nc_msg_count_limit_exceeded, with 'Get
- * all' and 'Newest only' buttons. */
+ /* Ask the users if they want to retrieve all the messages
+ even though the limit was exceeded */
+ ignore_limit = FALSE;
if (new_headers_array->len > retrieve_limit) {
- /* TODO */
+ /* Ask the user if a callback has been specified and
+ if the mail operation has a source (this means that
+ was invoked by the user and not automatically by a
+ D-Bus method) */
+ if (info->retrieve_all_cb && priv->source)
+ ignore_limit = info->retrieve_all_cb (priv->source,
+ new_headers_array->len,
+ retrieve_limit);
}
if (!headers_only) {
const gint msg_list_size = compute_message_array_size (new_headers_array);
priv->done = 0;
- priv->total = MIN (new_headers_array->len, retrieve_limit);
+ if (ignore_limit)
+ priv->total = new_headers_array->len;
+ else
+ priv->total = MIN (new_headers_array->len, retrieve_limit);
while (msg_num < priv->total) {
TnyHeader *header = TNY_HEADER (g_ptr_array_index (new_headers_array, msg_num));
TnyFolder *folder = tny_header_get_folder (header);
modest_mail_operation_update_account (ModestMailOperation *self,
const gchar *account_name,
gboolean poke_all,
+ RetrieveAllCallback retrieve_all_cb,
UpdateAccountCallback callback,
gpointer user_data)
{
info->callback = callback;
info->user_data = user_data;
info->update_timeout = g_timeout_add (250, timeout_notify_progress, self);
+ info->retrieve_all_cb = retrieve_all_cb;
/* Set account busy */
modest_account_mgr_set_account_busy (modest_runtime_get_account_mgr (), account_name, TRUE);