예제 #1
0
 public MirandaImportJob(string dbPath, IMConversationsManager convManager, AddressBook mirandaAB)
 {
     _dbPath = dbPath;
     _conversationManager = convManager;
     _mirandaAB           = mirandaAB;
     _traceImport         = IniSettings.TraceImport;
     if (!IniSettings.FullIndexingCompleted)
     {
         _indexStartDate = IniSettings.IndexStartDate;
     }
 }
예제 #2
0
        /**
         * Initializes the plugin, registers the resource and property types
         * and UI elements used by the plugin, returns the array of resource
         * types for which the plugin is responsible.
         */

        public void Register()
        {
            _environment = ICore.Instance;

            _profileManager = new TrillianProfileManager();
            if (_profileManager.ProfileCount == 0)
            {
                // Do not show the plugin if Trillian is not installed or no profiles
                // for it are defined.
                return;
            }

            RegisterTypes();

            // Initialize the conversation manager. It will by itself register some of the
            // resource and property types used by conversations, so we need to supply
            // it with information.
            // The TimeSpan parameter specifies the maximum interval between messages for
            // which they are still considered a single conversation. We could make this
            // configurable, like the ICQ plugin does, but for simplicity we don't.

            _convManager = new IMConversationsManager(_typeTrillianConversation, "Trillian Conversation",
                                                      "Subject", new TimeSpan(1, 0, 0), _propTrillianAcct, _propFromAccount, _propToAccount,
                                                      this);

            // The conversation manager will also take responsibility for passing the text of
            // conversations for text indexing.

            _environment.PluginLoader.RegisterResourceTextProvider(_typeTrillianConversation, _convManager);

            // Register our plugin as the displayer for TrillianConversation resources.

            _environment.PluginLoader.RegisterResourceDisplayer(_typeTrillianConversation, this);

            IUIManager uiMgr = Core.UIManager;

            uiMgr.RegisterOptionsGroup("Instant Messaging", "The Instant Messaging options enable you to control how [product name] works with supported instant messaging programs.");
            // Registers the options pane for the plugin to be shown in the Options
            // dialog and the Startup Wizard.
            uiMgr.RegisterOptionsPane("Instant Messaging", "Trillian", CreateTrillianOptionsPane, null);
            uiMgr.RegisterWizardPane("Trillian", CreateTrillianOptionsPane, 11);
        }
예제 #3
0
        private void DoImportDB(IMirandaDB db)
        {
            IMConversationsManager convManager = new IMConversationsManager(
                ResourceTypes.MirandaConversation, "Miranda Conversation", "Subject",
                IniSettings.ConversationPeriodTimeSpan,
                Props.MirandaAcct, Props.FromAccount, Props.ToAccount, null);

            MirandaImportJob importJob = new MirandaImportJob("", convManager, null);

            importJob.ImportDB(db);
            while (true)
            {
                AbstractJob job = importJob.GetNextJob();
                if (job == null)
                {
                    break;
                }
                job.NextMethod.Invoke();
            }
            importJob.EnumerationFinished();
        }
예제 #4
0
 public MirandaConversationDisplayPane(IMConversationsManager convManager, int propNickName)
 {
     _convManager  = convManager;
     _propNickName = propNickName;
 }
예제 #5
0
파일: ICQPlugin.cs 프로젝트: mo5h/omeo
        public void Register()
        {
            _thePlugin      = this;
            _folderWatchers = new HashMap();
            _dbLocations    = new HashSet();
            _icqContacts    = new ArrayList();
            _icqMessages    = new ArrayList();
            _idResources    = new IntHashSet();

            RegisterTypes();

            IUIManager uiMgr = Core.UIManager;

            uiMgr.RegisterOptionsGroup("Instant Messaging", "The Instant Messaging options enable you to control how [product name] works with supported instant messaging programs.");
            OptionsPaneCreator icqPaneCreator = ICQOptionsPane.ICQOptionsPaneCreator;

            uiMgr.RegisterOptionsPane("Instant Messaging", "ICQ", icqPaneCreator,
                                      "The ICQ options enable you to specify which ICQ accounts should be indexed, and how [product name] should build conversations from ICQ messages.");
            uiMgr.AddOptionsChangesListener("Instant Messaging", "ICQ", ICQOptionsChanged);

            if (UINsCollection.GetUINs().Count > 0)
            {
                uiMgr.RegisterWizardPane("ICQ", icqPaneCreator, 10);
                Core.TabManager.RegisterResourceTypeTab("IM", "IM", _icqConversationResName, 2);
                _correspondentPane            = new CorrespondentCtrl();
                _correspondentPane.IniSection = "ICQ";
                _correspondentPane.SetCorresponentFilterList(Core.ResourceStore.FindResourcesWithProp(null, "ICQAcct"));

                Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "ICQPlugin.Icons.Correspondents24.png");
                Core.LeftSidebar.RegisterResourceStructurePane("ICQCorrespondents", "IM", "ICQ Correspondents", img, _correspondentPane);
                Core.LeftSidebar.RegisterViewPaneShortcut("ICQCorrespondents", Keys.Control | Keys.Alt | Keys.Q);
            }

            IPluginLoader  loader        = Core.PluginLoader;
            IActionManager actionManager = Core.ActionManager;

            loader.RegisterResourceDisplayer(_icqConversationResName, this);
            actionManager.RegisterLinkClickAction(new ConversationLinkClickAction(), _icqConversationResName, null);
            _conversationManager = new IMConversationsManager(_icqConversationResName, "ICQ Conversation", "Subject",
                                                              GetConversationTimeSpan(), _propICQAcct, _propFromICQ, _propToICQ, this);
            _conversationManager.ReverseMode = GetReverseMode();
            SaveConversationAction saveConvAction = new SaveConversationAction(_conversationManager, _propNickName);

            actionManager.RegisterContextMenuAction(saveConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                    "Save to File...", null, _icqConversationResName, null);
            actionManager.RegisterActionComponent(saveConvAction, "SaveAs", _icqConversationResName, null);
            EmailConversationAction mailConvAction = new EmailConversationAction(_conversationManager, _propNickName);

            actionManager.RegisterContextMenuAction(mailConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                    "Send by Email", null, _icqConversationResName, null);
            actionManager.RegisterActionComponent(mailConvAction, "SendByMail", _icqConversationResName, null);
            loader.RegisterResourceSerializer(_icqAccountResName, new ICQAccountSerializer());
            loader.RegisterResourceTextProvider(_icqConversationResName, _conversationManager);
            loader.RegisterResourceTextProvider(_contactResName, this);

            Core.ResourceBrowser.RegisterLinksPaneFilter(_icqConversationResName, new ItemRecipientsFilter());
            Core.ResourceBrowser.RegisterLinksGroup("Accounts", new[] { _propICQAcct }, ListAnchor.First);

            //  Upgrade information about ICQ address book - set its
            //  ContentType property so that it could be filtered out when
            //  this plugin is switched off.
            IResource ab = Core.ResourceStore.FindUniqueResource("AddessBook", "Name", "ICQ Contacts");

            if (ab != null)
            {
                ab.SetProp("ContentType", _icqConversationResName);
            }

            Core.ResourceBrowser.SetDefaultViewSettings("IM", AutoPreviewMode.Off, true);
        }
예제 #6
0
        void IPlugin.Register()
        {
            _theInstance = this;
            _store       = Core.ResourceStore;

            Props.Register();
            ResourceTypes.Register(this);
            RegisterTypes();

            IDisplayColumnManager colMgr = Core.DisplayColumnManager;

            colMgr.RegisterDisplayColumn(ResourceTypes.MirandaConversation, 0, new ColumnDescriptor("From", 100));
            colMgr.RegisterDisplayColumn(ResourceTypes.MirandaConversation, 1, new ColumnDescriptor("To", 100));
            colMgr.RegisterDisplayColumn(ResourceTypes.MirandaConversation, 2,
                                         new ColumnDescriptor(new[] { Core.ResourceStore.PropTypes [Core.Props.Subject].Name, "DisplayName" }, 300, ColumnDescriptorFlags.AutoSize));
            colMgr.RegisterDisplayColumn(ResourceTypes.MirandaConversation, 3, new ColumnDescriptor("Date", 120));

            if (!_store.PropTypes.Exist("ConversationList"))
            {
                ClearConversations();
            }

            _convManager = new IMConversationsManager(ResourceTypes.MirandaConversation, "Miranda Conversation", "Subject",
                                                      IniSettings.ConversationPeriodTimeSpan, Props.MirandaAcct, Props.FromAccount, Props.ToAccount, this);
            _convManager.ReverseMode = IniSettings.LatestOnTop;

            Core.PluginLoader.RegisterResourceTextProvider(ResourceTypes.MirandaConversation, _convManager);
            Core.PluginLoader.RegisterResourceTextProvider("Contact", new MirandaContactTextProvider());
            Core.PluginLoader.RegisterResourceDisplayer(ResourceTypes.MirandaConversation, this);
            Core.ActionManager.RegisterLinkClickAction(new ConversationLinkClickAction(), ResourceTypes.MirandaConversation, null);

            Core.PluginLoader.RegisterResourceSerializer(ResourceTypes.MirandaAIMAccount,
                                                         new MirandaAccountSerializer(Props.ScreenName));
            Core.PluginLoader.RegisterResourceSerializer(ResourceTypes.MirandaICQAccount,
                                                         new MirandaAccountSerializer(Props.UIN));

            string[] dbNames = ProfileManager.GetProfileList();
            if (dbNames.Length > 0)
            {
                IUIManager uiMgr = Core.UIManager;
                uiMgr.RegisterOptionsGroup("Instant Messaging", "The Instant Messaging options enable you to control how [product name] works with supported instant messaging programs.");
                uiMgr.RegisterWizardPane("Miranda", CreateMirandaOptions, 11);
                uiMgr.RegisterOptionsPane("Instant Messaging", "Miranda", CreateMirandaOptions, _MirandaOptionsDescription);
                uiMgr.AddOptionsChangesListener("Instant Messaging", "Miranda", OnMirandaOptionsChanged);

                Core.TabManager.RegisterResourceTypeTab("IM", "IM", "MirandaConversation", 2);

                _correspondentPane            = new CorrespondentCtrl();
                _correspondentPane.IniSection = "Miranda";
                _correspondentPane.SetCorresponentFilterList(Core.ResourceStore.FindResourcesWithProp(null, Props.MirandaAcct));

                Image img = Utils.TryGetEmbeddedResourceImageFromAssembly(Assembly.GetExecutingAssembly(), "OmniaMea.InstantMessaging.Miranda.Icons.correspondents.ico");
                Core.LeftSidebar.RegisterResourceStructurePane("MirandaCorrespondents", "IM", "Miranda Correspondents", img, _correspondentPane);
                Core.LeftSidebar.RegisterViewPaneShortcut("MirandaCorrespondents", Keys.Control | Keys.Alt | Keys.M);

                SaveConversationAction saveConvAction = new SaveConversationAction(_convManager, Props.NickName);
                Core.ActionManager.RegisterContextMenuAction(saveConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                             "Save to File...", null, "MirandaConversation", null);
                Core.ActionManager.RegisterActionComponent(saveConvAction, "SaveAs", "MirandaConversation", null);

                EmailConversationAction mailConvAction = new EmailConversationAction(_convManager, Props.NickName);
                Core.ActionManager.RegisterContextMenuAction(mailConvAction, ActionGroups.ITEM_OPEN_ACTIONS, ListAnchor.Last,
                                                             "Send by Email", null, "MirandaConversation", null);
                Core.ActionManager.RegisterActionComponent(mailConvAction, "SendByMail", "MirandaConversation", null);

                Core.ResourceBrowser.RegisterLinksGroup("Accounts", new[] { Props.MirandaAcct }, ListAnchor.First);
                Core.ResourceBrowser.RegisterLinksPaneFilter(ResourceTypes.MirandaConversation, new ItemRecipientsFilter());

                _mirandaAB = new AddressBook("Miranda Contacts", ResourceTypes.MirandaConversation);
                _mirandaAB.IsExportable = false;

                //  Upgrade information about Miranda address book - set its
                //  ContentType property so that it could be filtered out when
                //  this plugin is switched off.
                _mirandaAB.Resource.SetProp(Core.Props.ContentType, ResourceTypes.MirandaConversation);

                Core.ResourceBrowser.SetDefaultViewSettings("IM", AutoPreviewMode.Off, true);
            }

            Core.PluginLoader.RegisterResourceDeleter(ResourceTypes.MirandaConversation, new MirandaConversationDeleter());
        }