Add IMAP IDLE support (RFC 2177)#218
Open
tyommik wants to merge 1 commit into
Open
Conversation
Implement IMAP IDLE command for real-time mailbox notifications, allowing clients to receive immediate push updates about new, deleted, and changed messages without polling. Changes: include/mailio/imap.hpp: - Add idle_notification_type_t enum (EXISTS, EXPUNGE, FETCH) - Add idle_response_t struct for parsed server notifications - Add capability() / has_capability() methods for server capability discovery - Add idle() / idle_done() method declarations with private state members src/imap.cpp: - Implement capability() — fetch and cache CAPABILITY response - Implement has_capability() — check for specific capability string - Implement idle() — enter IDLE mode, parse untagged notifications (EXISTS, EXPUNGE, FETCH), handle configurable timeout (default 29 min per RFC, recommended ~10 min for Gmail) - Implement idle_done() — send DONE to terminate IDLE; safe to call from another thread examples/imap_idle.cpp: - Add usage example demonstrating IDLE connection, notification handling, and graceful shutdown Protocol details: - Command sequence: tag IDLE → + continuation → untagged notifications → DONE → tag OK - Requires server IDLE capability advertisement - Must be in Selected mailbox state - Thread-safe design: idle_done() can be called from a separate thread to interrupt idle()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement IMAP IDLE command for real-time mailbox notifications, allowing clients to receive immediate push updates about new, deleted, and changed messages without polling. Changes:
include/mailio/imap.hpp:
src/imap.cpp:
examples/imap_idle.cpp:
Protocol details: