public virtual object[] GetOldMessagesUids(int daysCount) { Folder fld = GetFolder(FolderType.Inbox); WebMailMessageCollection coll = _dbMan.SelectMessagesOlderThanXDays(daysCount, fld); return(coll.ToUidsCollection(true)); }
private void GetNewMessagesFromServerAndSaveToDb(DbStorage dbStorage, Folder fld, int[] Indexes, out bool errorOccured, ref ArrayList pop3Uids) { _folderName = Utils.GetLocalizedFolderNameByType(fld); _msgNumber = 1; _msgsCount = Indexes.Length; MailMessageCollection mailMessageCollection = new MailMessageCollection(); // const int maxMsgsPersession = Constants.DownloadChunk; try { foreach (int index in Indexes) { // int downloadMsgsCount = ((_msgsCount) > maxMsgsPersession) ? maxMsgsPersession : _msgsCount; if ((_msgsCount) > 0) { if ((fld.SyncType == FolderSyncType.NewEntireMessages) || (fld.SyncType == FolderSyncType.AllEntireMessages)) { mailMessageCollection.Add(_pop3Obj.DownloadEntireMessage(index)); // mailMessageCollection = _pop3Obj.DownloadEntireMessages(newMsgStartIndex + 1, downloadMsgsCount); } if ((fld.SyncType == FolderSyncType.NewHeadersOnly) || (fld.SyncType == FolderSyncType.AllHeadersOnly)) { mailMessageCollection.Add(_pop3Obj.DownloadMessageHeader(index)); // mailMessageCollection = _pop3Obj.DownloadMessageHeaders(newMsgStartIndex + 1, downloadMsgsCount); } if (!_updatedFolders.ContainsKey(fld.ID)) { _updatedFolders.Add(fld.ID, fld.FullPath); } } } WebMailMessageCollection coll = new WebMailMessageCollection(_account, mailMessageCollection, true, fld); ApplyXSpam(coll); ApplyFilters(coll, dbStorage, fld, ref pop3Uids); if (_account.MailMode == MailMode.DeleteMessagesFromServer) { if ((fld.SyncType == FolderSyncType.AllHeadersOnly) || (fld.SyncType == FolderSyncType.NewHeadersOnly)) { Log.WriteLine("GetNewMessagesFromServerAndSaveToDb", "Incorrect Settings: " + _account.MailMode.ToString() + " + " + fld.SyncType.ToString()); } else { DeleteMessages(coll.ToUidsCollection(true), null); } } errorOccured = false; } catch (Exception ex) { errorOccured = true; Log.WriteException(ex); throw new WebMailException(ex); } _folderName = ""; _msgNumber = 0; _msgsCount = 0; }