예제 #1
0
        public Icon GetResourceIcon(IResource resource)
        {
            if (Folder.IsIgnored(resource))
            {
                if (_ignored == null)
                {
                    _ignored = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.IgnoredFolder.ico");
                }
                return(_ignored);
            }

            if (resource.GetIntProp(Core.Props.Open) == 1 ||
                resource.GetIntProp(PROP.OpenIgnoreFolder) == 1 ||
                resource.GetIntProp(PROP.OpenSelectFolder) == 1)
            {
                if (_opened == null)
                {
                    _opened = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.OPENFOLD2.ICO");
                }
                return(_opened);
            }
            if (_closed == null)
            {
                _closed = OutlookPlugin.LoadIconFromAssembly("OutlookPlugin.Icons.CLSDFOLD2.ICO");
            }
            return(_closed);
        }
예제 #2
0
        protected override void Execute()
        {
            try
            {
                if (!Guard.IsResourceLive(_folder))
                {
                    return;
                }

                Folder.SetSeeAll(_folder, false);
                if (Folder.IsIgnored(_folder))
                {
                    foreach (IResource mail in Folder.GetMailList(_folder))
                    {
                        Mail.ForceDelete(mail);
                    }
                }
                else
                {
                    RefreshFolderDescriptor.Do(JobPriority.Normal, new FolderDescriptor(_folder), Settings.IndexStartDate);
                }
            }
            catch (Exception exception)
            {
                Core.ReportException(exception, ExceptionReportFlags.AttachLog);
                Tracer._TraceException(exception);
            }
        }
예제 #3
0
        protected override void Execute()
        {
            if (OutlookSession.OutlookProcessor.ShuttingDown)
            {
                return;
            }

            IEFolder folder = OutlookSession.OpenFolder(_ntf.ParentID, _storeID);

            if (folder != null)
            {
                using ( folder )
                {
                    FolderDescriptor folderDescriptor = FolderDescriptor.Get(folder);
                    if (folderDescriptor == null)
                    {
                        return;
                    }
                    IResource resFolder = Folder.Find(folderDescriptor.FolderIDs.EntryId);
                    if (resFolder == null)
                    {
                        return;
                    }

                    bool ignoredFolder = Folder.IsIgnored(resFolder);

                    IEMessage message = OutlookSession.OpenMessage(_ntf.EntryID, _storeID);
                    if (message == null)
                    {
                        return;
                    }
                    using ( message )
                    {
                        string    entryId = OutlookSession.GetMessageID(message);
                        IResource mail    = Core.ResourceStore.FindUniqueResource("Email", PROP.EntryID, _ntf.EntryID);
                        if (mail == null && _ntf.OldEntryID != null)
                        {
                            mail = Core.ResourceStore.FindUniqueResource("Email", PROP.EntryID, _ntf.OldEntryID);
                        }

                        if (ignoredFolder && mail != null)
                        {
                            Trace.WriteLine("Moved mail ID=" + mail.Id + " to ignored folder");
                            Mail.ForceDelete(mail);
                            return;
                        }
                        if (mail == null)
                        {
                            ProcessMailAddNtf.DoJob(_ntf, _storeID);
                            return;
                        }
                        mail.SetProp(PROP.EntryID, entryId);
                        Folder.LinkMail(resFolder, mail);
                    }
                }
            }
        }
예제 #4
0
 public bool AcceptNode(IResource res, int level)
 {
     if (res.Type != STR.MAPIFolder)
     {
         return(true);
     }
     if (!_alwaysShowExcludedFolders && Folder.IsIgnored(res) && !Settings.ShowExcludedFolders)
     {
         return(!IsAllChildrenIgnored(res));
     }
     return(res.HasProp(PROP.MAPIVisible));
 }
예제 #5
0
        private bool IsAllChildrenIgnored(IResource folder)
        {
            IResourceList subFolders = Folder.GetSubFolders(folder);

            foreach (IResource subFolder in subFolders.ValidResources)
            {
                if (!Folder.IsIgnored(subFolder) || !IsAllChildrenIgnored(subFolder))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #6
0
 public bool FolderFetched(FolderDescriptor parent, FolderDescriptor folder, out FolderDescriptor folderTag)
 {
     folderTag = null;
     if (OutlookSession.OutlookProcessor.ShuttingDown)
     {
         return(false);
     }
     if (!Folder.IsIgnored(folder))
     {
         ProcessedFolders.RegisterFolder(folder.FolderIDs.EntryId);
         RefreshFolderDescriptor.Do(JobPriority.BelowNormal, folder.FolderIDs, _dateRestrict);
     }
     return(true);
 }
예제 #7
0
        public bool FolderFetched(FolderDescriptor parent, FolderDescriptor folder,
                                  out FolderDescriptor folderTag)
        {
            folderTag = null;
            _tracer.Trace(folder.Name);

            if (Settings.IdleModeManager.Interrupted)
            {
                return(false);
            }
            if (!Folder.IsIgnored(folder))
            {
                EnumerateMessageItems(folder);
            }
            return(true);
        }
예제 #8
0
파일: OutlookActions.cs 프로젝트: mo5h/omeo
        public void Update(IActionContext context, ref ActionPresentation presentation)
        {
            if (context.SelectedResources.Count == 0)
            {
                presentation.Visible = false;
                return;
            }

            foreach (IResource resource in context.SelectedResources)
            {
                if (resource.Type != STR.MAPIFolder || Folder.IsIgnored(resource))
                {
                    presentation.Visible = false;
                    return;
                }
            }
        }
예제 #9
0
 public static void LinkOrDelete(FolderDescriptor folder, IResource email)
 {
     Guard.NullArgument(email, "email");
     if (folder != null)
     {
         IResource resFolder = Folder.Find(folder.FolderIDs.EntryId);
         if (!Folder.IsIgnored(resFolder))
         {
             if (email.GetLinkProp(PROP.MAPIFolder) != resFolder)
             {
                 Core.ResourceAP.QueueJob("Link Email To Folder", new LinkMailDelegate(LinkMail), resFolder, email);
             }
             return;
         }
     }
     DeleteMail(email);
 }
예제 #10
0
파일: MessageActions.cs 프로젝트: mo5h/omeo
 public override void Update(IActionContext context, ref ActionPresentation presentation)
 {
     if (context.SelectedResources.Count == 0 || !context.SelectedResources.AllResourcesOfType(STR.MAPIFolder))
     {
         presentation.Visible = false;
         return;
     }
     foreach (IResource folder in context.SelectedResources)
     {
         if (Folder.IsPublicFolder(folder) && !Folder.IsIgnored(folder))
         {
             presentation.Enabled = true;
             presentation.Visible = true;
             return;
         }
     }
     presentation.Enabled = false;
     presentation.Visible = false;
     return;
 }
예제 #11
0
 public override void OK()
 {
     //  Workaround of OM-13897, calling an OutlookSession in the shutdown
     //  state causes unpredictable results.
     if (Core.State == CoreState.Running)
     {
         _treeView.SaveCheckedState();
         MAPIIDs IDs = OutlookSession.GetInboxIDs();
         if (IDs != null)
         {
             IResource folder = Folder.Find(IDs.EntryID);
             if (folder != null && !Folder.IsIgnored(folder))
             {
                 Core.UIManager.CreateShortcutToResource(folder);
             }
         }
         SettingSaver.Save(Controls);
         Settings.LoadSettings();
     }
 }
예제 #12
0
파일: OutlookActions.cs 프로젝트: mo5h/omeo
        internal void DisplayResourceList(IResource folder, IResourceList resourceList)
        {
            ResourceListDisplayOptions options = new ResourceListDisplayOptions();

            _folder = folder;
            bool displayUnread = folder.HasProp(Core.Props.DisplayUnread);

            if (displayUnread)
            {
                options.CaptionTemplate = "Unread messages in %OWNER%";
            }
            else
            {
                options.CaptionTemplate = "Messages in %OWNER%";
            }
            options.SelectedResource = Folder.GetSelectedMail(_folder);

            if (Folder.IsIgnored(_folder))
            {
                options.StatusLine             = "This folder is in the ignore list";
                options.StatusLine            += ". Click to remove from the ignored folders list";
                options.StatusLineClickHandler = OnClickOnBrowserStatus;
            }
            else
            {
                DateTime dateRestriction = Settings.IndexStartDate;
                if (dateRestriction.CompareTo(DateTime.MinValue) != 0 && !Folder.GetSeeAll(_folder))
                {
                    options.StatusLine             = "Showing messages since " + dateRestriction.ToShortDateString();
                    options.StatusLine            += ". Click to see all messages";
                    options.StatusLineClickHandler = OnClickOnBrowserStatus;
                }
            }

            options.SortSettings = new SortSettings(Core.Props.Date, false);
            if (_folder.HasProp(Core.Props.DisplayThreaded))
            {
                options.ThreadingHandler = Core.PluginLoader.CompositeThreadingHandler;
            }
            Core.ResourceBrowser.DisplayResourceList(_folder, resourceList, options);
        }
예제 #13
0
        private static bool IsDataCorrect(out IResource resFolder, FolderDescriptor folderDescriptor)
        {
            resFolder = null;
            if (OutlookSession.OutlookProcessor.ShuttingDown)
            {
                return(false);
            }

            if (folderDescriptor == null)
            {
                return(false);
            }
            resFolder = Folder.Find(folderDescriptor.FolderIDs.EntryId);
            if (resFolder == null)
            {
                return(false);
            }
            if (Folder.IsIgnored(folderDescriptor))
            {
                return(false);
            }
            return(true);
        }
예제 #14
0
파일: MailDescriptor.cs 프로젝트: mo5h/omeo
        protected void Init(FolderDescriptor folderDescriptor, string entryID, IEMessage message, string longBody)
        {
            _longBody     = longBody;
            _folder       = folderDescriptor;
            _messageClass = MessageType.GetMessageClass(message);
            if (!Settings.ProcessAllPropertiesForMessage)
            {
                _subject = "test";
                return;
            }
            string folderID = message.GetBinProp(MAPIConst.PR_PARENT_ENTRYID);

            if (folderID != null)
            {
                string   storeID = message.GetBinProp(MAPIConst.PR_STORE_ENTRYID);
                IEFolder folder  = OutlookSession.OpenFolder(folderID, storeID);
                if (folder != null)
                {
                    using ( folder )
                    {
                        _folder = FolderDescriptor.Get(folder);
                    }
                }
            }
            _entryID = entryID;

            if (_folder != null && Folder.IsIgnored(_folder))
            {
                _toDeleteResource = true;
                return;
            }

            int tag = message.GetIDsFromNames(ref GUID.set1, lID.msgDeletedInIMAP, PropType.PT_LONG);

            _deletedInIMAP = message.GetLongProp(tag) == 1;

            if (_deletedInIMAP && Settings.IgnoreDeletedIMAPMessages)
            {
                _toDeleteResource = true;
                return;
            }

            _subject = message.GetStringProp(MAPIConst.PR_SUBJECT);
            if (_subject == null)
            {
                _subject = string.Empty;
            }
            _unread = message.IsUnread();

            _lastModifiedDate = message.GetDateTimeProp(MAPIConst.PR_LAST_MODIFICATION_TIME);
            _lastModifiedDate = _lastModifiedDate.ToUniversalTime();

            _messageSize = message.GetLongProp(MAPIConst.PR_MESSAGE_SIZE);
            _iconIndex   = message.GetLongProp(MAPIConst.PR_ICON_INDEX);

            _priority = message.GetLongProp(MAPIConst.PR_PRIORITY);
            int importance = message.GetLongProp(MAPIConst.PR_IMPORTANCE, true);

            if (importance == -9999)
            {
                importance = 1;
            }
            _importance = importance - 1;
            _flagStatus = message.GetLongProp(MAPIConst.PR_FLAG_STATUS);

            if (_flagStatus == 2)
            {
                _flagColor = message.GetLongProp(MAPIConst.PR_FLAG_COLOR, true);
                if (_flagColor == -9999)
                {
                    _flagColor = 6;
                }
            }

            _internetMessageID = message.GetStringProp(MAPIConst.PR_INTERNET_MESSAGE_ID);

            _recordKey         = message.GetBinProp(MAPIConst.PR_RECORD_KEY);
            _conversationIndex = message.GetBinProp(MAPIConst.PR_CONVERSATION_INDEX);

            _replyToID          = message.GetStringProp(MAPIConst.PR_IN_REPLY_TO_ID);
            _internetReferences = message.GetStringProp(MAPIConst.PR_INTERNET_REFERENCES);

            if (Settings.CreateAnnotationFromFollowup)
            {
                int annotationTag = message.GetIDsFromNames(ref GUID.set1, lID.msgFlagAnnotation, PropType.PT_STRING8);
                _flag = message.GetStringProp(annotationTag);
            }

            _outlookCategories = OutlookSession.GetCategories(message);;

            _receivedTime = message.GetDateTimeProp(MAPIConst.PR_MESSAGE_DELIVERY_TIME);
            _sentOn       = message.GetDateTimeProp(MAPIConst.PR_CLIENT_SUBMIT_TIME);
            if (_receivedTime == DateTime.MinValue)
            {
                _receivedTime = _sentOn;
            }

            _listUnsubscribe = message.GetStringProp(MAPIConst.PR_LIST_UNSUBSCRIBE);
            if (_listUnsubscribe != null)
            {
                _listUnsubscribe = ExtractUnsubscribeEmail(_listUnsubscribe);
            }

            _contactCreated = MailSenderHelper.LoadSenderInfo(message, out _senderName, out _senderEmail);

            if (Settings.ProcessRecipients)
            {
                _state.EndOfInit(this, message);
            }
        }
예제 #15
0
파일: TaskDescriptor.cs 프로젝트: mo5h/omeo
        protected override void Execute()
        {
            IResource task = GetTaskResource();

            if (task == null)
            {
                Tracer._Trace("TASK IMPORT task not found");
            }
            if (task != null)
            {
                if (_folder.ContainerClass != FolderType.Task)
                {
                    Tracer._Trace("Delete task: id = " + task.Id);
                    task.Delete();
                    return;
                }
            }

            IResource resFolder     = Folder.Find(_folder.FolderIDs.EntryId);
            bool      folderIgnored = (resFolder != null && Folder.IsIgnored(resFolder)) || OutlookSession.IsDeletedItemsFolder(_folder.FolderIDs.EntryId);

            if (folderIgnored)
            {
                if (task != null)
                {
                    task.Delete();
                }
                return;
            }

            bool import = resFolder != null && !Folder.IsIgnoreImport(resFolder);

            if (!import && task == null)
            {
                return;
            }

            if (task == null)
            {
                task = Core.ResourceStore.BeginNewResource(STR.Task);
            }
            else
            {
                task.BeginUpdate();
            }

            string oldEntryID = task.GetStringProp(PROP.EntryID);

            if (oldEntryID == null)
            {
                task.SetProp(PROP.EntryID, _entryID);
            }
            else if (oldEntryID != _entryID)
            {
                throw new ApplicationException("Try to change entryID for task");
            }
            if (resFolder != null)
            {
                Folder.LinkMail(resFolder, task);
            }

            if (!import)
            {
                task.EndUpdate();
                if (Settings.TraceTaskChanges)
                {
                    _tracer.Trace(task);
                }
                return;
            }

            task.SetProp(Core.Props.Subject, _subject);

            SetDateProp(task, Core.Props.Date, _dueDate);
            SetDateProp(task, PROP.StartDate, _startDate);

            if (_reminderActive == 0)
            {
                SetDateProp(task, PROP.RemindDate, DateTime.MinValue);
            }
            else
            {
                SetDateProp(task, PROP.RemindDate, _remindDate);
            }

            task.SetProp(PROP.Status, _status);
            task.SetProp(PROP.Priority, _priority);
            task.SetProp(PROP.Description, _description);
            task.AddLink(PROP.Target, Core.ResourceTreeManager.GetRootForType(STR.Task));
            if (!task.HasProp(PROP.SuperTaskLink))
            {
                task.SetProp(PROP.SuperTaskLink, Core.ResourceTreeManager.GetRootForType(STR.Task));
            }

            if (Settings.SyncTaskCategory)
            {
                CategorySetter.DoJob(_outlookCategories, task);
            }

            bool wereChanges = task.IsChanged();

            task.EndUpdate();
            if (wereChanges && Core.TextIndexManager != null)
            {
                Guard.QueryIndexingWithCheckId(task);
            }
            if (Settings.TraceTaskChanges)
            {
                _tracer.Trace(task);
            }
        }
예제 #16
0
파일: OutlookPlugin.cs 프로젝트: mo5h/omeo
 static private string GetMAPIFolderToolTip(IResource folder)
 {
     return(Folder.IsIgnored(folder) ? "This folder is not indexed. Messages are not imported and processed." : null);
 }