예제 #1
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());
        }