Hi. Thanks for your library, we are considering to use it for large project which will connect to lot of IMAP servers.
I found one issue, which I was able to fix locally by changing source codes of your library.
What we need:
We need to call Folder.Search method with bool makeProcess set to false;
And then later process each message returned by calling message.Process() method
But that doesnt work, and I think it is because after Folder.Search is done - Client returns to previous selected folder.
So what I did
Please review this and if you think this is correct way to resolve issue, I guess you can include these changes into your library?
Thanks.
I found one issue, which I was able to fix locally by changing source codes of your library.
What we need:
We need to call Folder.Search method with bool makeProcess set to false;
And then later process each message returned by calling message.Process() method
But that doesnt work, and I think it is because after Folder.Search is done - Client returns to previous selected folder.
So what I did
- I added new field to Message class
internal Folder Folder;
-
In Folder.Search method - i added code to initialize Folder field of Message instance
foreach (var current in messageCollection)
{
current.Client = Client;
__current.Folder = this;__
if (makeProcess)
{
current.Process();
}
}
- Then in Message.Process method I wrapped entire code into try catch; then in beginning I added this code
if (Client.SelectedFolder != Folder.FolderPath)
{
returnToFolder = Client.SelectedFolder;
Client.SelectFolder(Folder.FolderPath);
}
and in finally part of try catch I added code to return to original folderif (!string.IsNullOrEmpty(returnToFolder))
{
Client.SelectFolder(returnToFolder);
}
returnToFolder is variable defined before try catch in Process method.Please review this and if you think this is correct way to resolve issue, I guess you can include these changes into your library?
Thanks.