 
 
 Account::doASAP = (operation, callback) ->
-    ImapPool.get(@id or @).doASAP operation, callback
+    ImapPool.get(@id).doASAP operation, callback
 
 Account::isTest = ->
     @accountType is 'TEST'
+
+Account::isRefreshing = ->
+    ImapPool.get(@id).isRefreshing
+
+Account::setRefreshing = (value) ->
+    ImapPool.get(@id).isRefreshing = value
 
 # Public: refresh all accounts
 #

Account::imap_fetchMails = (limitByBox, onlyFavorites = false, callback) ->
    log.debug "account#imap_fetchMails", limitByBox, onlyFavorites
    account = this

    @imap_refreshBoxes (err, toFetch, toDestroy) ->


        async.eachSeries accounts, (account, cb) ->
            log.debug "refreshing account #{account.label}"
            return cb null if account.isTest()
            return cb null if account.isRefreshing()
            account.imap_fetchMails limit, onlyFavorites, cb
        , callback

