diff --git a/CHANGELOG.md b/CHANGELOG.md index 57d2e80..58dce0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.3 + +- Fix #13 by refreshing capabilities list after successful tls negotiation +- Expose capabilities list and accepted auth methods + ## 0.2.2 - Merge #10, fix string with leading escaped character diff --git a/README.md b/README.md index 1582145..89af694 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,8 @@ await client.authenticate(new ImapPlainAuth("username", "password")); To close the connection, `logout` can either be called in a folder or the client itself. ## Features and bugs -Please file feature requests and bugs at the [issue tracker](https://github.com/michaelspiss/imap_client/issues). +Feel free to contribute to this project. + +If you find a bug or think of a new feature, but don't know how to fix/implement it, please [open an issue](https://github.com/michaelspiss/imap_client/issues). + +If you fixed a bug or implemented a new feature, please send a [pull request](https://github.com/michaelspiss/imap_client/pulls). diff --git a/lib/src/imap_client.dart b/lib/src/imap_client.dart index ee7adda..fcb0106 100644 --- a/lib/src/imap_client.dart +++ b/lib/src/imap_client.dart @@ -122,6 +122,8 @@ class ImapClient extends _ImapCommandable { }); // Negotiate tls _engine._setSocket(await SecureSocket.secure(_engine._socket)); + // refresh capabilities list + await capability(); return response; } diff --git a/lib/src/imap_commandable.dart b/lib/src/imap_commandable.dart index eff2fe8..e44de6e 100644 --- a/lib/src/imap_commandable.dart +++ b/lib/src/imap_commandable.dart @@ -4,6 +4,21 @@ part of imap_client; abstract class _ImapCommandable { ImapEngine _engine; + /// Gets full server capabilities list + List getCapabilities() { + return UnmodifiableListView(_engine._capabilities); + } + + /// Checks if server has capability + bool hasCapability(String capability) { + return _engine.hasCapability(capability.toUpperCase()); + } + + /// Gets all available authentication methods + List getAuthenticationMethods() { + return UnmodifiableListView(_engine._serverAuthCapabilities); + } + /// Sends custom command. Command must not include CRLF (\r\n)! /// /// Untagged handler maps must have keys in UPPERCASE! diff --git a/pubspec.yaml b/pubspec.yaml index bb51fe7..ea3370a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: imap_client description: An interface to get emails via the imap protocol (version 4rev1) -version: 0.2.2 +version: 0.2.3 homepage: https://github.com/michaelspiss/imap_client author: Michael Spiss documentation: