private bool WereChanges(IERowSet row, IResource email, out bool checkForDateTimeNeeded) { checkForDateTimeNeeded = false; DateTime lastModifiedDate = row.GetDateTimeProp(2); if (lastModifiedDate != DateTime.MinValue) { lastModifiedDate = lastModifiedDate.ToUniversalTime(); } else { checkForDateTimeNeeded = true; } bool bWereChanges = lastModifiedDate.CompareTo(email.GetProp(PROP.LastModifiedTime)) != 0; if (!bWereChanges) { long mesFlags = row.GetLongProp(4); bool unread = (mesFlags & 1) == 0; if (unread != email.HasProp(Core.Props.IsUnread)) { bWereChanges = true; } } return(bWereChanges); }
public static bool ProcessIMAPMessage(IEFolder folder, string entryID) { Tracer._Trace("ProcessIMAPMessage"); IETable table = folder.GetEnumTable(DateTime.MinValue); if (table == null) { return(false); } using ( table ) { int count = table.GetRowCount(); if (count > 0) { table.Sort(MAPIConst.PR_MESSAGE_DELIVERY_TIME, false); } for (uint i = 0; i < count; i++) { IERowSet row = table.GetNextRow(); if (row == null) { continue; } using ( row ) { if (row.GetBinProp(0) == entryID) { if (row.GetLongProp(6) == 1) { Tracer._Trace("ProcessIMAPMessage FALSE"); //folder.SetMessageStatus( entryID, 0x1000, 0x1000 ); return(false); } else { Tracer._Trace("ProcessIMAPMessage TRUE"); return(true); } } } } } return(false); }
private void EnumerateMail(FolderDescriptor folder, IEFolder mapiFolder) { try { OnFolderFetched(folder.Name); int indexed = 0; IResource resFolder = Folder.Find(folder.FolderIDs.EntryId); DateTime dtRestrict = GetRestrictDate(resFolder); IETable table = null; try { table = mapiFolder.GetEnumTable(dtRestrict); } catch (System.UnauthorizedAccessException exception) { _tracer.TraceException(exception); } catch (OutOfMemoryException exception) { _tracer.TraceException(exception); } if (table == null) { return; } using ( table ) { int count = table.GetRowCount(); if (count > 0) { table.Sort(MAPIConst.PR_MESSAGE_DELIVERY_TIME, false); } for (uint i = 0; i < count; i++) { if (OutlookSession.OutlookProcessor.ShuttingDown) { break; } if (_idle && Settings.IdleModeManager.CheckInterruptIdle()) { break; } IERowSet row = row = table.GetNextRow(); if (row == null) { continue; } using ( row ) { if (row.GetLongProp(6) != 1) { ProcessRow(row, folder, mapiFolder, ref indexed); } } } } if (Settings.IdleModeManager.CompletedIdle) { Folder.SetSeeAllAsync(resFolder); } _tracer.Trace("Indexed " + indexed + " messages in folder " + folder.Name); } finally { OutlookSession.ProcessJobs(); } }