示例#1
0
        public override void Groups_OnGroupMembers(object sender, GroupMembersReplyEventArgs e)
        {
            var      groupID = e.GroupID;
            SimGroup g       = DeclareGroup(groupID);

            if (MaintainGroupMetaData)
            {
                MetaDataQueue.Enqueue(() =>
                {
                    foreach (var member in e.Members)
                    {
                        var v = member.Value;
                        if (member.Key == UUID.Zero)
                        {
                            continue;
                        }
                        SimAvatarImpl A = DeclareAvatarProfile(member.Key);
                        //A.AddInfoMap(new NamedParam("GroupMember",groupID));
                    }
                    if (g != null)
                    {
                        SendOnUpdateDataAspect(g, "Members", null, null);
                    }
                });
            }
            // base.Groups_OnGroupMembers(requestID, totalCount, members);
        }
示例#2
0
        public override void Groups_OnGroupRolesMembers(object sender, GroupRolesMembersReplyEventArgs e)
        {
            var      groupID = e.GroupID;
            SimGroup g       = DeclareGroup(groupID);

            if (MaintainGroupMetaData)
            {
                MetaDataQueue.Enqueue(() =>
                {
                    foreach (var list in e.RolesMembers)
                    {
                        SimGeneric declareGeneric = DeclareGroupRole(groupID, list.Key);
                        if (list.Value != UUID.Zero)
                        {
                            SimAvatarImpl a = DeclareAvatarProfile(list.Value);
                            a.AddGroupRole(groupID, list.Key);
                            a.AddInfoMapItem(new NamedParam("simMemberRole",
                                                            declareGeneric));
                            SendOnUpdateDataAspect(a, "MemberRole", null, null);
                        }
                    }
                    if (g != null)
                    {
                        SendOnUpdateDataAspect(g, "Members", null, null);
                    }
                });
            }
            // base.Groups_OnGroupRolesMembers(requestID, groupID, rolesMembers);
        }
示例#3
0
        private SimAvatarImpl DeclareAvatarProfile(UUID uuid)
        {
            SimAvatarImpl A = CreateSimAvatar(uuid, this, null);

            A.IsProfile = true;
            return(A);
        }
示例#4
0
        public override void Avatars_OnAvatarProperties(object sender, AvatarPropertiesReplyEventArgs e)
        {
            SimAvatar A = DeclareAvatarProfile(e.AvatarID);

            if (!MaintainAvatarMetaData)
            {
                return;
            }
            A.ProfileProperties = e.Properties;
            UUID propertiesPartner = e.Properties.Partner;

            if (propertiesPartner != UUID.Zero)
            {
                SimAvatarImpl AA = DeclareAvatarProfile(propertiesPartner);
                //if (AA.GetName() == null)
                //{
                //    String s = GetUserName(propertiesPartner);
                //    AA.AspectName = s;
                //}
            }
            if (e.Properties.ProfileImage != UUID.Zero)
            {
                // RequestAsset(properties.ProfileImage, AssetType.Texture, true);
            }
            //TODO SendNewEvent("On-Avatar-Properties", GetAvatar(avatarID, null), properties);
        }
示例#5
0
        private void AddName2Key(string value, UUID id)
        {
            if (string.IsNullOrEmpty(value))
            {
                Debug("AddName2Key: ERROR name='" + value + "' " + id);
                return;
            }
            if (id == UUID.Zero)
            {
                Debug("AddName2Key: ERROR UUID.Zero " + value);
                return;
            }
            if (value.Contains("?"))
            {
                SimObject O = GetSimObjectFromUUID(id);
                if (O != null)
                {
                    if (O is SimAvatar)
                    {
                        Debug("ERROR AVATAR?!?!? " + value + " " + O);
                    }
                    return;
                }
                object obj = GetObject(id);
                if (obj is UUID || obj is string)
                {
                    lock (RequestedAvatarNames)
                    {
                        object stackTrace;
                        if (RequestedAvatarNames.TryGetValue(id, out stackTrace))
                        {
                            // Debug("AddName2Key: ERROR requested Name for ID=" + id + " " + stackTrace.ToString());
                            RequestedAvatarNames.Remove(id);
                        }
                        else
                        {
                            Debug("AddName2Key: ERROR NOT requested Name for ID=" + id);
                        }
                    }
                    var Obj = CreateSimObject(id, this, null);
                    Obj.ConfirmedObject = false;
                    Debug("AddName2Key: INFO Discovered new SimObject from UUID? " + value + " " + id + " " + Obj);
                    return;
                }
                else
                {
                    Debug("AddName2Key: ERROR UUID? " + value + " " + id + " " + obj);
                }
            }
            string n = value.Trim();

            if (n.Length < 3)
            {
                Debug("AddName2Key: INFO " + value + " " + id);
                return;
            }
            SimAvatarImpl A = DeclareAvatarProfile(id);

            A.AspectName = value;
            SendOnUpdateDataAspect(A, "simProperties-Name", null, value);

            lock (Name2Key)
            {
                Name2Key[value] = id;
            }
        }
示例#6
0
        public String GetUserName(UUID found)
        {
            SimObject obj0 = GetSimObjectFromUUID(found);

            if (obj0 != null)
            {
                string s = obj0.GetName();
                if (!string.IsNullOrEmpty(s))
                {
                    if (s.Trim() != "")
                    {
                        return(s);
                    }
                }
            }
            SimAvatarImpl AA = DeclareAvatarProfile(found);

            // case insensitive
            lock (Name2Key)
                foreach (KeyValuePair <string, UUID> kvp in Name2Key)
                {
                    if (kvp.Value == found)
                    {
                        return(kvp.Key);
                    }
                }
            {
                UUID             queryID         = UUID.Random();
                ManualResetEvent NameSearchEvent = new ManualResetEvent(false);
                EventHandler <UUIDNameReplyEventArgs> callback =
                    new EventHandler <UUIDNameReplyEventArgs>((s, e) =>
                {
                    foreach (KeyValuePair <UUID, string> kvp in e.Names)
                    {
                        AddName2Key(kvp.Value, kvp.Key);
                        if (kvp.Key == found)
                        {
                            AA.AspectName = kvp.Value;
                            NameSearchEvent.Set();
                        }
                    }
                });
                try
                {
                    client.Avatars.UUIDNameReply += callback;
                    // Send the Query
                    RequestAvatarName(found);
                    NameSearchEvent.WaitOne(10000, false);
                }
                finally
                {
                    client.Avatars.UUIDNameReply -= callback;
                }
            }

            lock (Name2Key)
                foreach (KeyValuePair <string, UUID> kvp in Name2Key)
                {
                    if (kvp.Value == found)
                    {
                        AA.AspectName = kvp.Key;
                        return(kvp.Key);
                    }
                }

            return(AA.GetName());
        }