Beispiel #1
0
        public override void Initialize(IServer server)
        {
            // Set handlers
            server.SetHandler((short)MsfMessageCodes.PickUsername, OnPickUsernameRequestHandler);
            server.SetHandler((short)MsfMessageCodes.JoinChannel, OnJoinChannelRequestHandler);
            server.SetHandler((short)MsfMessageCodes.LeaveChannel, OnLeaveChannelRequestHandler);
            server.SetHandler((short)MsfMessageCodes.GetCurrentChannels, OnGetCurrentChannelsRequestHandler);
            server.SetHandler((short)MsfMessageCodes.ChatMessage, OnChatMessageHandler);
            server.SetHandler((short)MsfMessageCodes.GetUsersInChannel, OnGetUsersInChannelRequestHandler);
            server.SetHandler((short)MsfMessageCodes.SetDefaultChannel, OnSetDefaultChannelRequestHandler);

            // Setup authModule dependencies
            authModule = server.GetModule <AuthModule>();

            // Setup censorModule
            censorModule = server.GetModule <CensorModule>();

            if (useAuthModule && authModule != null)
            {
                authModule.OnUserLoggedInEvent  += OnUserLoggedInEventHandler;
                authModule.OnUserLoggedOutEvent += OnUserLoggedOutEventHandler;
            }
            else if (useAuthModule)
            {
                logger.Error("Chat module was set to use Auth module, but Auth module was not found");
            }
        }
        public override void Initialize(IServer server)
        {
            base.Initialize(server);

            Mailer = Mailer ?? FindObjectOfType <Mailer>();

            LoggedInUsers = new Dictionary <string, IUserExtension>();

            // Set handlers
            server.SetHandler((short)MsfOpCodes.LogIn, HandleLogIn);
            server.SetHandler((short)MsfOpCodes.RegisterAccount, HandleRegister);
            server.SetHandler((short)MsfOpCodes.PasswordResetCodeRequest, HandlePasswordResetRequest);
            server.SetHandler((short)MsfOpCodes.RequestEmailConfirmCode, HandleRequestEmailConfirmCode);
            server.SetHandler((short)MsfOpCodes.ConfirmEmail, HandleEmailConfirmation);
            server.SetHandler((short)MsfOpCodes.GetLoggedInCount, HandleGetLoggedInCount);
            server.SetHandler((short)MsfOpCodes.PasswordChange, HandlePasswordChange);
            //     server.SetHandler((short)MsfOpCodes.GetPeerAccountInfo, HandleGetPeerAccountInfo);

            singleton = this;
        }
Beispiel #3
0
        public override void Initialize(IServer server)
        {
            profileDatabaseAccessor = Msf.Server.DbAccessors.GetAccessor <IProfilesDatabaseAccessor>();

            if (profileDatabaseAccessor == null)
            {
                logger.Error("Profiles database implementation was not found");
            }

            // Auth dependency setup
            authModule = server.GetModule <AuthModule>();

            if (authModule != null)
            {
                authModule.OnUserLoggedInEvent += OnUserLoggedInEventHandler;
            }

            // Games dependency setup
            server.SetHandler((short)MsfMessageCodes.ServerProfileRequest, GameServerProfileRequestHandler);
            server.SetHandler((short)MsfMessageCodes.UpdateServerProfile, ProfileUpdateHandler);
            server.SetHandler((short)MsfMessageCodes.ClientProfileRequest, ClientProfileRequestHandler);
        }
        public override void Initialize(IServer server)
        {
            Database = Msf.Server.DbAccessors.GetAccessor <IProfilesDatabase>();

            if (Database == null)
            {
                Logger.Error("Profiles database implementation was not found");
            }

            server.SetHandler((short)MsfOpCodes.ClientProfileRequest, HandleClientProfileRequest);

            // Auth dependency setup
            _auth = server.GetModule <AuthModule>();
            if (_auth != null)
            {
                _auth.LoggedIn += OnLoggedIn;
            }

            // Games dependency setup
            server.SetHandler((short)MsfOpCodes.ServerProfileRequest, HandleGameServerProfileRequest);
            server.SetHandler((short)MsfOpCodes.UpdateServerProfile, HandleProfileUpdates);
        }