Commit Graph
122 Commits
Author SHA1 Message Date
Oliver Drobnik 510aff7306 Update search function to accept sort criteria and add SortCriteria enum
* Add `sortCriteria` parameter to `search` function in `IMAPServer.swift`
* Create `SortCriteria` enum with options for `DATE`, `ARRIVAL`, `FROM`, `TO`, `SUBJECT`, `SIZE`, and `REVERSE`
* Implement method to convert `SortCriteria` to NIO IMAP types
2025-03-12 15:14:58 +01:00
Oliver Drobnik ce58c2a1b8 Implement SORT command in IMAP
Related to #11

Implement the `SORT` command to allow clients to search and sort messages on the server.

* **SearchCommand.swift**
  - Update `SearchCommand` to accept sort criteria as an optional parameter.
  - Modify `toTaggedCommand` method to handle sort criteria.

* **IMAPServer.swift**
  - Add sort criteria parameter to the existing `search` function.
  - Add capability check for `SORT` before executing `SearchCommand`.
  - Implement fallback to `SEARCH` if `SORT` is not supported.

* **SearchHandler.swift**
  - Update `SearchHandler` to handle responses for both `SEARCH` and `SORT` commands.
  - Modify error handling to include `SORT` command failures.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Cocoanetics/SwiftMail/issues/11?shareId=XXXX-XXXX-XXXX-XXXX).
2025-03-12 15:05:30 +01:00
Oliver Drobnik a7d5501fe7 Enhance IMAP search functionality and error handling 2025-03-11 22:31:57 +01:00
Oliver Drobnik 9ab94677ff Implement basic search functionality in IMAP
Related to #9

Implement basic IMAP search functionality.

* Add `SearchCommand` struct in `Sources/SwiftIMAP/IMAP/Commands/SearchCommand.swift` conforming to `IMAPCommand` protocol.
  * Add properties `identifierSet` and `criteria`.
  * Implement `toTaggedCommand` method to convert to IMAP tagged command.
  * Add initializer to accept `identifierSet` and `criteria` parameters.
* Add `SearchHandler` class in `Sources/SwiftIMAP/IMAP/Handler/SearchHandler.swift` conforming to `IMAPCommandHandler` protocol.
  * Add properties to store search results.
  * Implement `processResponse` method to handle tagged and untagged responses.
  * Implement `handleTaggedOKResponse` and `handleTaggedErrorResponse` methods.
* Add `SearchCriteria` enum in `Sources/SwiftIMAP/Models/SearchCriteria.swift` to model Swift NIO IMAP criteria.
  * Include cases like `.uid(number)`, `.unseen`, `.smaller(number)`, etc.
* Modify `Sources/SwiftIMAP/IMAPServer.swift` to implement `search` function with a generic type `<T: MessageIdentifier>`.
  * Accept parameters: `identifierSet` (optional) and `criteria` (array of enums).
  * Return a collection of message identifiers `[T]`.
  * Switch between `.search` and `.uidSearch` based on the type of `T`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Cocoanetics/SwiftMail/issues/9?shareId=XXXX-XXXX-XXXX-XXXX).
2025-03-11 21:22:31 +01:00
Oliver Drobnik e6b7be58ac Refactor and made safer 2025-03-07 20:20:58 +01:00
Oliver Drobnik a5c507ac98 missing file 2025-03-07 17:08:06 +01:00
Oliver Drobnik 8afc41fb83 builds now 2025-03-07 17:07:59 +01:00
Oliver Drobnik 824ff93c44 implement UNSELECT 2025-03-07 16:29:18 +01:00
Oliver Drobnik 0c14f59f7a Align Linux workaround with unit test 2025-03-07 13:56:05 +01:00
Oliver Drobnik 64517bd3f0 More fixes for Linux 2025-03-07 13:39:55 +01:00
Oliver Drobnik b698b619cd removed unnessary import breaking Linux build 2025-03-07 13:33:16 +01:00
Oliver Drobnik f85038030c Fix build 2025-03-07 12:44:47 +01:00
Oliver Drobnik b1312d7e6a improve email verification 2025-03-07 12:27:26 +01:00
Oliver Drobnik bb4fcc55eb fixed name of file 2025-03-07 12:18:05 +01:00
Oliver Drobnik e6c67ff418 cleanup 2025-03-07 12:14:03 +01:00
Oliver Drobnik fba087d553 Move sanitize function 2025-03-07 12:12:23 +01:00
Oliver Drobnik 1e56faee18 Removed unnessary imports, and implemented Linux functions for MIME handling #3 2025-03-07 12:02:24 +01:00
Oliver Drobnik f920fad29f WIP support for SPECIAL-USE IMAP capability 2025-03-06 21:46:17 +01:00
Oliver Drobnik 62927bdea7 Add convenience method to get latest messages quicker 2025-03-06 10:38:06 +01:00
Oliver Drobnik 4cab991ede change to trace 2025-03-05 21:54:02 +01:00
Oliver Drobnik 76c737a969 experiment with unifying loggers 2025-03-05 21:50:18 +01:00
Oliver Drobnik 3c3804bb84 improve mime type getting 2025-03-05 19:02:34 +01:00
Oliver Drobnik 946409121f attach logo to SMTP demo email 2025-03-05 18:53:51 +01:00
Oliver Drobnik 327d8f132a improve logging 2025-03-05 18:15:19 +01:00
Oliver Drobnik d81f5533da removed some unnecessary logging 2025-03-05 17:36:37 +01:00
Oliver Drobnik fbedb51cb9 Fixed build for catalyst 2025-03-05 17:34:18 +01:00
Oliver Drobnik 8def18ca13 cleanup, move Demos into separate Folder 2025-03-05 17:18:22 +01:00
Oliver Drobnik b2066d39f4 Fixed tests 2025-03-05 17:13:55 +01:00
Oliver Drobnik 335cebc8df Redact AUTH/LOGIN 2025-03-05 16:00:22 +01:00
Oliver Drobnik 17256927d3 Split auth command in two 2025-03-05 15:44:06 +01:00
Oliver Drobnik 0427eaaf89 cleanup 2025-03-05 12:07:23 +01:00
Oliver Drobnik 3c027896b4 Unify mail commands in MailCore 2025-03-05 11:51:56 +01:00
Oliver Drobnik 09594acc42 cleanup 2025-03-05 10:12:24 +01:00
Oliver Drobnik 5409de50f5 removed previous inbound logging 2025-03-05 10:04:51 +01:00
Oliver Drobnik 8444c6bd29 fixed logging 2025-03-05 09:49:20 +01:00
Oliver Drobnik 60aa8649ca fix logging 2025-03-05 09:24:30 +01:00
Oliver Drobnik b9cca42219 Unify logging in IMAP 2025-03-05 08:53:48 +01:00
Oliver Drobnik 03d4d9c19e Cleanup 2025-03-04 21:41:11 +01:00
Oliver Drobnik 7d6025347e modernize all SMTP commands 2025-03-04 21:24:18 +01:00
Oliver Drobnik 5ab6787f4c simplify 2025-03-04 20:48:09 +01:00
Oliver Drobnik 2f40b8c9e6 WIP: refactor into better encapsulation 2025-03-04 20:44:44 +01:00
Oliver Drobnik 229281bd8d try to improve command handling 2025-03-04 20:16:21 +01:00
Oliver Drobnik 3ae8fabe2b improve logging 2025-03-04 19:53:13 +01:00
Oliver Drobnik 29169e33e0 Refactor to handler-based system for SMTP 2025-03-04 17:23:20 +01:00
Oliver Drobnik 5166222a67 cleanup 2025-03-04 16:06:54 +01:00
Oliver Drobnik b365c7dbad improved SMTP 2025-03-04 14:56:06 +01:00
Oliver Drobnik 3561cbeb02 improve logs 2025-03-04 14:34:47 +01:00
Oliver Drobnik 643cbe493c Parse capabilities 2025-03-04 14:16:13 +01:00
Oliver Drobnik 06d1eff49e modified demo 2025-03-04 14:01:56 +01:00
Oliver Drobnik b34248fc01 Fixed SMTP sending 2025-03-04 14:01:45 +01:00