Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9248545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:58:05+00:00 2026-06-18T09:58:05+00:00

In an app I am programming I am currently using IMAP’s search function to

  • 0

In an app I am programming I am currently using IMAP’s search function to get the email ID, this is nice as it is a simple and easy task however I was wondering as the server gets fuller will this be detrimental to the search speed (which is currently speedy) and if so is worth dealing with the IMAP idle command and twisted.internet.mail.

I already have IDLE implemented by this

class Command(object):
    _1_RESPONSES = ('CAPABILITY', 'FLAGS', 'LIST', 'LSUB', 'STATUS', 'SEARCH', 'NAMESPACE')
    _2_RESPONSES = ('EXISTS', 'EXPUNGE', 'FETCH', 'RECENT')
    _OK_RESPONSES = ('UIDVALIDITY', 'UNSEEN', 'READ-WRITE', 'READ-ONLY', 'UIDNEXT', 'PERMANENTFLAGS')
    defer = None

    def __init__(self, command, args=None, wantResponse=(),
                 continuation=None, *contArgs, **contKw):
        self.command = command
        self.args = args
        self.wantResponse = wantResponse
        self.continuation = lambda x: continuation(x, *contArgs, **contKw)
        self.lines = []

    def format(self, tag):
        if self.args is None:
            return ' '.join((tag, self.command))
        return ' '.join((tag, self.command, self.args))

    def finish(self, lastLine, unusedCallback):
        send = []
        unuse = []
        for L in self.lines:
            names = parseNestedParens(L)
            N = len(names)
            if (N >= 1 and names[0] in self._1_RESPONSES or
                N >= 2 and names[1] in self._2_RESPONSES or
                N >= 1 and names[0] in self.wantResponse or # allows for getting the responses you want, twisted doesn't seem to do that at least with the idle command
                N >= 2 and names[1] in self.wantResponse or # same as above line just with 2_RESPONSES check
                N >= 2 and names[0] == 'OK' and isinstance(names[1], types.ListType) and names[1][0] in self._OK_RESPONSES):
                send.append(names)
            else:
                unuse.append(names)
        d, self.defer = self.defer, None
        d.callback((send, lastLine))
        if unuse:
            unusedCallback(unuse)

IDLE Command being sent

    cmd = Command("IDLE", continuation = self.a)
    d = self.imap_connection.sendCommand(cmd)
    return d

Now the reason I am hesitant with IDLE is first off if the server doesn’t support it I then can’t use it (though this isn’t the primary reason), I also don’t wish to is because the response of the idle command are unmarked response and how to know they are for the IDLE command.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:58:06+00:00Added an answer on June 18, 2026 at 9:58 am

    From the RFC:

    The IDLE command is sent from the client to the server when the
    client is ready to accept unsolicited mailbox update messages.

    So, if there are other commands in progress – the results of which you might confuse with an untagged response to an IDLE command – do not send the IDLE command.

    Only send IDLE when you’re prepared to interpret its untagged responses correctly. 🙂

    Or put more simply, don’t use IDLE concurrently with any other commands. Then, when you are using IDLE, you know all untagged responses are for the IDLE command.

    At least, that’s probably right. As with any IMAP4 topic… who really knows. You probably need to examine the servers you want to interoperate with and see if their behavior actually matches the vision laid out in the RFCs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is no typical programming question. I am currently developing an app using the
I'm programming my very first GUI app in Java using the Swing framework. I've
I'm currently programming an app for iphone that uses the tab bar. One of
I am currently programming a ASP.NET MVC3 application, using Entity Framework 4. There are
Im using backbone, require.js and coffeescript in a application. Programming my app, discovered i
I am currently using XCode 3.2.3 and iOS4. I'm working on an app that
currently i`m planning to create mobile app by using jQtouch and Phonegap. The application
I'm currently programming a Mac-native interface for CraftBukkit using MacRuby and XCode. Right now,
I'm diving into iOS programming and am using Core Data in my app to
I'm currently attempting to make a simple 2D CAD-type viewer app for Android. Basically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.