Matren - 2006-10-11

Logged In: YES
user_id=643537

Here a suggested solution to fix the issue
(i confess its not really nice, but it's working)

File: IMAPHandler.cs
Method: IMAPHandler.GetSet()
------------------------------
/// <summary>
/// Returns a list containing the specified message
set
/// </summary>
/// <param name="setString"></param>
/// <param name="isUID"></param>
/// <returns></returns>
List<uint> GetSet(string setString, bool isUID)
{
List<uint> lSets = new List<uint>(); //Return
set

//Get the max number in the set
uint uMaxSet = 0;
if (isUID)
{
//If UID, the max number is the highest UID
foreach (EmailMessage f in _folder.Messages)
if (f.UID > uMaxSet)
uMaxSet = f.UID;
}
else
//The max number is the number of messages
uMaxSet = (uint)_folder.Messages.Length;

//Check the format of the set: x:x or x,x,x,x
if (setString.IndexOf(":") > -1 &&
setString.IndexOf(",") <= -1)
{
//Split the set
string strStart = setString.Substring(0,
setString.IndexOf(":"));
string strEnd = setString.Substring
(setString.IndexOf(":") + 1);

//Get the first set number
uint uStart = 1;
if (strStart != "*")
uStart = uint.Parse(strStart);

//Get the last set number
uint uEnd = uMaxSet;
if (strEnd != "*")
uEnd = uint.Parse(strEnd);

//Parse each set number
for (uint ui = uStart; ui <= uEnd; ui++)
if (!lSets.Contains(ui))
lSets.Add(ui);
}
else
{
if (setString.IndexOf(":") > -1)
{
string[] spl = setString.Split(',');
foreach (string s in spl)
{
string strStart =
s.Substring(0, s.IndexOf(":"));
string strEnd = s.Substring
(s.IndexOf(":") + 1);

//Get the first set number
uint uStart = 1;
if (strStart != "*")
uStart = uint.Parse
(strStart);

//Get the last set number
uint uEnd = uMaxSet;
if (strEnd != "*")
uEnd = uint.Parse
(strEnd);

//Parse each set number
for (uint ui = uStart; ui
<= uEnd; ui++)
if (!lSets.Contains(ui))
lSets.Add(ui);
}
}
else
{
//The set is a comma delimited
string
string[] spl = setString.Split(',');
foreach (string s in spl)
if (!lSets.Contains(uint.Parse
(s)))
lSets.Add(uint.Parse(s));
}
}