Пример #1
0
        private void OnUserDetailRequest(INetworkConnection con, Packet r)
        {
            Log1.Logger("Zeus.Inbound.Client").Debug("User detail request from " + ServerUser.AccountName + ".");

            PacketGenericMessage msg = r as PacketGenericMessage;
            Guid user = msg.Parms.GetGuidProperty(2);

            WispUserDetail ud = new WispUserDetail();

            r.ReplyPacket = CreateStandardReply(r, ReplyType.OK, "");
            r.ReplyPacket.Parms.SetProperty(1, MyServer.ServerUserID);
            r.ReplyPacket.Parms.SetProperty(2, ud);

            MembershipUser usr = Membership.GetUser(user, false);

            if (usr == null)
            {
                r.ReplyPacket.ReplyCode    = ReplyType.Failure;
                r.ReplyPacket.ReplyMessage = "User not found.";
            }
            else
            {
                ud.Email              = usr.Email;
                ud.ID                 = user;
                ud.IsApproved         = usr.IsApproved;
                ud.IsLocked           = usr.IsLockedOut;
                ud.LastLogin          = usr.LastLoginDate.ToUniversalTime();
                ud.LastPasswordChange = usr.LastPasswordChangedDate.ToUniversalTime();
                ud.Roles.AddRange(Roles.GetRolesForUser(usr.UserName));
                ud.Username  = usr.UserName;
                ud.UserSince = usr.CreationDate;

                ServerUser su = ConnectionManager.GetAuthorizedUser(usr.UserName, MyServer, PacketLoginRequest.ConnectionType.AssistedTransfer);
                ud.IsOnline = su != null;
                if (su != null)
                {
                    ud.CurrentLoginTime = su.Profile.CurrentLoginTime;
                }

                AccountProfile prof = null;
                prof = new AccountProfile(usr.UserName);
                prof.Load(MyServer.RequireAuthentication);

                ud.AddedProperties = prof.AddedProperties;
                ud.LoginSessions   = new List <AccountProfile.Session>(prof.AllSessions);

                if (!DB.Instance.User_GetServiceLogEntries(user, "", ud.ServiceNotes))
                {
                    ServiceLogEntry sle = new ServiceLogEntry();
                    sle.EntryBy = "System";
                    sle.Note    = "Unable to retrieve service log entries from database.";
                    ud.ServiceNotes.Add(sle);
                }

                ud.Characters = CharacterUtil.Instance.GetCharacterListing(user);
            }
        }
        private void OnUserDetailRequest(INetworkConnection con, Packet r)
        {
            Log1.Logger("Zeus.Inbound.Client").Debug("User detail request from " + ServerUser.AccountName + ".");

            PacketGenericMessage msg = r as PacketGenericMessage;
            Guid user = msg.Parms.GetGuidProperty(2);

            WispUserDetail ud = new WispUserDetail();
            r.ReplyPacket = CreateStandardReply(r, ReplyType.OK, "");
            r.ReplyPacket.Parms.SetProperty(1, MyServer.ServerUserID);
            r.ReplyPacket.Parms.SetProperty(2, ud);

            MembershipUser usr = Membership.GetUser(user, false);
            if (usr == null)
            {
                r.ReplyPacket.ReplyCode = ReplyType.Failure;
                r.ReplyPacket.ReplyMessage = "User not found.";
            }
            else
            {
                ud.Email = usr.Email;
                ud.ID = user;
                ud.IsApproved = usr.IsApproved;
                ud.IsLocked = usr.IsLockedOut;
                ud.LastLogin = usr.LastLoginDate.ToUniversalTime();
                ud.LastPasswordChange = usr.LastPasswordChangedDate.ToUniversalTime();
                ud.Roles.AddRange(Roles.GetRolesForUser(usr.UserName));
                ud.Username = usr.UserName;
                ud.UserSince = usr.CreationDate;

                ServerUser su = ConnectionManager.GetAuthorizedUser(usr.UserName, MyServer, PacketLoginRequest.ConnectionType.AssistedTransfer);
                ud.IsOnline = su != null;
                if (su != null)
                {
                    ud.CurrentLoginTime = su.Profile.CurrentLoginTime;
                }

                AccountProfile prof = null;
                prof = new AccountProfile(usr.UserName);
                prof.Load(MyServer.RequireAuthentication);

                ud.AddedProperties = prof.AddedProperties;
                ud.LoginSessions = new List<AccountProfile.Session>(prof.AllSessions);

                if (!DB.Instance.User_GetServiceLogEntries(user, "", ud.ServiceNotes))
                {
                    ServiceLogEntry sle = new ServiceLogEntry();
                    sle.EntryBy = "System";
                    sle.Note = "Unable to retrieve service log entries from database.";
                    ud.ServiceNotes.Add(sle);
                }

                ud.Characters = CharacterUtil.Instance.GetCharacterListing(user);
            }
        }