public ServerCommandService(IChatState chatState,
            IAutomateThings automation,
            IManageNotes notes,
            IManageChannels channels,
            IFriendRequestService friendRequestService)
            : base(chatState)
        {
            this.channels = channels;
            this.automation = automation;
            this.notes = notes;
            this.friendRequestService = friendRequestService;

            Events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(GetCharacter, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ChatCommandEvent>().Subscribe(EnqueueAction, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ConnectionClosedEvent>().Subscribe(WipeState, ThreadOption.PublisherThread, true);

            ChatModel.CurrentAccount = ChatConnection.Account;

            noisyTypes = new[]
            {
                UserJoin,
                UserLeave,
                UserStatus,
                PublicChannelList,
                PrivateChannelList,
                UserList,
                ChannelAd,
                ChannelMessage
            };

            LoggingSection = "cmnd serv";
        }
Esempio n. 2
0
        public ServerCommandService(IChatState chatState,
                                    IAutomateThings automation,
                                    IManageNotes notes,
                                    IManageChannels channels,
                                    IFriendRequestService friendRequestService)
            : base(chatState)
        {
            this.channels             = channels;
            this.automation           = automation;
            this.notes                = notes;
            this.friendRequestService = friendRequestService;

            Events.GetEvent <CharacterSelectedLoginEvent>()
            .Subscribe(GetCharacter, ThreadOption.BackgroundThread, true);
            Events.GetEvent <ChatCommandEvent>().Subscribe(EnqueueAction, ThreadOption.BackgroundThread, true);
            Events.GetEvent <ConnectionClosedEvent>().Subscribe(WipeState, ThreadOption.PublisherThread, true);

            ChatModel.CurrentAccount = ChatConnection.Account;

            noisyTypes = new[]
            {
                UserJoin,
                UserLeave,
                UserStatus,
                PublicChannelList,
                PrivateChannelList,
                UserList,
                ChannelAd,
                ChannelMessage
            };

            LoggingSection = "cmnd serv";
        }
Esempio n. 3
0
        public UserCommandService(
            IChatState chatState,
            IHandleApi api,
            ILogThings logger,
            IManageChannels channels,
            IHandleIcons iconService)
        {
            try
            {
                regionManager = chatState.RegionManager;
                events = chatState.EventAggregator;
                cm = chatState.ChatModel;
                connection = chatState.Connection;
                characterManager = chatState.CharacterManager;
                this.api = api.ThrowIfNull("api");
                this.logger = logger.ThrowIfNull("logger");
                this.channels = channels.ThrowIfNull("channelManager");
                this.iconService = iconService;

                events.GetEvent<UserCommandEvent>().Subscribe(CommandReceived, ThreadOption.UIThread, true);

                commands = new Dictionary<string, CommandHandler>
                {
                    {"bookmark-add", OnBookmarkAddRequested},
                    {"friend-remove", OnFriendRemoveRequested},
                    {"request-accept", OnFriendRequestAcceptRequested},
                    {"request-deny", OnFriendRequestDenyRequested},
                    {"request-send", OnFriendRequestSendRequested},
                    {"request-cancel", OnFriendRequestCancelRequested},
                    {"priv", OnPrivRequested},
                    {UserMessage, OnPivateMessageSendRequested},
                    {ChannelMessage, OnMsgRequested},
                    {ChannelAd, OnLrpRequested},
                    {UserStatus, OnStatusChangeRequested},
                    {"close", OnCloseRequested},
                    {"forceclose", OnForceChannelCloseRequested},
                    {"join", OnJoinRequested},
                    {UserIgnore, OnIgnoreRequested},
                    {"clear", OnClearRequested},
                    {"clearall", OnClearAllRequested},
                    {"_logger_open_log", OnOpenLogRequested},
                    {"_logger_open_folder", OnOpenLogFolderRequested},
                    {"code", OnChannelCodeRequested},
                    {UserInvite, OnInviteToChannelRequested},
                    {"who", OnWhoInformationRequested},
                    {"getdescription", OnChannelDescriptionRequested},
                    {"interesting", OnMarkInterestedRequested},
                    {"notinteresting", OnMarkNotInterestedRequested},
                    {"ignoreUpdates", OnIgnoreUpdatesRequested},
                    {AdminAlert, OnReportRequested},
                    {"tempignore", OnTemporaryIgnoreRequested},
                    {"tempunignore", OnTemporaryIgnoreRequested},
                    {"tempinteresting", OnTemporaryInterestedRequested},
                    {"tempnotinteresting", OnTemporaryInterestedRequested},
                    {"handlelatest", OnHandleLatestReportRequested},
                    {"handlereport", OnHandleLatestReportByUserRequested},
                    {"bookmark-remove", OnBookmarkRemoveRequested},
                    {"rejoin", OnChannelRejoinRequested},
                    {"searchtag", OnSearchTagToggleRequested},
                    {"logout", OnLogoutRequested},
                    {"soundon", OnSoundOnRequested},
                    {"soundoff", OnSoundOffRequested},
                    {"whois", OnWhoIsRequested},
                    {ChannelRoll, OnRollRequested}
                };
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }
Esempio n. 4
0
        public UserCommandService(
            IChatState chatState,
            IHandleApi api,
            ILogThings logger,
            IManageChannels channels,
            IHandleIcons iconService)
        {
            try
            {
                regionManager    = chatState.RegionManager;
                events           = chatState.EventAggregator;
                cm               = chatState.ChatModel;
                connection       = chatState.Connection;
                characterManager = chatState.CharacterManager;
                this.api         = api.ThrowIfNull("api");
                this.logger      = logger.ThrowIfNull("logger");
                this.channels    = channels.ThrowIfNull("channelManager");
                this.iconService = iconService;

                events.GetEvent <UserCommandEvent>().Subscribe(CommandReceived, ThreadOption.UIThread, true);

                commands = new Dictionary <string, CommandHandler>
                {
                    { "bookmark-add", OnBookmarkAddRequested },
                    { "friend-remove", OnFriendRemoveRequested },
                    { "request-accept", OnFriendRequestAcceptRequested },
                    { "request-deny", OnFriendRequestDenyRequested },
                    { "request-send", OnFriendRequestSendRequested },
                    { "request-cancel", OnFriendRequestCancelRequested },
                    { "priv", OnPrivRequested },
                    { UserMessage, OnPivateMessageSendRequested },
                    { ChannelMessage, OnMsgRequested },
                    { ChannelAd, OnLrpRequested },
                    { UserStatus, OnStatusChangeRequested },
                    { "close", OnCloseRequested },
                    { "forceclose", OnForceChannelCloseRequested },
                    { "join", OnJoinRequested },
                    { UserIgnore, OnIgnoreRequested },
                    { "clear", OnClearRequested },
                    { "clearall", OnClearAllRequested },
                    { "_logger_open_log", OnOpenLogRequested },
                    { "_logger_open_folder", OnOpenLogFolderRequested },
                    { "code", OnChannelCodeRequested },
                    { UserInvite, OnInviteToChannelRequested },
                    { "who", OnWhoInformationRequested },
                    { "getdescription", OnChannelDescriptionRequested },
                    { "interesting", OnMarkInterestedRequested },
                    { "notinteresting", OnMarkNotInterestedRequested },
                    { "ignoreUpdates", OnIgnoreUpdatesRequested },
                    { AdminAlert, OnReportRequested },
                    { "tempignore", OnTemporaryIgnoreRequested },
                    { "tempunignore", OnTemporaryIgnoreRequested },
                    { "tempinteresting", OnTemporaryInterestedRequested },
                    { "tempnotinteresting", OnTemporaryInterestedRequested },
                    { "handlelatest", OnHandleLatestReportRequested },
                    { "handlereport", OnHandleLatestReportByUserRequested },
                    { "bookmark-remove", OnBookmarkRemoveRequested },
                    { "rejoin", OnChannelRejoinRequested },
                    { "searchtag", OnSearchTagToggleRequested },
                    { "logout", OnLogoutRequested },
                    { "soundon", OnSoundOnRequested },
                    { "soundoff", OnSoundOffRequested },
                    { "whois", OnWhoIsRequested },
                    { ChannelRoll, OnRollRequested }
                };
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }