protected List <GridRegion> ParseQuery(List <UUID> scopeIDs, List <string> query)
        {
            List <GridRegion> regionData = new List <GridRegion> ();

            if ((query.Count % 14) == 0)
            {
                for (int i = 0; i < query.Count; i += 14)
                {
                    GridRegion data = new GridRegion();
                    OSDMap     map  = (OSDMap)OSDParser.DeserializeJson(query [i + 13]);
                    map ["owner_uuid"] = (!map.ContainsKey("owner_uuid") || map ["owner_uuid"].AsUUID() == UUID.Zero)
                                            ? OSD.FromUUID(UUID.Parse(query [i + 6]))
                                            : map ["owner_uuid"];
                    map ["EstateOwner"] = (!map.ContainsKey("EstateOwner") || map ["EstateOwner"].AsUUID() == UUID.Zero)
                                             ? OSD.FromUUID(UUID.Parse(query [i + 6]))
                                             : map ["EstateOwner"];
                    data.FromOSD(map);

                    if (!regionData.Contains(data))
                    {
                        regionData.Add(data);
                    }
                }
            }

            return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, regionData));
        }
Beispiel #2
0
        protected List <GridRegion> ParseQuery(List <UUID> scopeIDs, List <string> query)
        {
            List <GridRegion> regionData = new List <GridRegion>();

            if ((query.Count % 14) == 0)
            {
                for (int i = 0; i < query.Count; i += 14)
                {
                    GridRegion data = new GridRegion();
                    OSDMap     map  = (OSDMap)OSDParser.DeserializeJson(query[i + 13]);
                    map["owner_uuid"]  = (!map.ContainsKey("owner_uuid") || map["owner_uuid"].AsUUID() == UUID.Zero) ? OSD.FromUUID(UUID.Parse(query[i + 6])) : map["owner_uuid"];
                    map["EstateOwner"] = (!map.ContainsKey("EstateOwner") || map["EstateOwner"].AsUUID() == UUID.Zero) ? OSD.FromUUID(UUID.Parse(query[i + 6])) : map["EstateOwner"];
                    data.FromOSD(map);

                    //Check whether it should be down
                    if (data.LastSeen > (Util.UnixTimeSinceEpoch() + (1000 * 6)))
                    {
                        data.Access |= (int)SimAccess.Down;
                    }

                    if (!regionData.Contains(data))
                    {
                        regionData.Add(data);
                    }
                }
            }

            return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, regionData));
        }
        private List <UserAccount> ParseQuery(List <UUID> scopeIDs, List <string> query)
        {
            List <UserAccount> list = new List <UserAccount>();

            for (int i = 0; i < query.Count; i += 9)
            {
                UserAccount data = new UserAccount
                {
                    PrincipalID = UUID.Parse(query[i + 0]),
                    ScopeID     = UUID.Parse(query[i + 1])
                };
                //We keep these even though we don't always use them because we might need to create the "Name" from them
                string FirstName = query[i + 2];
                string LastName  = query[i + 3];
                data.Email     = query[i + 4];
                data.Created   = Int32.Parse(query[i + 5]);
                data.UserLevel = Int32.Parse(query[i + 6]);
                data.UserFlags = Int32.Parse(query[i + 7]);
                data.Name      = query[i + 8];
                if (string.IsNullOrEmpty(data.Name))
                {
                    data.Name = FirstName + " " + LastName;
                    //Save the change!
                    Store(data);
                }
                list.Add(data);
            }

            return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, list));
        }
Beispiel #4
0
        public UserAccount GetUserAccount(List <UUID> scopeIDs, string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            UserAccount account;

            if (m_cache.Get(name, out account))
            {
                return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, account));
            }

            object remoteValue = DoRemoteByURL("UserAccountServerURI", scopeIDs, name);

            if (remoteValue != null || m_doRemoteOnly)
            {
                UserAccount acc = (UserAccount)remoteValue;
                if (remoteValue != null)
                {
                    m_cache.Cache(acc.PrincipalID, acc);
                }

                return(acc);
            }

            UserAccount[] d;

            d = m_Database.Get(scopeIDs,
                               new[] { "Name" },
                               new[] { name });

            if (d.Length < 1)
            {
                string[] split = name.Split(' ');
                if (split.Length == 2)
                {
                    return(GetUserAccount(scopeIDs, split[0], split[1]));
                }

                return(null);
            }

            CacheAccount(d[0]);
            return(d[0]);
        }
        private List <UserAccount> ParseQuery(List <UUID> scopeIDs, List <string> query)
        {
            List <UserAccount> list = new List <UserAccount>();

            for (int i = 0; i < query.Count; i += 12)
            {
                UserAccount data = new UserAccount {
                    PrincipalID = UUID.Parse(query[i + 0]), ScopeID = UUID.Parse(query[i + 1])
                };
                if (query[i + 11] != "")
                {
                    data.FromOSD((OSDMap)OSDParser.DeserializeJson(query[i + 11]));
                }

                //We keep these even though we don't always use them because we might need to create the "Name" from them
                string FirstName = query[i + 2];
                string LastName  = query[i + 3];
                data.Email = query[i + 4];

                data.ServiceURLs = new Dictionary <string, object>();
                if ((query[i + 5] != null) && (query[i + 5].Contains("=")))
                {
                    Dictionary <string, string> dict = Util.ConvertToDictionary(query[i + 5]);
                    foreach (var v in dict)
                    {
                        data.ServiceURLs[v.Key] = v.Value;
                    }
                }
                data.Created   = Int32.Parse(query[i + 6]);
                data.UserLevel = Int32.Parse(query[i + 7]);
                data.UserFlags = Int32.Parse(query[i + 8]);
                data.UserTitle = query[i + 9];
                data.Name      = query[i + 10];
                if (string.IsNullOrEmpty(data.Name))
                {
                    data.Name = FirstName + " " + LastName;
                    //Save the change!
                    Store(data);
                }
                list.Add(data);
            }

            return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, list));
        }
Beispiel #6
0
        public UserAccount GetUserAccount(List <UUID> scopeIDs, UUID principalID)
        {
            UserAccount account;

            if (m_cache.Get(principalID, out account))
            {
                return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, account));
            }

            object remoteValue = DoRemoteByURL("UserAccountServerURI", scopeIDs, principalID);

            if (remoteValue != null || m_doRemoteOnly)
            {
                UserAccount acc = (UserAccount)remoteValue;
                if (remoteValue != null)
                {
                    m_cache.Cache(principalID, acc);
                }

                return(acc);
            }

            UserAccount[] d;

            d = m_Database.Get(scopeIDs,
                               new[] { "PrincipalID" },
                               new[] { principalID.ToString() });

            if (d.Length < 1)
            {
                m_cache.Cache(principalID, null);
                return(null);
            }

            CacheAccount(d[0]);
            return(d[0]);
        }
Beispiel #7
0
        public UserAccount GetUserAccount(List <UUID> scopeIDs, string firstName, string lastName)
        {
            UserAccount account;

            if (m_cache.Get(firstName + " " + lastName, out account))
            {
                return(AllScopeIDImpl.CheckScopeIDs(scopeIDs, account));
            }

            object remoteValue = DoRemoteByURL("UserAccountServerURI", scopeIDs, firstName, lastName);

            if (remoteValue != null || m_doRemoteOnly)
            {
                UserAccount acc = (UserAccount)remoteValue;
                if (remoteValue != null)
                {
                    m_cache.Cache(acc.PrincipalID, acc);
                }

                return(acc);
            }

            UserAccount[] d;

            d = m_Database.Get(scopeIDs,
                               new[] { "FirstName", "LastName" },
                               new[] { firstName, lastName });

            if (d.Length < 1)
            {
                return(null);
            }

            CacheAccount(d[0]);
            return(d[0]);
        }