Ejemplo n.º 1
0
 public static void SetClassifiedCategories(ref LindenLoginData response)
 {
     response.AddClassifiedCategory(1, "Shopping");
     response.AddClassifiedCategory(2, "Land Rental");
     response.AddClassifiedCategory(3, "Property Rental");
     response.AddClassifiedCategory(4, "Special Attraction");
     response.AddClassifiedCategory(5, "New Products");
     response.AddClassifiedCategory(6, "Employment");
     response.AddClassifiedCategory(7, "Wanted");
     response.AddClassifiedCategory(8, "Service");
     response.AddClassifiedCategory(9, "Personal");
 }
        LindenLoginData SetUpLindenLoginData(OpenSim.Grid.UserServer.Modules.RexLogin.Avatar avatar, string account,
            string welcomeMessage, UUID sessionID) 
        {
            LindenLoginData response = new LindenLoginData();

            response.AgentID = avatar.ID;
            response.BuddyList = LindenLoginHelper.GetBuddyList(avatar.ID);
            LindenLoginHelper.SetClassifiedCategories(ref response);
            response.FirstName = avatar.GetAttribute(AvatarAttributes.FIRST_NAME).AsString() + " " + avatar.GetAttribute(AvatarAttributes.LAST_NAME).AsString();
            avatar.Attributes[AvatarAttributes.FIRST_NAME] = OSD.FromString(response.FirstName);
            response.HomeLookAt = avatar.GetAttribute(AvatarAttributes.HOME_LOOKAT).AsVector3();
            response.HomePosition = avatar.GetAttribute(AvatarAttributes.HOME_POSITION).AsVector3();
            response.HomeRegionX = avatar.GetAttribute(AvatarAttributes.HOME_REGION_X).AsUInteger();
            response.HomeRegionY = avatar.GetAttribute(AvatarAttributes.HOME_REGION_Y).AsUInteger();
            response.LastName = "<" + account + ">";
            avatar.Attributes[AvatarAttributes.LAST_NAME] = OSD.FromString(response.LastName);
            response.Login = true;
            response.Message = welcomeMessage;
            response.SessionID = sessionID;
            response.SecureSessionID = UUID.Random();

            return response;
        }
Ejemplo n.º 3
0
        private bool TryPrepareLogin(Avatar avatar, CableBeachMessages.RegionInfo startRegion, Vector3 startPosition,
            string clientVersion, System.Net.IPAddress clientIP, ref LindenLoginData response, X509Certificate2 httpCertificate,
            int circuitCode)
        {
            EnableClientMessage message = new EnableClientMessage();
            message.Identity = avatar.Identity;
            message.AgentID = avatar.ID;
            message.Attributes = avatar.Attributes;
            message.CallbackUri = null;
            message.ChildAgent = false;
            //message.CircuitCode = LindenLoginHelper.CreateCircuitCode();
            message.CircuitCode = circuitCode;
            message.ClientVersion = clientVersion;
            message.IP = clientIP;
            message.RegionHandle = startRegion.Handle;
            message.SecureSessionID = response.SecureSessionID;
            message.Services = avatar.Services.ToMessageDictionary();
            Dictionary<Uri, Uri> avStrgDict = new Dictionary<Uri, Uri>();
            avStrgDict.Add(RexAvatarAttributes.AVATAR_STORAGE_URL, avatar.Attributes[RexAvatarAttributes.AVATAR_STORAGE_URL].AsUri());
            message.Services.Add(RexAvatarAttributes.AVATAR_STORAGE_URL, avStrgDict);
            message.SessionID = response.SessionID;

            Uri enableClientCap;
            if (startRegion.Capabilities.TryGetValue(new Uri(CableBeachServices.SIMULATOR_ENABLE_CLIENT), out enableClientCap))
            {
                CapsClient request = (httpCertificate != null) ?
                new CapsClient(enableClientCap, httpCertificate) :
                new CapsClient(enableClientCap);

                OSDMap responseMap = request.GetResponse(message.Serialize(), OSDFormat.Json, LindenLoginHelper.REQUEST_TIMEOUT) as OSDMap;

                if (responseMap != null)
                {
                    EnableClientReplyMessage reply = new EnableClientReplyMessage();
                    reply.Deserialize(responseMap);

                    if (reply.SeedCapability != null)
                    {
                        m_log.Debug("enable_client succeeded, sent circuit code " + message.CircuitCode + " and received seed capability " +
                            reply.SeedCapability + " from " + enableClientCap);

                        response.CircuitCode = message.CircuitCode;
                        response.SeedCapability = reply.SeedCapability.ToString();
                        return true;
                    }
                    else
                    {
                        m_log.Error("[LindenLoginHelper] enable_client call to region " + startRegion.Name + " for login from " + avatar.Identity +
                            " failed, did not return a seed capability");
                    }
                }
                else
                {
                    m_log.Error("[LindenLoginHelper] enable_client call to region " + startRegion.Name + " for login from " + avatar.Identity +
                        " failed, could not contact or invalid response");
                }
            }
            else
            {
                m_log.Error("[LindenLoginHelper] enable_client call failed, region " + startRegion.Name +
                    " does not have an enable_client capability");
            }

            return false;
        }